Sharding cluster error

Hi @jiang_xu1,

An ideal chunk size is smaller than 64 MB.

Looks like you have 129 * 2 = 258 chunks so the maximum data in this collection should be 258 * 64 MB = 16 512 MB. Usually chunks are actually way smaller than 64 MB as they are split into smaller chunks regularly. So I suspect that your shard key isn’t a good one & you have jumbo chunk issues: the balancer cannot split the chunks into smaller chunks anymore because you have too many documents with the same shard key and they are all in the same big chunk.

A sh.status(true) should confirm that you have jumbo chunks in your cluster.

2 ways to fix this:

An ideal shard key:

  • has a BIG (infinite is good!) cardinality
  • is evenly distributed
  • doesn’t grow monotonically
  • is used in most of your queries

See doc: Choose a shard key.

While I’m at it: this collection is relatively small and shouldn’t require to be sharded. Usually we recommend to shard when the cluster contains more than 2 TB of data and their is no need to shard all the collections on the cluster.
Small collections like this one can live on one of the shard (== collection Primary shard) and shouldn’t need the support of a sharded cluster.

Cheers,
Maxime.

1 Like