Limit number of chunks on a certain shard in MongoDB

Viewed 97

I am running a MongoDB with 5 shards. I have many collections in my database, and only a few of them are sharded, meaning the non sharded collections are on the primary.

Is there any way to let MongoDB know that is should distribute chunk of the sharded collections in such a way as to have less on the primary then the other shards. This would allow the primary to have more room to handle requests to the non sharded collections. Currently it is always a lot more busy (cpu, disk usgae) then the other shards

current situation:

Shard shard1 contains 19.98% data, 20.06% docs in cluster, avg obj size on shard : 123KiB
Shard shard2 contains 19.89% data, 19.91% docs in cluster, avg obj size on shard : 124KiB
Shard shard3 contains 20.00% data, 20.00% docs in cluster, avg obj size on shard : 124KiB
Shard shard4 contains 20.07% data, 19.95% docs in cluster, avg obj size on shard : 125KiB
Shard shard5 contains 20.04% data, 20.05% docs in cluster, avg obj size on shard : 124KiB

Target situation (shard 1 is primary):

Shard shard1 contains 4% data, 4% docs in cluster, avg obj size on shard : 123KiB
Shard shard2 contains 24% data, 24% docs in cluster, avg obj size on shard : 124KiB
Shard shard3 contains 24% data, 24% docs in cluster, avg obj size on shard : 124KiB
Shard shard4 contains 24% data, 24% docs in cluster, avg obj size on shard : 125KiB
Shard shard5 contains 24% data, 24% docs in cluster, avg obj size on shard : 124KiB

NOTE: I can't shard all my collections as there are queries run on them which would not work (https://docs.mongodb.com/manual/core/sharded-cluster-requirements/#sharding-operational-restrictions) and I don't have the ability to change these. (for reasons I won't go in to)

0 Answers
Related