安装有keepalived的两台MySQL服务器做高可用:
OS版本:Red Hat Enterprise Linux Server release 6.3 (Santiago)
MySQL版本:5.7.19-17-log Percona Server
服务器:10.95.109.174/173
设定VIP:10.95.109.171。

一.现象

启动10.95.109.174的keepalived服务,服务启动正常,VIP 无法绑定
启动10.95.109.173的keepalived服务,服务启动正常,VIP 无法绑定

二.问题原因

1.查看日志

查看10.95.109.174的日志发现,其上keepalived服务无法获得VIP;

Dec 11 14:17:05 lspprddb514 Keepalived_vrrp[15214]: VRRP_Instance(VI_1) ignoring received advertisment...
Dec 11 14:17:06 lspprddb514 Keepalived_vrrp[15214]: ip address associated with VRID not present in received packet : 10.95.109.171
Dec 11 14:17:06 lspprddb514 Keepalived_vrrp[15214]: one or more VIP associated with VRID mismatch actual MASTER advert
Dec 11 14:17:06 lspprddb514 Keepalived_vrrp[15214]: bogus VRRP packet received on eth0 !!!

2.检查VRID 是否冲突

采用tcpdump抓包检查VRID 是否冲突
[root@lspprddb514 ~]# tcpdump -i eth0 vrrp -n |grep 174
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
14:27:48.344605 IP 10.95.109.81 > 224.0.0.18: VRRPv2, Advertisement, vrid 174, prio 150, authtype simple, intvl 1s, length 20
14:27:49.344645 IP 10.95.109.81 > 224.0.0.18: VRRPv2, Advertisement, vrid 174, prio 150, authtype simple, intvl 1s, length 20
14:27:50.344723 IP 10.95.109.81 > 224.0.0.18: VRRPv2, Advertisement, vrid 174, prio 150, authtype simple, intvl 1s, length 20
14:27:51.344882 IP 10.95.109.81 > 224.0.0.18: VRRPv2, Advertisement, vrid 174, prio 150, authtype simple, intvl 1s, length 20

显然,10.95.109.174所配置的 vrid 已经有其他数据库使用了。

三.解决

修改vrid 冲突的其中一套库的 vrid 即可

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 174
    priority 150
    advert_int 1
    #mcast_src_ip 10.19.90.212
    authentication {
        auth_type PASS
        auth_pass 1111
}
12-26 13:40
查看更多