I have an application that requires 2 servers to coordinate their service using keepalived running VRRP on a particular network where each has an interface. I want the VRRP traffic to be unicast and where each server uses (and expects the other to use) the respective IP address.
I sometimes see a problem when, on bootup, one server starts the keepalived service before the relevant interface has acquired its address. In this case sometimes keepalived starts sending VRRP advertisements using an IP address of another interface. The peer server rejects these as it does not recognize the source IP from where these advertisements are sent. Both servers continue thinking they are the Master.
I would like the keepalived service to wait until the interface acquires its IP - which always happens eventually and the acquired IP is always predictably the same (and used in the config file below).
I have the relevant interface and IP addresses included in the .conf file. I also added 'dynamic_interfaces' as recommended by some users elsewhere. Neither works reliably.
The keepalived.conf file looks like this: (using keepalived version 2.0.10)
global_defs
{
enable_script_security
script_user root
disable_local_igmp
dynamic_interfaces
notify_fifo /etc/keepalived/keepalived_fifo
notify_fifo_script /tmp/.keepalived/keepalived-notify.sh
}
vrrp_instance HA_Primary {
state MASTER
interface eth0
virtual_router_id 55
priority 100
garp_master_delay 5
advert_int 1.0
preempt_delay 0
track_interface {
eth1
}
unicast_src_ip 25.0.0.1
unicast_peer {
25.0.0.2
}
}