MongoDB Tag-aware sharding script
Commands : use dbversity sh.status() sh.enableSharding(“dbversity”) db.nosql.ensureIndex({“mongodb” : 1}) db.rdbms.ensureIndex({“oracle” : 1}) db.newsql.ensureIndex({“memsql” : 1}) show collections sh.status() sh.shardCollection(“dbversity.nosql”, {mongodb:1}); sh.shardCollection(“dbversity.rdbms”, {oracle:1}); sh.shardCollection(“dbversity.newsql”, {memsql:1}); sh.status() for (var i=0; i<100000; i++) { db[“nosql”].insert({mongodb: Math.random(), count: i, time: new Date()}); } for…
[MongoDB]: Tag aware sharding
MongoDB supports tagging a range of shard key values to associate that range with a shard or group of shards. Those shards receive all inserts within the tagged range. The balancer obeys tagged range associations, which enables the following deployment…