Reputation: 1009
I have a MongoDB database with 4 replica set members. I need to shutdown only one replica. If I execute this command:
db.shutdownServer()
when I'm connected with the replica member that I want to shutdown, can I be quiet that the other members continue to work?
Upvotes: 0
Views: 270
Reputation: 10737
If you have 4x voting members and If you shutdown member that is SECONDARY , your PRIMARY will continue to be PRIMARY after you execute on the targeted SECONDARY:
use admin
db.shutdownServer()
P.S. This is in case you shutdown the member for a short time just for maintenance, in general 4x voting members allow only 1x member to be down at same time , if something happen with one more member you will have only 2 active voting members from 4 ( 50% < majority ) and PRIMARY will switch to SECONDARY. For long term better follow the recommended steps in the comment by @Alex Blex and remove the member.
Total members Allowed to be down at once(default voting config -> 1x vote each member )
in replicaSet and still keeping PRIMARY online
1 0
2 0
3 1
4 1
5 2
6 2
7 3
Also it is best to reconfigure member in advance to HIDDEN state before shutting it down to hide the member from the application and reduce issues during start later. If you just want to stop it for short time it is not recommended to remove it since it will take some time to init sync it later if you add it again.
Upvotes: 2