balancerStop

Definition

  • balancerStop

New in version 3.4.

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

Starting in MongoDB 4.2, the command disables auto-splitting for the sharded cluster. To enable auto-splitting when the balancer isdisabled, you can use sh.enableAutoSplit().

Syntax

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

The command takes the following form:

  1. db.adminCommand( { balancerStop: 1, maxTimeMS: <number> } )
FieldTypeDescription
balancerStopanyAny value.
maxTimeMSintegerTime limit for disabling the balancer.Defaults to 60000 milliseconds.Changed in version 3.4: If using the 3.4 mongo shell with earlier versionsharded clusters, the parameter specifies the amount ofmilliseconds to wait for the balancing round to stop.

Example

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

  1. db.adminCommand( { balancerStop: 1 } )

See also