I have two machines (A and B, A is Master) running VRPP (from keepalived) for a Virtual IP.
How can I prevent A from becoming Master again if it has failed and come back up (for whatever reason)?
I'm doing this so that we have a single fail-over to the second box, and going back to normal would require manual intervention.
According to this relatively old thread on the keepalived developer list, it can be done. You set both servers to be equal priority (or none at all), and do not declare the state for either as MASTER or BACKUP, and instead set the state to EQUAL for both.
EDIT (07-Dec-2017):
It appears that EQUAL is not actually a valid state, despite it appearing to provide the desired effect at the time this answer was posted. Please note the comments below, in particular the link to the current issues list for keepalived provided by @cristi.
The way we solved this is by adding the
nopreempt
flag to our keepalived config file. Didn't have to change anything else (still left one asMASTER
and one asBACKUP
and so on). Basically this tells it to not switch masters just because a new server came online, only switch when the current master fails.As I understand it, when a new VRRP server comes up, it forces an election, and the current server doesn't get any benefit, so the old master will come up and win the election. I doubt there is much you could do to stop this, beyond the rather brutal Shoot The Other Node In The Head. Keepalive may have some configuration to control the election process. Sadly I don't have time to check now, but I'll try to look later.