Change replica set name

2,900 views
Skip to first unread message

Skipy

unread,
Jul 26, 2011, 5:03:25 AM7/26/11
to mongodb-user
How can you change the name given to a replica set? We accidentally
ended up with a few replica sets with the same name.

And what issues will occur when using multiple replica sets (in a
sharded environment) with the same name?

Kristina Chodorow

unread,
Jul 26, 2011, 11:14:46 AM7/26/11
to mongodb-user
I'd suggest giving your shards different names if you've named your
replica sets the same thing. E.g., you can say:

> db.adminCommand({addShard : "rsName/host1,host2", name : "someOtherName"})

The rs will still use "rsName" as its name, but the mongos processes
will refer to it as someOtherName.

Changing your replica set name is more difficult, you'd have to have
some downtime and change the rs configs manually.

Adam Monsen

unread,
Jun 29, 2012, 1:31:37 PM6/29/12
to mongod...@googlegroups.com
On Tuesday, July 26, 2011 8:14:46 AM UTC-7, Kristina Chodorow wrote:
Changing your replica set name is more difficult, you'd have to have some downtime and change the rs configs manually.

 How is this done?

I have a three-node set running locally with --replSet foo, and I tried just stopping the whole thing and starting each node with --replSet bar, but they can't find each other.

Is the replica set name stored in the dbpath somewhere? I tried strings dbpath/* | grep foo but got nothing.

Here's how I start each node in my set:

mongod --rest --replSet foo --quiet --port 27018 --dbpath `pwd`/r0
mongod --rest --replSet foo --quiet --port 27019 --dbpath `pwd`/r1
mongod --rest --replSet foo --quiet --port 27020 --dbpath `pwd`/r2

See also: http://stackoverflow.com/questions/11265997/can-i-change-the-name-of-my-replica-set-while-mongod-processes-are-running (ignore "while mongod processing are running", since I found this thread I understand that is not possible)

Kristina Chodorow

unread,
Jun 29, 2012, 1:44:54 PM6/29/12
to mongod...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages