Stop Replica Set MongoDB

I just have this issue in production. @maganap's (Mar 15) comment saved my bacon!

Using mongodb 3.2.10, no need to dump the oplog, just do this on the first member:

use local
db.system.replset.remove({}) 

Then restart the member. It'll now still have it's oplog, and it's data. Just run:

rs.initiate()
rs.reconfig(conf)

Where conf is the new conf. Then on each of the other members, just run the trashing of the replset data above and restart them. When they start they'll join the set.


It all depends on what your goal is. If you want to reuse the existing mongod as a standalone server rather than a replica set member then the steps to do that would be:

  1. Restart mongod process without --replSet argument.
  2. Drop the local database:

    use local;
    db.dropDatabase();
    

Tags:

Linux

Mongodb