Keepalive
Posted 芒果牛奶
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Keepalive相关的知识,希望对你有一定的参考价值。
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
以上是关于Keepalive的主要内容,如果未能解决你的问题,请参考以下文章