zoukankan      html  css  js  c++  java
  • 启动keepalived报错(VI_1): received an invalid passwd!

    一、署keepalived后测试主down掉后无法自动切换到备

    查看message日志一直报此错误

     [root@lb-nginx-master ~]# tailf /var/log/messages
    Jul 27 09:58:09 lb-nginx-master Keepalived_vrrp[28598]: (VI_1): received an invalid passwd!
    Jul 27 09:58:09 lb-nginx-master Keepalived_vrrp[28598]: bogus VRRP packet received on eth0 !!!
    Jul 27 09:58:09 lb-nginx-master Keepalived_vrrp[28598]: VRRP_Instance(VI_1) Dropping received VRRP packet...
    Jul 27 09:58:10 lb-nginx-master Keepalived_vrrp[28598]: (VI_1): received an invalid passwd!
    Jul 27 09:58:10 lb-nginx-master Keepalived_vrrp[28598]: bogus VRRP packet received on eth0 !!!
    Jul 27 09:58:10 lb-nginx-master Keepalived_vrrp[28598]: VRRP_Instance(VI_1) Dropping received VRRP packet...

    二、原因分析

    因为virtual_router_id,路由ID实例,必须是唯一的,其它环境中有存在相同的实例ID,所以要修改一个其它的实例ID

    # 主节点 
    [root@lb-nginx-master ~]# cat /etc/keepalived/keepalived.conf 
    bal_defs { 
       # 接收邮件地址 
       notification_email { 
         acassen@firewall.loc 
         failover@firewall.loc 
         sysadmin@firewall.loc 
       } 
       # 邮件发送地址 
       notification_email_from Alexandre.Cassen@firewall.loc  
       smtp_server 127.0.0.1 
       smtp_connect_timeout 30 
       router_id NGINX_MASTER 
    } 
    
    vrrp_script check_nginx {
        script "/etc/keepalived/check_nginx.sh"
    }
    
    vrrp_instance VI_1 { 
        state MASTER 
        interface eth0
        virtual_router_id 70 # VRRP 路由 ID实例,每个实例是唯一的 
        priority 100    # 优先级,备服务器设置 90 
        advert_int 1    # 指定VRRP 心跳包通告间隔时间,默认1秒 
        authentication { 
            auth_type PASS      
            auth_pass 1111 
        }  
        virtual_ipaddress { 
            192.168.5.60/24 
        } 
        track_script {
            check_nginx
        } 
    }
    
    # 备节点
     [root@lb-nginx-backup ~]# cat /etc/keepalived/keepalived.conf 
    bal_defs { 
       # 接收邮件地址 
       notification_email { 
         acassen@firewall.loc 
         failover@firewall.loc 
         sysadmin@firewall.loc 
       } 
       # 邮件发送地址 
       notification_email_from Alexandre.Cassen@firewall.loc  
       smtp_server 127.0.0.1 
       smtp_connect_timeout 30 
       router_id NGINX_MASTER 
    } 
    
    vrrp_script check_nginx {
        script "/etc/keepalived/check_nginx.sh"
    }
    
    vrrp_instance VI_1 { 
        state BACKUP 
        interface eth0
        virtual_router_id 70 # VRRP 路由 ID实例,每个实例是唯一的 
        priority 50    # 优先级,备服务器设置 90 
        advert_int 1    # 指定VRRP 心跳包通告间隔时间,默认1秒 
        authentication { 
            auth_type PASS      
            auth_pass 1111 
        }  
        virtual_ipaddress { 
            192.168.5.60/24 
        } 
        track_script {
            check_nginx
        } 
    }
    
    # 检查脚本
     [root@lb-nginx-master ~]# cat /etc/keepalived/check_nginx.sh 
    count=$(ps -ef |grep nginx |egrep -cv "grep|$$")
    
    if [ "$count" -eq 0 ];then
        systemctl stop keepalived
    fi

    主备都重启keepalived,重启后再测试已正常。

     [root@lb-nginx-master ~]# systemctl start keepalived.service 
     [root@lb-nginx-backup ~]# systemctl restart keepalived
  • 相关阅读:
    C#中两数相除为0的原因
    Keil STM32F4xx_DFP.1.0.8.pack下载链接
    LabVIEW入门第九天(数组和簇)
    C#执行文件抛出异常方法
    C#中两数相除为0的原因
    C#判断文件夹路径是否存在并新建
    C#窗体程序随电脑分辨率自动调整大小
    C#判断文件夹路径是否存在并新建
    C#窗体程序随电脑分辨率自动调整大小
    VisualTreeHelper使用之ListBox模板DataTemplate中CheckBox选中项(WP7.1)
  • 原文地址:https://www.cnblogs.com/cyleon/p/11253991.html
Copyright © 2011-2022 走看看