![]() ![]() Stay tuned for more awesome content from this site. ![]() I hope that my post have helped you with mongo sharding. On GitHub at updated in queries directory, there is script init.js to automatically configure this for you. We can also check data on rs1 at mongo-1-1:27017 and rs2 at mongo-2-1:27017 to confirm, that at the end they landed on the right places. db.createCollection("sample") ĭb.sample.createIndex( Now let's switch to database test and create a collection called sample with index on location and factoryId props. Mapped 1:1 to an existing replica-set - rs1 and rs2. One for US location and one for EU location. In our example, we will have simple location-based chunks. I highly recommend to read more about data partitioning before you start to configure it.įirst thing that we need to create is Shard Tag, which is basically a name used internally to differentiate between chunks - parts of data moved between clusters by balancer. Last time we finished at Shard Status info done with this command at router - mongos. In this case we will simplify this example to only 2 shards each. Our goal is two locations (EU and US) with multiple shards, that as a sum will hold all the data. This will give us some insight into how sharding can be configured. The idea is to split data by one of the properties. In this post we use our previously created shard and start to segment our data by location. ![]()
0 Comments
Leave a Reply. |