I have a mongodb replica set and want to move it to a single server setup

Is it just as simple as doing a rs.remove() to the other 2 nodes?

3 Answers 3


On the current primary node of the replica set, you may issue the rs.remove() for those nodes, and thereby stopping replication attempts to them.

You will probably have to shut down the server that you want to run in single mode, and start it up again without the --replSet <name> option (or whatever it might be set to in your config file), as this will start the server in single mode, and not try to replicate to any other nodes.


You can skip the remove altogether and in fact you should. To explain: if you rs.remove() one at a time, then after the first remove you will end up without enough votes to form a majority (impossible to have a majority with 2 nodes).

So, as Mike suggested, just restart the primary without --replSet (or the config file equivalent) and shut down the other nodes.

  • Is this actually the case? When I create a 3 member replicaset and remove one, they are perfectly happy to pick a primary and secondary. I think the majority concept only applies to partitions of the theoretical replicaset, not the actual replicaset Apr 3, 2019 at 17:32

In my experience to completely turn off failover (and remove the current primary from the pool) you need to do the following:

  • From the current primary, use rs.remove() to remove all secondary nodes from the group.
  • Stop mongod on the current primary.
  • Follow the instructions here - namely delete all local.* files on the primary instance and remove any replica set config from the primary's mongo config file.
  • Start mongod on the current primary.

This will result in your old primary being your new single server (all other servers can then be powered down/destroyed).

Whenever I've tried a plain restart without any replica set config / the --replSet flag it hasn't worked, presumably because the local database still has config for the replica set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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