共计 743 个字符,预计需要花费 2 分钟才能阅读完成。
yum install keepalived
vi /etc/keepalived/keepalived.conf
<code>
vrrp_script chk_haproxy {
script "pidof haproxy"
interval 2
}
vrrp_instance VI_1 {
debug 2
interface eth0 # interface to monitor
state MASTER
virtual_router_id 51 # Assign one ID for this route
priority 101 # 101 on master, 100 on backup
unicast_src_ip x.x.x.x # My IP
unicast_peer {x.x.x.x # Peer IP}
track_script {chk_haproxy}
virtual_ipaddress {x.x.x.x dev eth0}
}
</code>
Backup
vi /etc/keepalived/keepalived.conf
<code>
vrrp_script chk_haproxy {
script "pidof haproxy"
interval 2
}
vrrp_instance VI_1 {
debug 2
interface eth0 # interface to monitor
state BACKUP
virtual_router_id 51 # Assign one ID for this route
priority 100 # 101 on master, 100 on backup
unicast_src_ip x.x.x.x # My IP
unicast_peer {x.x.x.x # Peer IP}
track_script {chk_haproxy}
virtual_ipaddress {x.x.x.x dev eth0}
}
</code>
ip a
正文完
发表至: keepalived
2021-03-02