I am trying to shard a existing collection. Collection is pretty big (about 100gb). Sharding should be done by 2 fields. First one is zone ['Europe', 'America'] and second one is _id.
So my sharding index looks like this {"zone": 1, "_id": "hashed"}.
I have followed these steps https://docs.mongodb.com/manual/reference/method/sh.updateZoneKeyRange/#compound-hashed-shard-key-with-non-prefix-hashed-field. This works only on empty or non existing collection. My question is is this type of sharding possible on collection that is not empty.
I am using mongo version 4.4
Best Answer
For me it is working. You only need to create the index
{ "region": 1, "_id": "hashed" }
manually.Extract from
sh.status()
:Please be aware of Balancing failed when moving big collection, my collection is also around 100GB, so you may face the same issue.