| Steps To Reproduce: |
Laptop:tmp user$ mongo
|
MongoDB shell version: 3.2.0
|
connecting to: test
|
mongos> use test
|
switched to db test
|
mongos> db.mycol.ensureIndex( { id : 1 }, { unique : true })
|
{
|
"raw" : {
|
"shard01/Laptop.local:27018,Laptop.local:27019,Laptop.local:27020" : {
|
"createdCollectionAutomatically" : true,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1,
|
"$gleStats" : {
|
"lastOpTime" : Timestamp(1452269862, 2),
|
"electionId" : ObjectId("568fe0d80000000000000001")
|
}
|
}
|
},
|
"ok" : 1
|
}
|
mongos> sh.enableSharding('test');
|
{ "ok" : 1 }
|
mongos> sh.shardCollection('test.mycol', {id: 1});
|
{ "collectionsharded" : "test.mycol", "ok" : 1 }
|
mongos> sh.startBalancer()
|
mongos>
|
mongos> sh.getBalancerState()
|
true
|
mongos>
|
mongos> sh.isBalancerRunning()
|
false
|
mongos>
|
mongos> sh.status()
|
--- Sharding Status ---
|
sharding version: {
|
"_id" : 1,
|
"minCompatibleVersion" : 5,
|
"currentVersion" : 6,
|
"clusterId" : ObjectId("568fe0cf098724379302dda5")
|
}
|
shards:
|
{ "_id" : "shard01", "host" : "shard01/Laptop.local:27018,Laptop.local:27019,Laptop.local:27020" }
|
{ "_id" : "shard02", "host" : "shard02/Laptop.local:27021,Laptop.local:27022,Laptop.local:27023" }
|
{ "_id" : "shard03", "host" : "shard03/Laptop.local:27024,Laptop.local:27025,Laptop.local:27026" }
|
active mongoses:
|
"3.2.0" : 1
|
balancer:
|
Currently enabled: yes
|
Currently running: no
|
Failed balancer rounds in last 5 attempts: 0
|
Migration Results for the last 24 hours:
|
No recent migrations
|
databases:
|
{ "_id" : "test", "primary" : "shard01", "partitioned" : true }
|
test.mycol
|
shard key: { "id" : 1 }
|
unique: false
|
balancing: true
|
chunks:
|
shard01 1
|
{ "id" : { "$minKey" : 1 } } -->> { "id" : { "$maxKey" : 1 } } on : shard01 Timestamp(1, 0)
|
|
mongos> sh.addShardTag('shard01', 'TAG1');
|
mongos> sh.addShardTag('shard02', 'TAG2');
|
mongos> sh.addShardTag('shard03', 'TAG2');
|
mongos>
|
mongos> sh.addTagRange('shard01', {id: 1}, {id: 200}, 'TAG1');
|
mongos> sh.addTagRange('shard01', {id: 100}, {id: 150}, 'TAG2');
|
mongos> sh.addTagRange('shard01', {id: 0}, {id: 300}, 'TAG2');
|
mongos>
|
mongos> use config
|
switched to db config
|
mongos> db.tags.find()
|
{ "_id" : { "ns" : "shard01", "min" : { "id" : 1 } }, "ns" : "shard01", "min" : { "id" : 1 }, "max" : { "id" : 200 }, "tag" : "TAG1" }
|
{ "_id" : { "ns" : "shard01", "min" : { "id" : 100 } }, "ns" : "shard01", "min" : { "id" : 100 }, "max" : { "id" : 150 }, "tag" : "TAG2" }
|
{ "_id" : { "ns" : "shard01", "min" : { "id" : 0 } }, "ns" : "shard01", "min" : { "id" : 0 }, "max" : { "id" : 300 }, "tag" : "TAG2" }
|
mongos>
|
We now have three overlapping ranges with two different TAGs.
No errors were raised. The intended location of a chunk with "id" values from 110 => 125 appears to be ambiguous, and the expected behaviour of the balancer undefined.
|