We are reviewing options for having documents written to specific geographic areas.
The user can choose one of a few high level storage zones. In our case the values
are either ‘NA’ (North America), ‘EU’ (Europe) or null for any.
The tutorial at
provides steps to manually create
- a mongos
- a config server replica set (3 mongod members)
1…n data replica sets with (3 mongod members). This is done once per storage zone
With commands like
sh.addShard(“myShardedDataNa/mybox.ddns.net:57001,mybox.ddns.net:57002”)
sh.addShardTag(“myShardedData”, “NA”)
sh.addTagRange(“q_catalog.test”,
{ “zone” : “NA”, “name” : MinKey },
{ “zone” : “NA”, “name” : MaxKey }, “NA”)
It uses sh.shardCollection(), sh.addShard(), sh.addShardTag(), and sh.addTagRange().
to route documents to a specific cluster based on any field value. There are many
steps involved. Our 2 storage zone example has 1 mongos and (3 + 3 + 3) mongod instances.
If another collection to be geo sharded is created many steps need to be done for the
new collection. This also adds 3 mongod members somewhere in the world.
As an alternative seems to be Atlas global clusters which requires all
documents to have a location field. However that uses an ISO country value.
In contrast we only want to present the higher level NA, EU, and ‘any’ options.
Is there a way to get the 2 zone storage approach easily using Atlas?