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

sh.startBalancer()(mongosh方法)

sh.startBalancer(timeout, interval)

在版本7.0中进行了更改。

在分片集群中启动 负载均衡器

从MongoDB 7.0 开始,启动负载均衡器还会为分片集群启用 AutoMerger

重要

mongosh 方法

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

有关数据库命令,请参阅 balancerStart 命令。

如需了解 MongoDB API 驱动程序,请参阅特定语言的 MongoDB 驱动程序文档。

该方法可以采用以下选项:

Parameter
类型
说明

timeout

整型

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

默认为 60000 毫秒。

interval

整型

可选。 检查均衡轮次是否已开始的频率(以毫秒为单位)。

You can only run sh.startBalancer() on a mongos instance. sh.startBalancer() errors if run on mongod instance.

此方法可用于以下环境中托管的部署:

  • MongoDB Atlas:用于云中 MongoDB 部署的完全托管服务

重要

M0 和 Flex 集群不支持此命令。有关更多信息,请参阅不支持的命令。

The mongosh shell method sh.startBalancer() is a wrapper around the balancerStart command. sh.startBalancer() runs the balancerStart command in the background and returns immediately.

要学习;了解如何为集群配置负载均衡器,请参阅管理分片集群负载均衡器。

要禁用特定集合的负载均衡,请参阅禁用集合负载均衡。

要重新启用特定集合的负载均衡,请参阅启用集合负载均衡。

给本页内容打分