## Enable the Balancer 

Use this procedure if you have disabled the balancer and are ready to re-enable it: 

1. Connect to any mongos in the cluster using the mongo shell. 

2. Issue one of the following operations to enable the balancer: 

From the mongo shell, issue: 

sh.setBalancerState( true ) 

From a driver that does not have the sh.startBalancer() helper, issue the following from the config database: 

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

## Disable Balancing During Backups 

If MongoDB migrates a chunk during a backup (page 184), you can end with an inconsistent snapshot of your sharded cluster . Never run a backup while the balancer is active. To ensure that the balancer is inactive during your backup operation: 

• Set the balancing window (page 716) so that the balancer is inactive during the backup. Ensure that the backup can complete while you have the balancer disabled. 

• manually disable the balancer (page 717) for the duration of the backup procedure. 

If you turn the balancer off while it is in the middle of a balancing round, the shut down is not instantaneous. The balancer completes the chunk move in-progress and then ceases all further balancing rounds. 

Before starting a backup operation, confirm that the balancer is not active. You can use the following command to determine if the balancer is active: 

!sh.getBalancerState() && !sh.isBalancerRunning() 

When the backup procedure is complete you can reactivate the balancer process. 

## Disable Balancing on a Collection 

You can disable balancing for a specific collection with the sh.disableBalancing() method. You may want to disable the balancer for a specific collection to support maintenance operations or atypical workloads, for example, during data ingestions or data exports. 

When you disable balancing on a collection, MongoDB will not interrupt in progress migrations. 

To disable balancing on a collection, connect to a mongos with the mongo shell and call the sh.disableBalancing() method. 

For example: 

sh.disableBalancing("students.grades") 

The sh.disableBalancing() method accepts as its parameter the full namespace of the collection. 

