Docs 菜单

balancerStart

balancerStart

Starts the balancer thread. The command does not wait for a balancing round to start.

提示

mongosh 中,该命令也可通过 sh.startBalancer() 辅助方法运行。

辅助方法对 mongosh 用户来说很方便,但它们返回的信息级别可能与数据库命令不同。如果不追求方便或需要额外的返回字段,请使用数据库命令。

从 MongoDB 6.0.3 开始,不再执行自动数据块分割。这是因为均衡策略的改进。自动分割命令仍然存在,但不执行操作。

In MongoDB versions earlier than 6.1, the command enables auto-splitting for the sharded cluster. To disable auto-splitting when the balancer is enabled, you can use sh.disableAutoSplit().

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

重要

无服务器实例不支持此命令。 有关更多信息,请参阅不支持的命令。

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

该命令具有以下语法:

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

balancerStart

any

任何值。

maxTimeMS

整型

可选。 启用负载均衡器的时间限制。

默认为 60000 毫秒。

To start the balancer thread, connect to a mongos instance and issue the following command:

db.adminCommand( { balancerStart: 1 } )

另请参阅: