【发布时间】:2016-02-25 09:21:45
【问题描述】:
我有下一个场景,4 个 VM 运行 Red Hat Enterprise Linux 7:
20.1.67.230 服务器(虚拟 IP)(不是主机)
20.1.67.219 haproxy1(负载平衡器)
- 20.1.67.229 haproxy2(负载平衡器)
- 20.1.67.223 server1(负载平衡)
- 20.1.67.213 server2(负载平衡)
我的 keepalived.conf 文件是:
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 enp0s3 # interface to monitor
state MASTER# MASTER on haproxy1, BACKUP on haproxy2
virtual_router_id 51
priority 101 # 101 on haproxy1, 100 on haproxy2
unicast_src_ip 20.1.67.229 # This is the IP of the interface keepalived listens on
unicast_peer { # This is the IP of the peer instance
20.1.67.219
}
virtual_ipaddress {
20.1.67.230 # virtual ip address
}
track_script {
chk_haproxy
}
}
当对虚拟 IP 执行请求时,例如:
curl server:8888/info
一切正常,但只是一会儿,在一些请求后命令返回我:连接被拒绝
所以我必须手动重启 keepalived 服务,这样:
systemctl restart keepalived.service
整个系统看起来运行良好,haproxy1 和 haproxy2 之间的 VRRP 消息正常,就像虚拟 IP 无法正常工作一样。
谁能指出正确的方向来诊断和解决这个问题?
【问题讨论】:
标签: virtualbox redhat haproxy high-availability virtual-ip-address