Docs HomeMongoDB Manual

sh.enableAutoSplit

On this page本页内容

Note

Starting in MongoDB 6.1, automatic chunk splitting is not performed. 从MongoDB 6.1开始,不执行自动区块分割。This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. 这是因为平衡政策的改进。自动拆分命令仍然存在,但不执行操作。For details, see Balancing Policy Changes.有关详细信息,请参阅平衡策略更改

Description描述

sh.enableAutoSplit()

Enables the autosplit flag in the config.settings collection. 启用config.settings集合中的自动拆分标志。When auto-splitting is enabled for a sharded cluster, MongoDB automatically splits chunks based on the shard key values the chunk represents to keep the chunks from growing too large.当为分片集群启用自动分割时,MongoDB会根据区块所代表的分片键值自动分割区块,以防止区块过大。

You can only run sh.enableAutoSplit() from a mongosh session that is connected to a mongos instance. 只能从连接到mongos实例的mongosh会话中运行sh.enableAutoSplit()sh.enableAutoSplit() errors if run on a mongod instance.如果在mongod实例上运行,则会出现sh.enableAutoSplit()错误。

Note

Starting in MongoDB 6.1, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation. 从MongoDB 6.1开始,不执行自动区块分割。这是因为平衡政策的改进。自动拆分命令仍然存在,但不执行操作。For details, see Balancing Policy Changes.有关详细信息,请参阅平衡策略更改

In MongoDB versions earlier than 6.1, sh.startBalancer() also enables auto-splitting for the sharded cluster.在6.1之前的MongoDB版本中,sh.startBalancer()还支持对分片集群进行自动拆分。