Docs Menu

Docs HomeMongoDB Manual

Modify Range Size in a Sharded Cluster

The default range size for a sharded cluster is 128 megabytes. This default range size works well for most deployments; however, if you notice that automatic migrations use more I/O than your hardware can handle, you may want to reduce the range size. A small range size leads to more rapid and frequent migrations. The allowed size is between 1 and 1024 megabytes, inclusive.

To modify the range size, use the following procedure:

  1. Connect to any mongos in the cluster using mongosh.

  2. Issue the following command to switch to the Config Database:

    use config
  3. Issue the following command to store the global range size configuration value:

    { _id: "chunksize" },
    { $set: { _id: "chunksize", value: <sizeInMB> } },
    { upsert: true }

The allowed range size is between 1 and 1024 megabytes, inclusive.

To set the chunk size for a specific collection, see configureCollectionBalancing.

←  Merge Chunks in a Sharded ClusterSharded Cluster Balancer →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.