To add a new shard to a sharded cluster and distribute data without manually moving chunks from existing shard collections

I have existing shard cluster with 3 shard node there are

I add shard 4 , in new Empty collection data automatic distribute to shard 4 but
in the collection shard data not distribute to shard 4 I need to manual move chunk right ? can I automatic process Thank you

Hi @phongsakorn552 and welcome to MongoDB community forums!!

When you add a shard to a sharding configurations, its the Sharded cluster balancer’s duty to balance the data between all the shards.
Starting in MongoDB version 6.1, the balancer will not automatically start balancing the chunks as the balancing is depends on the data size rather than the chunk size. This is due to the balancing policy changes.

You can refer to the documentation on Balancing Window operations for further understanding.

Also, looking at the screenshot shared, it seems that you have single node shards in the deployment which is only recommended for testing purpose. There fore, the recommendation would be to use the Sharded Cluster Production Configuration to work in the production environment.


Thank you for your kindness. Now I can solve this issue .as you say it depend on data size in my version this mean if my document have size more than 1024 Mib it will migrate right ? and shard key is only used to distribute data to shard node .

Starting in 6.0, the minimum range size is 128MB. Since we balance by data size, the migration threshold is now 384MB. This means that there must be a minimum size difference of 384MB between two shards before the balancer will migrate a 128MB chunk/range.

So yes, if you had more than 1024MiB of data in your cluster, the balancer would migrate 128MB chunks/ranges to the other shards.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.