mongodb reconfigure shard ports

sivann picture sivann · Oct 23, 2012 · Viewed 8.6k times · Source

I have restarted 2 shards on non standard ports, by chaning their .conf files. Now when I connect via mongo and issue a listshards I get:

mongos> db.runCommand( { listshards : 1 } );
Tue Oct 23 17:36:21 uncaught exception: error {
    "$err" : "error creating initial database config information :: caused by :: socket exception [CONNECT_ERROR] for vserver-dev-2:37017",
    "code" : 11002
}

(37017 is the old port). How can I update the shard ports on the router (mongos) ?

Answer

sivann picture sivann · Oct 23, 2012

Manual updating the ports on the mongo config server:

    mongo
    use config

    configsvr> db.shards.update({_id: "shard0000"} , {$set: {"host" : "vserver-dev-2:37018"}})
    configsvr> db.shards.find()
    { "_id" : "shard0000", "host" : "vserver-dev-2:37018" }