When I want to completely shut down a replica_set

87 views
Skip to first unread message

Jim Knoll

unread,
Mar 2, 2017, 4:50:19 PM3/2/17
to mongodb-user

Why do that because I am implementing authentication which includes inter node encryption and setting auth = true   but I already have a replica set working.

I thought I should do the following

To shutdown:
- Run db.runCommand({ replSetFreeze: numOfSeconds }) on secondaries to prevent from promoting to primary
- Run rs.stepDown(seconds) on the primary; it will check to make sure at least one of the secondaries is sufficiently caught up to oplog before stepping down. Choose a reasonably long wait time.
- Once 
everything is a secondary, db.shutdownServer() on everything


but I find that when I try to stepDown or shutdownServer my Primary it complains that there are no Eligible members they can promote.   I know that and still want to shut down.

To this point, I have just done a stop on the service or a kill from the OS l but I want it to be more graceful, less chance of unflushed buffers...

Anyone know how to force the step down or the db.shutdownServer()


I have 2 servers + an arbiter    MongoDB version: 3.0.6  Ubuntu  

Jim Knoll

unread,
Mar 3, 2017, 2:52:42 PM3/3/17
to mongodb-user
Looks like I am ok as long as a shutdown my arbiter and SECONDARY befor I shutdown the PRIMARY   but the PRIMARY never becomes a secondary.   which was suspicious about the instruction that I had found anyway

Kevin Adistambha

unread,
Mar 8, 2017, 1:36:09 AM3/8/17
to mongodb-user

Hi Jim,

Why do that because I am implementing authentication which includes inter node encryption and setting auth = true but I already have a replica set working.

Glad to hear that you found a working solution. However I have a couple of pointers that may be helpful in the future:

You don’t need to shutdown the whole replica set to enable auth on an existing deployment. You can perform a rolling restart instead. The procedure of which is available in Enable Internal Authentication. Once you have created the necessary users, you can then Upgrade from Keyfile Authentication to x.509 Authentication.

Also, you can find out how up-to-date your secondaries are by using the db.printSlaveReplicationInfo() command in the mongo shell.

Please note that the latest in the 3.0 series is currently 3.0.14. You can also perform a rolling upgrade as described in the Upgrade a replica set section.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages