• keepalived+lvs子网掩码造成VIP切换故障 + vrrp_script+track_script


    keepalived+lvs子网掩码造成VIP切换故障
    架构:keepalived+lvs ,前端调度器是双主模型
    现象:keepalived手动停掉一台,但是虚拟IP不会切换
    
    整体网络是24位
    VIP:172.18.3.200
    keepalived的路由
    [root@Sserver3-53 clouder]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         172.18.3.1      0.0.0.0         UG    0      0        0 eth0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
    172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
    172.18.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
    
    PS:不fail over 原因就是这条16位的路由作怪
    : eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 06:cf:56:00:01:3b brd ff:ff:ff:ff:ff:ff
        inet 172.18.3.53/24 brd 172.18.3.255 scope global eth0
           valid_lft forever preferred_lft forever
        inet 172.18.3.200/16 scope global eth0  #没有secondary
           valid_lft forever preferred_lft forever
        inet 172.18.3.201/16 scope global secondary eth0
           valid_lft forever preferred_lft forever
    
    解决,配置检查:
    后端realserver配置的虚拟IP为:
    /sbin/ifconfig lo:0 172.18.3.200 broadcast 172.18.3.200 netmask 255.255.255.255 up
    /sbin/route add -host 172.18.3.200 dev lo:0
    
    前端keepalived:
    virtual_ipaddress {
          172.18.3.200/16
     }
    明显子网掩码出问题了。
    virtual_ipaddress {
          172.18.3.200/24
    }
    
    
    重启keepalived,检查现象:
    [root@Sserver3-53 clouder]# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         172.18.3.1      0.0.0.0         UG    0      0        0 eth0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
    172.18.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
    
    eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 06:cf:56:00:01:3b brd ff:ff:ff:ff:ff:ff
        inet 172.18.3.53/24 brd 172.18.3.255 scope global eth0
           valid_lft forever preferred_lft forever
        inet 172.18.3.200/24 scope global secondary eth0
           valid_lft forever preferred_lft forever
    
    
    15.2    keepalived在centos7.2中的bug
    keepalived 在centos7.2 使用 /bin/systemctl restart keepalived.service 配置文件没有生效
    需要使用reload参数来重新生效

     参考:

    https://www.cnblogs.com/paul8339/p/9644821.html

    Keepalived详解(四):通过vrrp_script实现对集群资源的监控【转】

  • 相关阅读:
    Python读写ini文件
    MySQL 让主键id 从1开始自增
    python 找字符串中所有包含字符的下标
    centos7防火墙命令
    如何将npm升级到最新版本
    将 Npm 的源替换成淘宝的源
    MySQL 时间格式化/ MySQL DATE_FORMAT
    Python中crypto模块进行AES加密和解密
    windows环境下python3安装Crypto
    Nginx+PHPSTORM+Xdebug 配置
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/10672051.html
Copyright © 2020-2023  润新知