Home:ALL Converter>Stop Replica Set MongoDB

Stop Replica Set MongoDB

Ask Time:2013-05-29T04:01:52         Author:Josh Elias

Json Formatter

The command to start a Replica Set in the MongoDB Shell is rs.initiate().

What is the opposite of this command. How do I stop the replica set?

There are commands to reconfigure the set or remove members but no way that I know off to remove the last member and therefore destroy the Replica Set.

Author:Josh Elias,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/16800461/stop-replica-set-mongodb
Asya Kamsky :

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:\n\n\nRestart mongod process without --replSet argument.\nDrop the local database:\n\nuse local;\ndb.dropDatabase();\n\n",
2013-05-28T20:13:48
ABrowne :

I just have this issue in production. @maganap's (Mar 15) comment saved my bacon! \n\nUsing mongodb 3.2.10, no need to dump the oplog, just do this on the first member:\n\nuse local\ndb.system.replset.remove({}) \n\n\nThen restart the member. It'll now still have it's oplog, and it's data. Just run:\n\nrs.initiate()\nrs.reconfig(conf)\n\n\nWhere 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. ",
2016-11-01T15:02:31
yy