I have a mongo shards cluster and a mongos instance. These servers are running on MongoDB 3.4.0. When I use mongo shell 3.4.0 to connect to the mongos, I got below output from sh.isBalancerRunning(),

mongos> sh.isBalancerRunning()

but I got a different result when I use mongo shell 3.2.13:

mongos> sh.isBalancerRunning()

Is this something not compatible between mongo versions? If yes, why other commands work fine just this command doesn't?


The difference is that 3.4 balancing work is done by config server primary and at 3.2 it was done by one of the mongos services.

To prevent "older" (<3.4) mongos services to start balancing work, config server (>=3.4) makes "lock" document to the local collection, what "states" that one of the mongos services have "balancing lock" set.

That document doesn't prevent (>=3.4) config server to do balancing. That is the reason why older mongos "report" that there is always balancing ongoing!

  • Thanks for this explanation. One question is what you mean by ` config server (>=3.4) makes "lock" document to the local collection`. Does this mean the config server always lock the local collection? – Joey Yi Zhao Oct 6 '17 at 22:59
  • With "local" I mean config servers config DB and there locks collection. docs.mongodb.com/manual/reference/config-database/#config.locks – JJussi Oct 7 '17 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.