简体   繁体   中英

Load Balancing Between Mongos

I have created a sharded environment, I am using two mongos. Is their a way I can load balance between the two "mongos",Because presently I found the Mongo client uses one of the two.Or do I have to write my own load balancer?

The recommendation would be having a mongos per application server and not implementing your own load balancer.

A query may not return the whole result in one batch, in which case the mongos will store some information associated with the cursor. If subsequent requests to iterate using the cursor are not redirected to the same mongos, then you will get errors. A load balancer would need to understand the MongoDB binary wire protocol to guarantee that scenario is handled properly.

See: http://craiggwilson.com/2013/10/21/load-balanced-mongos/

We had the same question. Looks like Java Mongo Client can do the failover connection by itself. Please see the answers for this question. MongoDB load balancing and failover of query routers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM