Docs HomeMongoDB Manual

sh.enableBalancing()

On this page本页内容

Description描述

sh.enableBalancing(namespace)

Enables the balancer for the specified namespace of the sharded collection.为分片集合的指定命名空间启用平衡器。

Important

You can only run sh.enableBalancing() on a mongos instance. 您只能在mongos实例上运行sh.enableBalancing()sh.enableBalancing() errors if run on mongod instance.如果在mongod实例上运行,sh.enableBalancing()将出错。

The sh.enableBalancing() method has the following parameter:sh.enableBalancing()方法具有以下参数:

Parameter参数Type类型Description描述
namespacestringThe namespace of the collection.集合的命名空间
Important

sh.enableBalancing() does not start balancing. 不会开始平衡。Rather, it allows balancing of this collection the next time the balancer runs.相反,它允许在下次平衡器运行时对该集合进行平衡。

For more information on the balancing process, see Manage Sharded Cluster Balancer and Sharded Cluster Balancer.有关平衡过程的更多信息,请参阅管理分片群集平衡器分片群集平衡器