How to know existing shard tags and their ranges ?!

mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“minCompatibleVersion” : 5,
“currentVersion” : 6,
“clusterId” : ObjectId(“568bbc90f165cf6ce558ef40”)
}
shards:
{ “_id” : “rs1”, “host” : “rs1/srinivas-HP-G62-Notebook-PC:27010,srinivas-HP-G62-Notebook-PC:27011”, “tags” : [ ] }
{ “_id” : “rs2”, “host” : “rs2/srinivas-HP-G62-Notebook-PC:27020,srinivas-HP-G62-Notebook-PC:27021”, “tags” : [ ] }
{ “_id” : “rs3”, “host” : “rs3/srinivas-HP-G62-Notebook-PC:27030,srinivas-HP-G62-Notebook-PC:27031”, “tags” : [ ] }
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:
4 : Success
databases:
{ “_id” : “dbversity”, “primary” : “rs1”, “partitioned” : true }
dbversity.dbfry
shard key: { “id” : 1 }
unique: false
balancing: true
chunks:
rs1 1
rs2 1
rs3 2
{ “id” : { “$minKey” : 1 } } –>> { “id” : 1 } on : rs3 Timestamp(3, 0)
{ “id” : 1 } –>> { “id” : 101 } on : rs3 Timestamp(4, 0)
{ “id” : 101 } –>> { “id” : 150 } on : rs1 Timestamp(5, 0)
{ “id” : 150 } –>> { “id” : { “$maxKey” : 1 } } on : rs2 Timestamp(5, 1)
tag: DBFRY { “id” : 1 } –>> { “id” : 150 }
tag: DBFRY { “id” : 150 } –>> { “id” : 200 }

mongos>
mongos>
mongos>
mongos> sh.addShardTag(“rs1”, “DBVERSITY”)
mongos> sh.addShardTag(“rs2”, “DBFRY”)
mongos> sh.addShardTag(“rs3”, “DBFRY”)
mongos>
mongos> sh.status()
— Sharding Status —
sharding version: {
“_id” : 1,
“minCompatibleVersion” : 5,
“currentVersion” : 6,
“clusterId” : ObjectId(“568bbc90f165cf6ce558ef40”)
}
shards:
{ “_id” : “rs1”, “host” : “rs1/srinivas-HP-G62-Notebook-PC:27010,srinivas-HP-G62-Notebook-PC:27011”, “tags” : [ “DBVERSITY” ] }
{ “_id” : “rs2”, “host” : “rs2/srinivas-HP-G62-Notebook-PC:27020,srinivas-HP-G62-Notebook-PC:27021”, “tags” : [ “DBFRY” ] }
{ “_id” : “rs3”, “host” : “rs3/srinivas-HP-G62-Notebook-PC:27030,srinivas-HP-G62-Notebook-PC:27031”, “tags” : [ “DBFRY” ] }
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:
4 : Success
databases:
{ “_id” : “dbversity”, “primary” : “rs1”, “partitioned” : true }
dbversity.dbfry
shard key: { “id” : 1 }
unique: false
balancing: true
chunks:
rs1 1
rs2 1
rs3 2
{ “id” : { “$minKey” : 1 } } –>> { “id” : 1 } on : rs3 Timestamp(3, 0)
{ “id” : 1 } –>> { “id” : 101 } on : rs3 Timestamp(4, 0)
{ “id” : 101 } –>> { “id” : 150 } on : rs1 Timestamp(5, 0)
{ “id” : 150 } –>> { “id” : { “$maxKey” : 1 } } on : rs2 Timestamp(5, 1)
tag: DBFRY { “id” : 1 } –>> { “id” : 150 }
tag: DBFRY { “id” : 150 } –>> { “id” : 200 }

mongos>
mongos>
mongos> db
config
mongos>
mongos> db.shards.find()
{ “_id” : “rs1”, “host” : “rs1/srinivas-HP-G62-Notebook-PC:27010,srinivas-HP-G62-Notebook-PC:27011”, “tags” : [ “DBVERSITY” ] }
{ “_id” : “rs2”, “host” : “rs2/srinivas-HP-G62-Notebook-PC:27020,srinivas-HP-G62-Notebook-PC:27021”, “tags” : [ “DBFRY” ] }
{ “_id” : “rs3”, “host” : “rs3/srinivas-HP-G62-Notebook-PC:27030,srinivas-HP-G62-Notebook-PC:27031”, “tags” : [ “DBFRY” ] }
mongos>
mongos> db.tags.find()
{ “_id” : { “ns” : “dbversity.dbfry”, “min” : { “id” : 1 } }, “ns” : “dbversity.dbfry”, “min” : { “id” : 1 }, “max” : { “id” : 150 }, “tag” : “DBFRY” }
{ “_id” : { “ns” : “dbversity.dbfry”, “min” : { “id” : 150 } }, “ns” : “dbversity.dbfry”, “min” : { “id” : 150 }, “max” : { “id” : 200 }, “tag” : “DBFRY” }
mongos>
mongos>
mongos>

  • Ask Question