KeepAlived + HAProxy 一段时间后连接被拒绝

KeepAlived + HAProxy gets connection refused after a while

我有下一个场景,4 个虚拟机 运行 Red Hat Enterprise Linux 7:

我的 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

一切正常,但只是有一段时间,在一些请求命令后 returns 我:连接被拒绝

所以我必须手动重启 keepalived 服务,这样:

systemctl restart keepalived.service

整个系统似乎运行良好,haproxy1haproxy2 之间的 VRRP 消息正常,就像虚拟 IP 一样无法正常工作。

任何人都可以指出正确的方向来诊断和解决这个问题吗?

这是网络问题。网络上有一台设备的 IP 与我选择的虚拟 IP 相同。