Docs Menu
Docs Home
/
MongoDB Manual
/ / /

balancerStart

On this page

  • Definition
  • Syntax
  • Example
balancerStart

New in version 3.4.

Starts the balancer thread. The command does not wait for a balancing round to start.

Starting in MongoDB 4.2, the command enables auto-splitting for the sharded cluster. To disable auto-splitting when the balancer is enabled, you can use sh.disableAutoSplit().

Tip

In the mongo Shell, this command can also be run through the sh.startBalancer() helper method.

Helper methods are convenient for mongo 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.

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

The command takes the following form:

db.adminCommand( { balancerStart: 1, maxTimeMS: <number> } )
Field
Type
Description
balancerStart
any
Any value.
maxTimeMS
integer

Optional. Time limit for enabling the balancer.

Defaults to 60000 milliseconds.

Changed in version 3.4: If using the 3.4 mongo shell with earlier version sharded clusters, the parameter specifies the amount of time to wait for the balancing round to start.

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

db.adminCommand( { balancerStart: 1 } )

Tip

See also:

Back

balancerCollectionStatus