关于LVS通过VRRP主备切换的问题
环境:
LVS-1 是主
在主下ipvsadm -Ln是有各节点显示的,备下是没有节点显示的,此时我service keepalived restart后,再ipvsadm -Ln仍然是有节点显示的,同时也是MASTER状态,日志如下:
Jul 9 00:41:28 idc-zczy-lvs-1 Keepalived_vrrp[2634]: VRRP_Instance(idc-zczy-nginx-proxy-instance-1) Entering MASTER STATE
Jul 9 00:41:28 idc-zczy-lvs-1 Keepalived_vrrp[2634]: VRRP_Instance(idc-zczy-nginx-proxy-instance-1) setting protocol VIPs.
LVS-2 是备
原本备下ipvsadm -Ln是没有节点显示的,但自从主LVS执行了service keepalived restart后,再在LVS-2上执行ipvsadm -Ln查看也有各节点显示了,同时我查看LVS-2的日志,如下:
Jul 9 00:41:27 idc-zczy-lvs-2 Keepalived_vrrp[57887]: VRRP_Instance(idc-zczy-nginx-proxy-instance-1) Transition to MASTER STATE
Jul 9 00:41:27 idc-zczy-lvs-2 Keepalived_vrrp[57887]: VRRP_Group(idc-zczy-nginx-proxy-group-1) Syncing instances to MASTER state
Jul 9 00:41:27 idc-zczy-lvs-2 Keepalived_vrrp[57887]: VRRP_Instance(idc-zczy-nginx-proxy-instance-1) Received higher prio advert
Jul 9 00:41:27 idc-zczy-lvs-2 Keepalived_vrrp[57887]: VRRP_Instance(idc-zczy-nginx-proxy-instance-1) Entering BACKUP STATE
Jul 9 00:41:27 idc-zczy-lvs-2 Keepalived_vrrp[57887]: VRRP_Group(idc-zczy-nginx-proxy-group-1) Syncing instances to BACKUP state
从日志看LVS-2已经接收到一个高优先级的实例,应该进入到BACKUP状态了,但是为什么ipvsadm -Ln还会有各节点显示呢?
我两台keepalived.conf里都配置了这些啊
vrrp_sync_group idc-zczy-nginx-proxy-group-1 {
group {
idc-zczy-nginx-proxy-instance-1
}
notify_master "/usr/local/keepalived/scripts/ipvsadm-start.sh"
notify_backup "/usr/local/keepalived/scripts/ipvsadm-stop.sh"
notify_fault "/usr/local/keepalived/scripts/ipvsadm-stop.sh"
smtp_alert
}