Currently when you try to add a shard with the same name as an existing shard you get a duplicate key error, and if you try to add a shard with the same host(s) as an existing shard you get a not master error
sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("55dcf519b004ad14bc014bef")
}
shards:
{ "_id" : "rs1", "host" : "rs1/ubuntu:20001,ubuntu:20002,ubuntu:20003" }
{ "_id" : "rs2", "host" : "rs2/ubuntu:30001,ubuntu:30002,ubuntu:30003", "draining" : true }
balancer:
Currently enabled: yes
Currently running: yes
Balancer lock taken at Thu Sep 03 2015 18:20:26 GMT-0400 (EDT) by ubuntu:27017:1441318568:1804289383:Balancer:846930886
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "temp", "primary" : "rs1", "partitioned" : false }
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
mongos> sh.addShard('rs1/ubuntu:20001')
{
"ok" : 0,
"errmsg" : "E11000 duplicate key error collection: config.shards index: _id_ dup key: { : \"rs1\" }",
"code" : 11000
}
mongos> sh.addShard('rs3/ubuntu:20001')
{ "ok" : 0, "errmsg" : "No master found for set rs3", "code" : 10107 }