I have a simple setup with keepalived configured on 2 Ubuntu 16.04 servers (VMWare VM's)
I have a VIP shared between the hosts and everything is working fine. When I stop or restart one server the other takes over as MASTER and the VIP is transferred OK.
The issue I have is how long this takes. I have a continuous ping running against eh VIP and I can see that it appears to take around 3-4 seconds before the ping responds again. I would expect/hope this would be almost instantaneous but this is not the case.
The keepalived version is 1.2.19 and my configuration is pasted below. I have tried to reduce the advert_int to less than 1 but I get an error message when I do this - "VRRP_Instance(TEST_LOADBALANCER): sub-second advertisement interval not supported in version 2!" As you can see from my config I have tried to force the use of VRRP version 3 but this does not seem to take affect.
Server1 - /etc/keepalived/keepalived.conf
global_defs {
notification_email {
email@email.com
}
notification_email_from noreply@email.com
smtp_server emailserver.email.com
vrrp_version 3
smtp_connect_timeout 30
garp_master_delay 0
}
vrrp_instance TEST_LOADBALANCER {
state MASTER
smtp_alert
notify /usr/local/sbin/notify-keepalived.sh
# Specify the network interface to which the virtual address is assigned
interface ens160
# The virtual router ID must be unique to each VRRP instance that you define
virtual_router_id 61
# Set the value of priority higher on the master server than on a backup server
priority 254
# advert_int 1
virtual_ipaddress {
192.168.20.20
}
}
Server2 - /etc/keepalived/keepalived.conf
global_defs {
notification_email {
email@email.com
}
notification_email_from noreply@email.com
smtp_server emailserver.email.com
vrrp_version 3
smtp_connect_timeout 30
garp_master_delay 0
}
vrrp_instance TEST_LOADBALANCER {
state BACKUP
smtp_alert
notify /usr/local/sbin/notify-keepalived.sh
# Specify the network interface to which the virtual address is assigned
interface ens160
# The virtual router ID must be unique to each VRRP instance that you define
virtual_router_id 61
# Set the value of priority higher on the master server than on a backup server
priority 250
# advert_int 1
virtual_ipaddress {
192.168.20.20
}
}
The notify-keepalived.sh script simply stops and starts the HAProxy service that is using the VIP.
Is there a way to achieve a much quicker failover than we currently have? At the moment this is causing issues on our prod environment whenever OS updates or maintenance is performed on these servers.
Any help greatly appreciated!
Thanks, JP