[MongoDB] Starting Member in standalone mode
Starting member in standalone mode
- Ubuntu 16.02 LTS
- MongoDB 4.2
It can happen that for business reasons a maintenance task has to be performed on a Mongo DB server but the activity can’t be done when the member is a secondary member of a replica set and shouldn’t be done even if it is primary because of the impact this could have on application performance. So, I’m going to show you how to start up a server in standalone mode. This means restarting the member as a standalone server and not a member of the replica set and later sycing it back.
First, look at the command line option used to start it:
To perform maintenance on this server we can restart it outside the replica set. Shutdown the server from the mongo shell:
And then restart mongod on another port:
$ mongod --port 30000 -dbpath /path/to/your/db
When finished performing maintenance on the server, shut it down and restart it with the original options, it will automatically sync-up with the replica set.