On this page本页内容
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()
。
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> } )
balancerStop | any | Any value. |
maxTimeMS | integer |
mongo shell with earlier version sharded clusters, the parameter specifies the amount of milliseconds to wait for the balancing round to stop.mongo shell与早期版本的分片集群一起使用,则该参数指定等待平衡轮停止的毫秒数。
|
To stop the balancer thread, connect to a 要停止平衡器线程,请连接到mongos
instance and issue the following command:mongos
实例并发出以下命令:
db.adminCommand( { balancerStop: 1 } )