Downgrade MongoDB replica set to a standalone node

Now you have a MongoDB replica set and decide to downgrade it to a standalone node.

If you don’t have a replica set yet, please refer to my previous post Create a MongoDB replica set to create one to go through this article.

Remove secondary member nodes

Firstable, Shut down the mongod instance for the member you wish to remove.

Then connect to the replica set’s current primary instance.

Use rs.remove() to remove the secondary member :

Check replica set status to ensure now only Primary member is left alone.

Remove replication setting

Delete or comment replication setting in mongod.cfg file

On Windows, a default <install directory>/bin/mongod.cfg configuration file is included during the installation.

Shut down the Primary mongod instance.

Restart MongoDB service if you have installed it as a service.

Restart mongod instance as a single node:

To be completely sure that the replica set configuration is removed from the instance, connect to this instance and empty local.system.replset collection :

Also drop other replica set related collections :

Now welcome back to our standalone instance ! 😃

You can then restart with a different replSet argument and create a new replica set again.