Docs Menu
Docs Home
/
Database Manual
/ / /

balancerStop (database command)

balancerStop

Disables the balancer in a sharded cluster. If a balancing round is in progress, the operation waits for balancing to complete.

You can only issue the balancerStop command against the admin database on a mongos instance.

Starting in MongoDB 7.0, stopping the balancer also disables the AutoMerger for the sharded cluster.

Important

Leaving the balancer disabled for extended periods of time can lead to unbalanced shards, which degrade cluster performance. Only disable the balancer if necessary, and ensure that you re-enable the balancer when maintenance is complete.

Tip

In mongosh, this command can also be run through the sh.stopBalancer() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

This command is available in deployments hosted in the following environments:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

The command has the following syntax:

db.adminCommand(
{
balancerStop: 1,
maxTimeMS: <number>
}
)
Field
Type
Description

balancerStop

any

Any value.

maxTimeMS

integer

Time limit for disabling the balancer.

Defaults to 60000 milliseconds.

To stop the balancer thread, connect to a mongos instance and issue the following command:

db.adminCommand( { balancerStop: 1 } )

Back

balancerStatus

On this page