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
  • 相关阅读:
    python模块—socket
    mac os系统的快捷键
    教你如何将UIImageView视图中的图片变成圆角
    关于ASP.NET MVC
    iOS 日期格式的转换
    将App通过XCode上传到AppStore 出现这个错误“An error occurred uploading to the iTunes Store”的解决方法
    关于MAC OS下面两个软件的功能改进——Dictionary和Fit 输入法
    分享一下上个星期的香港行程
    【博客园IT新闻】博客园IT新闻 iPhone 客户端发布
    解决Entity Framework Code First 的问题——Model compatibility cannot be checked because the database does not contain model metadata
  • 原文地址:https://www.cnblogs.com/cyleon/p/11253991.html
Copyright © 2011-2022 走看看