Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 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?

share|improve this question

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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

Your Answer


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.