[SERVER-22380] 2-shard setup with tag ranges but mongo never writes to shard #2 Created: 30/Jan/16 Updated: 03/Feb/16 Resolved: 03/Feb/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | 2.6.11 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Minor - P4 |
| Reporter: | Hector Lai | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
I'm new to MongoDB, especially on the IT side. I'm trying to set up a Sharded Cluster with Replica Set on one single VM (virtual machine).
Each shard contains a replica set
Replica set rstest2sh1 has
Replica set rstest2sh2 has
Shard setting
Sharded Collection
In the end my collection of 300 docs shows up in shard #1 of rstest2sh1 at vmmongo2, ports 30001,30002,30003. However, it is a sad story for shard #2 of rstest2sh2: I'm guessing all data are written to shard #1 first (why not shard #2? what decides this?) Then, every now and then, when the balancer runs, it moves all my 3000 docs (they all have LocalSite set to 'ASIA') to shard #2 replica set rstest2sh2 since that is how I set up the shard tag range. Any comments are greatly appreciated on why no data are being written to shard #2 at all. Thanks. ==========
|
| Comments |
| Comment by Kelsey Schubert [ 03/Feb/16 ] |
|
Hi hectorl, This is expected behavior. As you have noted, new insertions are not necessarily routed to the shard within the tag range. Documents are inserted into the correct chunk according to the chunk range. Tag aware sharding relies on the balancer to appropriately redistribute chunks according to the tag ranges specified. Once the chunks have been properly distributed, future insertions should be routed according to the shard tag range. To avoid waiting for the balancer, you may want to consider presplitting chunks and ensuring that they are appropriately distributed before inserting data. For additional information, please consider reviewing our documentation on tag aware sharding. Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-users group or Stack Overflow with the mongodb tag. Kind regards, |