Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to start over the configurations of replica, is it possible? How to reset it?

In group people saying to remove the database content, but are there any work around?

share|improve this question
up vote 4 down vote accepted

If you want to keep the data, but start outside a replica set, just restart the mongod process without the --replSet and on a different port. That will give you a standalone mongod.

To be completely sure that the replica set configuration is gone from the instance, make sure that the local.system.replset collection is empty.

Once that is done, and you are happy with your standalone instance, you can then restart with a different --replSet argument and go through the replica set configuration process again:

http://www.mongodb.org/display/DOCS/Replica+Set+Configuration

The other option, as you mention, is to remove all the data files and start completely from scratch.

share|improve this answer
    
//start server on different port than assigned but with same Db folder . connect via mongoi client to new port : use local db.system.replset.remove({"_id":"replset"}) //change replset in quotes to your name? db.system.replset.find() db.adminCommand({shutdown : 1}) //then restart on other port – tgkprog Apr 25 at 7:52
  1. Go to mongo shell on Secondary servers

  2. Stop the secondary servers by using below command :

    use admin
    db.shutdownServer()
    
  3. go to primary mongo shell and type the below commands :

    rs.remove()
    

    to check the status, use rs.status()

For more information, Please check the below link : http://www.learnit.net.in/2016/03/stopping-and-starting-mongodb.html

share|improve this answer

You do not need to remove any database files in order to reset the configuration of your replica set.

To reset the configuration, make sure every node in your replica set is stopped. Then delete the "local" database for every node.

Once you are confident all nodes are not running and the "local" database are gone, start the mongod process again (of course using the --replSet flag). Then run rs.initiate().

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.