The default chunk size for a sharded cluster is 128 megabytes. 分片集群的默认区块大小为128 MB。This default chunk size works well for most deployments; however, if you notice that automatic migrations have more I/O than your hardware can handle, you may want to reduce the chunk size. 此默认块大小适用于大多数部署;但是,如果您注意到自动迁移的I/O超过了硬件的处理能力,那么您可能需要减小块大小。For automatic splits and migrations, a small chunk size leads to more rapid and frequent migrations. 对于自动拆分和迁移,较小的块大小会导致更快速、更频繁的迁移。The allowed range of the chunk size is between 1 and 1024 megabytes, inclusive.区块大小的允许范围为1到1024 MB(包括1和1024 MB)。
To modify the chunk size, use the following procedure:要修改区块大小,请使用以下步骤:
mongos
in the cluster using mongosh
.mongosh
连接到集群中的任何mongos
。Issue the following command to switch to the Config Database:发出以下命令以切换到配置数据库:
use config
Issue the following command to store the global chunk size configuration value:发出以下命令以存储全局块大小配置值:
db.settings.updateOne( { _id: "chunksize" }, { $set: { _id: "chunksize", value: <sizeInMB> } }, { upsert: true } )
Modifying the chunk size has several limitations:修改区块大小有几个限制: