对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

balancerStop(数据库命令)

balancerStop

禁用分片集群中的负载均衡器。 如果正在进行均衡轮次,则操作会等待均衡完成。

You can only issue the balancerStop command against the admin database on a mongos instance.

从MongoDB 7.0 开始,停止负载均衡器还会禁用分片集群的 AutoMerger。

重要

长时间禁用负载负载均衡器可能会导致分片失衡,从而降低集群性能。 仅在必要时禁用负载均衡器,并确保在维护完成后重新启用负载均衡器。

提示

In mongosh, this command can also be run through the sh.stopBalancer() helper method.

Helper methods are convenient for mongosh users, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.

此命令可用于以下环境中托管的部署:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

该命令具有以下语法:

db.adminCommand(
{
balancerStop: 1,
maxTimeMS: <number>
}
)
字段
类型
说明

balancerStop

any

任何值。

maxTimeMS

整型

禁用负载均衡器的时间限制。

默认为 60000 毫秒。

要停止负载均衡器线程,请连接到mongos实例并发出以下命令:

db.adminCommand( { balancerStop: 1 } )
给本页内容打分