Can't delete replication set & set up a new

1,461 views
Skip to first unread message

bui tam

unread,
Oct 7, 2011, 12:58:53 AM10/7/11
to mongodb-user
Hi,

It seems that I can't find this information anywhere, which is really
strange.. I have set up a replication set and named it let say 'abc'.
However, I wanted to use the data in this replication set and change
it to a new replication set, let's say 'bcd', but it seems that I
can't remove the old replication set setting.

using mongod --replSet bcd --rest --dbpath /home/db/data/ doesn't
help, coz it will say that it's not the replication set name "replSet
set names do not match, our cmdline: bcd".

So I tried to drop local.system.replset and oplog.rs, and delete
local.* in the dbpath, but then, now I'm stuck with an error, that
both my servers can't promote them to PRIMARY, and both stuck at
STARTUP2, asking to have a primary or secondary "replSet initial sync
need a member to be primary or secondary to do our initial sync"

Really hope that anyone could help me with this.

Thanks..

sridhar

unread,
Oct 7, 2011, 5:08:59 PM10/7/11
to mongodb-user
From your post it seems like you have a 2 node replica set. Is this
true? If so make sure add a 3rd node or at least an arbiter once you
have your RS back online. Did you delete the local.* from all nodes or
just 1 of them.

sridhar

unread,
Oct 7, 2011, 5:57:07 PM10/7/11
to mongodb-user
If you have a 2 node replica set (IP1 and IP2), here are the steps you
can do to rename once you have deleted your local.*.
Shutdown mongod on IP1 and IP2. Ensure local.* is not present.

If IP1 has the latest copy of your data, create a backup of all your
data files from IP1. Now delete only local.* from its data directory
(if still present).
Now start mongod on IP1 with the new replset name. Run rs.initiate
with just IP1 in its config.

On IP2, ensure that you remove all data files. Start mongod with the
new replset name. Connect to IP1 and do rs.add("host:port") to add IP2
to the replset. Let it resync from IP1.

Also make sure you either add a 3rd RS member or an arbiter.

tam bui

unread,
Oct 7, 2011, 11:18:12 PM10/7/11
to mongod...@googlegroups.com
Thanks for the help. Turn out I forgot to remove all the local.* in the arbiter. Totally forgot about it :(

Have a good day :) 
Reply all
Reply to author
Forward
0 new messages