Keepalived config attention
The default keepalived config when you setup it on 3 nodes that run HAProxy is flawed.
Node1
#haproxy - You can add more types manually after this.
vrrp_script chk_haproxy {
script "killall -0 haproxy" # verify the pid existance
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_HAPROXY {
interface enp0s8 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 102
unicast_src_ip 10.1.0.10
unicast_peer {
10.1.0.20
10.1.0.30
}
virtual_ipaddress {
10.1.0.100 # the virtual IP
}
track_script {
chk_haproxy
}
# notify /usr/local/bin/notify_keepalived.sh
}
# DO NOT REMOVE THE NEXT LINE
#@S9S_NEXT_SECTION@
Node2
#haproxy - You can add more types manually after this.
vrrp_script chk_haproxy {
script "killall -0 haproxy" # verify the pid existance
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_HAPROXY {
interface enp0s8 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 101
unicast_src_ip 10.1.0.20
unicast_peer {
10.1.0.10
10.1.0.30
}
virtual_ipaddress {
10.1.0.100 # the virtual IP
}
track_script {
chk_haproxy
}
# notify /usr/local/bin/notify_keepalived.sh
}
# DO NOT REMOVE THE NEXT LINE
#@S9S_NEXT_SECTION@
Node3
#haproxy - You can add more types manually after this.
vrrp_script chk_haproxy {
script "killall -0 haproxy" # verify the pid existance
interval 2 # check every 2 seconds
weight 2 # add 2 points of prio if OK
}
vrrp_instance VI_HAPROXY {
interface enp0s8 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 100
unicast_src_ip 10.1.0.30
unicast_peer {
10.1.0.10
10.1.0.20
}
virtual_ipaddress {
10.1.0.100 # the virtual IP
}
track_script {
chk_haproxy
}
# notify /usr/local/bin/notify_keepalived.sh
}
# DO NOT REMOVE THE NEXT LINE
#@S9S_NEXT_SECTION@
The VIP address 10.1.0.100 will failover from Node1 to Node2 to Node3 IF haproxy service will stop working from the Node1 to other nodes sequentially.
For example:
Node1 Haproxy stops -> VIP will go to Node2
Node2 Haproxy stops -> VIP will go to Node3
BUT
If Node1 has the VIP and Node2 Haproxy is stoped then if Node1 Haproxy stops then the VIP will not go to Node3 because they will have the same weight as Node1.
So to summarize, the VIP will move to the next server in case of fail of the Haproxy service on Node1 IF only all other Nodes have the Haproxy service running.
-
Official comment
Hi Theoklimenos
Thanks for bringing this one. Did you tried and tested this with the most recent version of ClusterControl? Also, it would be great if you can raise the ticket so we have your records as well for this concern.
I will test this on my end as well and we'll raise this concern internally to fix this issue, if reproduced and found.
Thank you.
Comment actions -
Paul Namuag Yes latest ClusterControl. Also i copied the keepalived config and test it on other clean VMs that have only Keepalived and Haproxy service installed outside ClusterControl. Same thing happens.
If by any chance Node2 Haproxy service is stopped and the Node1 has the VIP, if also Node1 Haproxy service stops then the VIP will not go to Node3 because of the same weight.
Please sign in to leave a comment.
Comments
4 comments