Keepalived
Keepalived Config
! Configuration File for keepalived
vrrp_script chk_haproxy {
script "killall -0 haproxy" # check the haproxy process
interval 2 # every 2 seconds
weight 2 # add 2 points if OK
}
vrrp_instance VI_1 {
interface eth0 #通信网卡
state MASTER #MASTER on haproxy1,BACKUP on haproxy2
virtual_router_id 51
priority 101 #101 on haproxy1, 100 on haproxy2
authentication { #认证密码,两个节点相同
auth_type pass
auth_pass redhat
}
virtual_ipaddress {
172.26.1.60 #VIP,如238
}
track_script {
chk_haproxy
}
}