suchen

Heim  >  Fragen und Antworten  >  Hauptteil

golang - go连接mongo replica set时,如何让read均匀分布到各个secondary上去?

replicaset有两个secondary,Eventual mode,但在使用labix/mgo.v2连接mongo时,发现所有的read都只集中在一个secondary上了,仅有很少的量会访问另外一个secondary。

// Read preference modes are specific to mgo:
Eventual  Mode = 0 // Same as Nearest, but may change servers between reads.
Monotonic Mode = 1 // Same as SecondaryPreferred before first write. Same as Primary after first write.
Strong    Mode = 2 // Same as Primary.
过去多啦不再A梦过去多啦不再A梦2792 Tage vor928

Antworte allen(1)Ich werde antworten

  • 怪我咯

    怪我咯2017-05-02 09:26:30

    1、检查一下connect URL的设置;

    2、如果读的Load Balance和你设置的参数的预期不一样,可以考虑配合设置Tag,进一步配置从什么member读。

    供参考。

    Love MongoDB! Have Fun!

    Antwort
    0
  • StornierenAntwort