Haproxy with keepalived - vip starts on both centos 7 servers

Hello,

I am trying to configure haproxy with keepalived.

I followed this guide https://www.certdepot.net/rhel7-configure-high-available-load-balancer/

I have haproxy running on both centos 7 vms.

The issue is that the vip ip address starts on both vms as soon as I start keepalived service.

My understanding is that when haproxy and keepalived is running on both vms, only the primary server should have the vip started. However, it starts on both as soon as I start keepalived.

below is the config

master:
cat keepalived.conf
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
}

vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 101
virtual_ipaddress {
10.143.19.249
}
track_script {
chk_haproxy
}
}

secondary:
cat keepalived.conf
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
}

vrrp_instance VI_1 {
interface eth0
state BACKUP
virtual_router_id 51
priority 100
virtual_ipaddress {
10.143.19.249
}
track_script {
chk_haproxy
}
}

I’m not sure what that means. Are you saying the VIP is active on both VMs? Then this is really not a haproxy issue and you should seek support/advice for keepalived.

If you mean haproxy is started in both VM’s, then yes, that is what is supposed to happen.

Hi.
At first you should check if keepalived service messages not blocked by firewall rules.

Best Regards.

Have you mentioned the network interface device name?
Please refer the extracts from my recent webinar presentation.

try to debug the VRRP adverts with

 tcpdump -n -nn -v -i ens192 proto 112

where ens192 is your physical interface, but definitely something to check with keepalived guys.

Clearly the OP has lost interest in fixing this problem, he didn’t respond once.