balancerStart

On this page本页内容

Definition定义

balancerStart

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

Syntax语法

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

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

db.adminCommand( { balancerStart: 1, maxTimeMS: <number> } )
Field字段Type类型Description描述
balancerStartanyAny value.任何值。
maxTimeMSinteger

Optional. 可选。Time limit for enabling 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 time to wait for the balancing round to start.如果将3.4 mongo shell与早期版本的分片集群一起使用,则该参数指定等待平衡轮开始的时间。

Example示例

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

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