sh.stopBalancer()

On this page本页内容

Definition定义

sh.stopBalancer(timeout, interval)

Changed in version 4.2.在版本4.2中更改

Disables the balancer in a sharded cluster. 禁用分片群集中的平衡器。Starting in MongoDB 4.2, sh.stopBalancer() also disables auto-splitting for the sharded cluster.从MongoDB 4.2开始,sh.stopBalancer()还禁用了分片集群的自动拆分。

The method can take the following options:该方法可以采用以下选项:

Parameter参数Type类型Description描述
timeoutinteger

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,该参数指定等待平衡轮停止的毫秒数。

intervalinteger

The interval (in milliseconds) at which to check if the balancing round has stopped.检查平衡回合是否已停止的间隔(毫秒)。

Changed in version 3.4.在版本3.4中更改

Only applicable when using version 3.4 mongo shell with earlier version sharded clusters.仅适用于将3.4版mongo shell与早期版本的分片集群配合使用。

You can only run sh.stopBalancer() on a mongos instance. 只能在mongos实例上运行sh.stopBalancer()sh.stopBalancer() errors if run on mongod instance.如果在mongod实例上运行,sh.stopBalancer()会出错。

The mongo shell method is a wrapper around the balancerStop command, introduced in 3.4.mongo shell方法是3.4中引入的balancerStop命令的包装器。

Behavior行为

If a balancing round is in progress, the operation waits for balancing to complete.如果正在进行平衡回合,操作将等待平衡完成。

←  sh.status()sh.waitForBalancer() →