How do I pause/unpause shard balancing in MongoDB?

During index creations and other long operations it is sometimes helpful to pause shard rebalancing.

To pause/disable sharding connect with the console and run

use config
db.settings.update( { _id: "balancer" }, { $set : { stopped: true } } , true );

To unpause/re-enable shard balancing connect to the console again and run

use config
db.settings.update( { _id: "balancer" }, { $set : { stopped: false } } , true );

You cannot comment on this entry