Closing question in mongo db
2 answers
It looks like you might not be related to the mongos instance.
Make sure you are connected to mongo (router). Here is some sample code that I am using to implement sharding with reference to addShard. I've included the rest of the code for clarity.
//this adds members of a replica set as a shard
sh.addShard("rs0/serverShd4:27017,serverShd4b:27017,serverShd4c:27017")
//indexes
use mydb
db.mycoll.ensureIndex({s:"hashed"})
//The db name is "mydb"
sh.enableSharding("mydb")
//This is the shard key strategy deemed necessary by OI to date
sh.shardCollection( "mydb.mycoll", { s: "hashed" } )
+1
source to share
switched to db admin
db.runCommand ({addshard: "localhost: 10000"})
{"shardadded": "shard0000", "ok": 1}
db.runCommand ({addshard: "localhost: 10001"})
{"shardadded": "shard0001", "ok": 1}
must work. http://comments.gmane.org/gmane.comp.db.mongodb.user/77102
0
source to share