Mongodb replicaset config - erase all config and begin from scratch

11,342 views
Skip to first unread message

iryndin

unread,
Sep 1, 2011, 3:13:30 AM9/1/11
to mongodb-user
Hi all,

I was playing with Mongodb Replica Sets (3-node replica set - all
nodes are full-servers) and found myself stuck into config issues and
all that stuff.

Is there a way to clear all the configs related to replica set and
begin playing from scratch with this?

Smth like (my fantasy) rs.eraseAllConfigs()

=)))

Regards,
Ivan

Kristina Chodorow

unread,
Sep 1, 2011, 10:50:01 AM9/1/11
to mongodb-user
All of the replication information is kept in the local database.
Thus, the easiest way is to shut all of the members down, delete the
local.* files from the primary, delete all of the data files from the
other members, and start everyone back up again.

Tim

unread,
Nov 1, 2012, 12:48:28 PM11/1/12
to mongod...@googlegroups.com
hi,

would that work with

mongo DB_NAME --eval 'db.dropDatabase();
for every DB, or do I have to delete these files manually?

best regards

Kristina Chodorow

unread,
Nov 1, 2012, 2:00:04 PM11/1/12
to mongod...@googlegroups.com
Do not try to drop the local DB that way.  1) It won't work on the secondaries and 2) As soon the primary dropped it, the secondaries would be unable to replicate from the primary, since local is what's used for replication.

Shut down the servers and delete the files manually.

Tilo

unread,
Nov 29, 2012, 5:03:47 PM11/29/12
to mongod...@googlegroups.com
you will also need to edit the /etc/mongod.conf file to uncomment the `replSet` 
Message has been deleted

Marco Berri

unread,
Feb 2, 2016, 6:16:47 AM2/2/16
to mongodb-user
Reply all
Reply to author
Forward
0 new messages