MongoDB in PSA setup

Hi Team, currently I’m running PSA setup where primary is running in one machine and SA running in one more machine, where P is running at priority as 1 and for S set priority as 0.5.

Everything works fins, but as soon as SA machine dies for some reason, suddenly P in machine 1 becomes secondary how do I fix this? I get only 2 system for this feature?

This happens because you are losing a majority of nodes. Currently you have 3 voting members, when the server the the SA goes down you only have 1/3 voting members. In this case the primary becomes a secondary. To solve this you need to spread across 3 machines otherwise this issue will persist.

This doesn’t happen when the primary goes down because you have 2/3 so you have a majority of nodes so your replica set it up and running.

Hi @tapiocaPENGUIN, business constraint doesn’t allow having 3rd machine…

Is there any way we can fix this…?

Unfortunately no, you will always have a majority of nodes down when that server is down.

Hi @tapiocaPENGUIN can we force the system to make it primary when this happens? will that work?

also is it possible to remove the w=majority as well for election?

you have to remove the down nodes from that replica set. Otherwise the total num of nodes will not change when they are down, and mongodb will fail to elect a leader.