Prevent VRRP Master from becoming Master once it has failed
Solution 1:
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.
Solution 2:
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 as MASTER
and one as BACKUP
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.