On this page本页内容
sh.startBalancer(timeout, interval)
Changed in version 4.2.在版本4.2中更改。
Starts the balancer in a sharded cluster. 在分片集群中启动平衡器。Starting in MongoDB 4.2, 从MongoDB 4.2开始,sh.startBalancer()
also enables auto-splitting for the sharded cluster.sh.startBalancer()
还支持自动分割分片集群。
The method can take the following options:该方法可以采用以下选项:
timeout | integer |
mongo shell with earlier version sharded clusters, the parameter specifies the amount of time to wait for the balancing round to start.mongo shell,该参数指定等待平衡轮开始的时间。
|
interval | integer |
mongo shell with earlier version sharded clusters.mongo shell与早期版本的分片集群配合使用。
|
You can only run 只能在sh.startBalancer()
on a mongos
instance. mongos
实例上运行sh.startBalancer()
。如果在sh.startBalancer()
errors if run on mongod
instance.mongod
实例上运行,sh.startBalancer()
会出错。
Starting in MongoDB 3.4, the 从MongoDB 3.4开始,mongo
shell method sh.startBalancer()
is a wrapper around the balancerStart
command. mongo
shell方法sh.startBalancer()
是balancerStart
命令的包装器。As such, the method does not wait for balancing to start.因此,该方法不会等待平衡开始。
In earlier versions, the method waited for the balancing to start.在早期版本中,该方法等待平衡开始。