balancerStop

On this page本页内容

Definition定义

balancerStop

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. 从MongoDB 4.2开始,该命令禁用分片集群的自动拆分。To enable auto-splitting when the balancer is disabled, you can use sh.enableAutoSplit().要在禁用平衡器时启用自动拆分,可以使用sh.enableAutoSplit()

Syntax语法

You can only issue the balancerStop against the admin database on a mongos instance.您只能针对mongos实例上的管理数据库发出balancerStop

The command takes the following form:该命令采用以下形式:

db.adminCommand( { balancerStop: 1, maxTimeMS: <number> } )
Field字段Type类型Description描述
balancerStopanyAny value.
maxTimeMSinteger

Time limit for disabling the balancer.禁用平衡器的时间限制。

Defaults to 60000 milliseconds.默认为60000毫秒。

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.如果将3.4 mongo shell与早期版本的分片集群一起使用,则该参数指定等待平衡轮停止的毫秒数。

Example示例

To stop the balancer thread, connect to a mongos instance and issue the following command:要停止平衡器线程,请连接到mongos实例并发出以下命令:

db.adminCommand( { balancerStop: 1 } )
Tip提示
See also: 参阅:
←  balancerStatuscheckShardingIndex →