Change the host name of a shard

528 views
Skip to first unread message

Richard Mannion

unread,
Feb 14, 2012, 8:13:51 AM2/14/12
to mongodb-user
I have this set up:

> db.runCommand({listshards:1})
{
"shards" : [
{
"_id" : "shard0000",
"host" : "192.168.0.223"
}
],
"ok" : 1
}

We are having to change the IP addresses of all our servers. I have
figured out how to change the IPs of the config servers and
replication sets, but I need to change this host entry to point to a
new IP address. How do I do that?

Richard

Nat

unread,
Feb 14, 2012, 8:22:16 AM2/14/12
to mongod...@googlegroups.com
If you have only one shard, just set up a new config server from scratch and then add that data server to the shard. Note that you should probably use hostname instead of ip in case you want to change it again later.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Richard Mannion

unread,
Feb 14, 2012, 8:27:53 AM2/14/12
to mongodb-user
would it be possible to change the IP of the database servers, then
remove the shard since it will not be connecting to anything and then
add a new shard connecting to the new IPs? would I lose any data that
way?

Nat

unread,
Feb 14, 2012, 8:31:18 AM2/14/12
to mongod...@googlegroups.com
Yes, it's fairly easy on single instance. Simply shut it down, change ip address, restart mongod, start up new config server, addshard with new ip/hostname of mongod.
Reply all
Reply to author
Forward
0 new messages