Hi all, I am new to MongoDB and I am trying to set up a Sharded MongoDB cluster. I Have configured the following clusters
Cluster 1 - 3 MongoDB Config Servers (1 Primary 2 replicas) ReplicaSets configured
Cluster 2 - 1 Mongos Node
Cluster 3 - 3 MongoDB servers (1 Primary 2 Replica) ReplicaSets Configured
Steps followed -
Creating a collection.
Insert 1 Million documents in the collections.
Adding a new Shard and configuring the same in Mongos.
Enable sharding on my database.
Shard my collection using a hash-based shard key.
The data is not getting distributed between the newly added shard.
I read somewhere that chunk distribution happens when the chunk limit is reached. So I set up my chunk size as 64MB.
I entered 1 Million more documents and still, the data remains the same.
You’ll have to add a few more documents, then you will see some movement to the other shard.
A collection is considered balanced if the difference in data between shards (for that collection) is less than three times the configured range size for the collection. For the default range size of 128MB, two shards must have a data size difference for a given collection of at least 384MB for a migration to occur.