当主机主服务器再次启动时,保持活动的虚拟 IP 不会传输回去



我使用2个vagrant centos7实例安装了用于虚拟IP故障转移的keepalive,但遇到问题(我在生产上也有同样的问题)。

基本上,我有2个实例运行。以下是这两个服务器的配置keepalive.conf:

server1的配置:

global_defs {
   notification_email {
      ABC@gmail.com
   }
   notification_email_from server1.dev.vagrant.net
   smtp_server localhost
   smtp_connect_timeout 30
}
  vrrp_instance VI_enp0s8 {
      state MASTER
      interface enp0s8
      virtual_router_id 51
      priority 100
      advert_int 1
      authentication {
          auth_type PASS
          auth_pass 1111
      }
      virtual_ipaddress {
                    192.168.65.110
                    192.168.65.111
      }
  }

server2的配置:

global_defs {
   notification_email {
      ABC@gmail.com
   }
   notification_email_from server2.dev.vagrant.net
   smtp_server localhost
   smtp_connect_timeout 30
}
  vrrp_instance VI_enp0s8 {
      state BACKUP
      interface enp0s8
      virtual_router_id 51
      priority 99
      advert_int 1
      authentication {
          auth_type PASS
          auth_pass 1111
      }
      virtual_ipaddress {
                    192.168.65.110
                    192.168.65.111
      }
  }

基本上,如果我停止使用:sudo服务在server1上静止停止;然后将虚拟iPaddresses成功传输到Server2。当我使用" Sudo Service WeeaLative Start"开始在Server1上重新存放时,然后将IP地址转移回去。当我在server1上进行" sudo重新启动"时,一切也可以正常工作。

但是,如果我关闭然后重新启动server1使用:sudo shutdown -h现在(或vagrant halt server1),然后vagrant up up server1,则不会将虚拟IP分配给任何一个服务器。(IP ADDR SHOW ENP0S8)。

以下是/var/log/log/邮件的日志。在我看来,由于某种原因,添加了虚拟IP,但随后删除了。

Jun 21 08:19:50 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) Entering MASTER STATE
Jun 21 08:19:50 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) setting protocol VIPs.
Jun 21 08:19:50 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.110 added
Jun 21 08:19:50 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.111 added
Jun 21 08:19:50 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) Sending gratuitous ARPs on enp0s8 for 192.168.65.110
Jun 21 08:19:50 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) Sending gratuitous ARPs on enp0s8 for 192.168.65.111
Jun 21 08:19:52 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.104 removed
Jun 21 08:19:52 oasis4 Keepalived_vrrp[724]: Netlink reflector reports IP 192.168.65.104 removed
Jun 21 08:19:52 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.110 removed
Jun 21 08:19:52 oasis4 Keepalived_vrrp[724]: Netlink reflector reports IP 192.168.65.110 removed
Jun 21 08:19:52 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.111 removed
Jun 21 08:19:52 oasis4 Keepalived_vrrp[724]: Netlink reflector reports IP 192.168.65.111 removed
Jun 21 08:19:52 oasis4 kernel: e1000: enp0s8 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Jun 21 08:19:52 oasis4 kernel: IPv6: ADDRCONF(NETDEV_UP): enp0s8: link is not ready
Jun 21 08:19:52 oasis4 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): enp0s8: link becomes ready
Jun 21 08:19:54 oasis4 Keepalived_healthcheckers[723]: Netlink reflector reports IP 192.168.65.104 added
Jun 21 08:19:54 oasis4 Keepalived_vrrp[724]: Netlink reflector reports IP 192.168.65.104 added
Jun 21 08:19:55 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) Sending gratuitous ARPs on enp0s8 for 192.168.65.110
Jun 21 08:19:55 oasis4 Keepalived_vrrp[724]: VRRP_Instance(VI_enp0s8) Sending gratuitous ARPs on enp0s8 for 192.168.65.111
Jun 21 08:19:55 oasis4 systemd: Starting Session 2 of user vagrant.
Jun 21 08:19:55 oasis4 systemd: Started Session 2 of user vagrant.
Jun 21 08:19:55 oasis4 systemd-logind: New session 2 of user vagrant.
Jun 21 08:19:56 oasis4 systemd-logind: Removed session 1.
Jun 21 08:20:00 oasis4 systemd: Starting Session 3 of user vagrant.
Jun 21 08:20:00 oasis4 systemd: Started Session 3 of user vagrant.
Jun 21 08:20:00 oasis4 systemd-logind: New session 3 of user vagrant.
Jun 21 08:20:01 oasis4 systemd: Starting user-0.slice.
Jun 21 08:20:01 oasis4 systemd: Created slice user-0.slice.
Jun 21 08:20:01 oasis4 systemd: Starting Session 4 of user root.

如果我登录到server1,然后手动重新启动keepalive,则事情开始正常工作。

可以让我知道我的配置是否有任何问题?

另外,有几次我无法使用sudo服务保存停止正确停止服务;发生时,虚拟IP不会分配给任一服务员。

谢谢。

根据日志,在网络接口enp0s8启动并准备就绪之前,要启动了保存。如果您要保持座位以跟踪界面,则应在VRRP_INSTANCE

中添加类似的内容
track_interface {
    enp0s8
}

相关内容

  • 没有找到相关文章

最新更新