balancerStop

On this page本页内容

Definition定义

balancerStop

New in version 3.4.版本3.4中的新功能。

Disables the balancer in a sharded cluster. If a balancing round is in 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 is disabled, you can use sh.enableAutoSplit().

Syntax语法

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

The command takes the following form:

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.

Changed in version 3.4.在版本3.4中更改。If using the 3.4 mongo shell with earlier version sharded clusters, the parameter specifies the amount of milliseconds to wait for the balancing round to stop.

Example示例

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

db.adminCommand( { balancerStop: 1 } )