sh.stopBalancer()
On this page本页内容
Definition定义
sh.stopBalancer(timeout, interval)Changed in version 6.1.6.1版更改。Disables the balancer in a sharded cluster.禁用分片集群中的平衡器。Starting in MongoDB 6.1, automatic chunk splitting is not performed.从MongoDB 6.1开始,不执行自动区块分割。This is because of balancing policy improvements.这是因为平衡政策的改进。Auto-splitting commands still exist, but do not perform an operation.自动拆分命令仍然存在,但不执行操作。For details, see Balancing Policy Changes.有关详细信息,请参阅平衡策略更改。In MongoDB versions earlier than 6.1,在6.1之前的MongoDB版本中,sh.stopBalancer()also disables auto-splitting for the sharded cluster.sh.stopBalancer()还禁用了分片集群的自动拆分。Importantmongosh Method
This page documents a
mongoshmethod. This is not the documentation for database commands or language-specific drivers, such as Node.js.For the database command, see the
balancerStopcommand.For MongoDB API drivers, refer to the language-specific MongoDB driver documentation.有关MongoDB API驱动程序,请参阅特定语言的MongoDB驱动程序文档。For the legacy对于遗留的mongoshell文档,请参阅相应MongoDB Server版本的文档:mongoshell documentation, refer to the documentation for the corresponding MongoDB Server release:The method can take the following options:该方法可以采用以下选项:Parameter参数Type类型Description描述timeoutinteger Time limit for disabling the balancer.禁用平衡器的时间限制。
Defaults to 60000 milliseconds.默认值为60000毫秒。intervalinteger The interval (in milliseconds) at which to check if the balancing round has stopped.检查平衡循环是否已停止的间隔(以毫秒为单位)。You can only run您只能在sh.stopBalancer()on amongosinstance.mongos实例上运行sh.stopBalancer()。如果在sh.stopBalancer()errors if run onmongodinstance.mongod实例上运行,sh.stopBalancer()将出错。Themongoshshell method is a wrapper around thebalancerStopcommand.mongoshshell方法是balancerStop命令的包装器。
Behavior行为
If a balancing round is in progress, the operation waits for balancing to complete.如果正在进行一轮平衡,则操作将等待平衡完成。