To determine the balancer state, here are two mongo shell helper methods that might prove to be useful. Bear in mind that these can only be issued when connected to an appropriate mongos instance:
- sh.getBalancerState(): This command returns a Boolean value. A value of true indicates that the balancer is stable and available. A value of false means it's offline and/or there is a problem.
- sh.isBalancerRunning(): This shell method also returns a Boolean value. A value of false does not indicate a problem: it only tells you that the balancer is not running at this exact moment.
Now, let's look at disabling the balancer.