![Keepalived-收到意外的 IP 编号 0,预期 1!](https://linux22.com/image/779281/Keepalived-%E6%94%B6%E5%88%B0%E6%84%8F%E5%A4%96%E7%9A%84%20IP%20%E7%BC%96%E5%8F%B7%200%EF%BC%8C%E9%A2%84%E6%9C%9F%201%EF%BC%81.png)
描述错误
我在 keepalived.log 中收到很多类似这样的错误 8 月 5 日 20:53:37 CENVLIFEPROXB Keepalived_vrrp[3983]: (VI_1) 收到意外的 ip 数量 0,预期为 1!
Keepalived 版本
2.2.4
Keepalived v2.2.4的输出keepalived -v
(2021 年 8 月 21 日)
版权所有 (C) 2001-2021 Alexandre Cassen,[电子邮件保护]
使用适用于 Linux 4.19.194 的内核头文件构建 在 Linux 4.19.0-17-amd64 上运行 #1 SMP Debian 4.19.194-3 (2021-07-18) 发行版:Debian GNU/Linux 10 (buster)
配置选项:--build=x86_64-linux-gnu --prefix=/usr --includedir=/include --mandir=/share/man --infodir=/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=/lib/x86_64-linux-gnu --libexecdir=/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --enable-snmp --enable-sha1 --enable-snmp-rfcv2 --enable-snmp-rfcv3 --enable-dbus --enable-dbus-create-instance --enable-json --enable-bfd --disable-systemd build_alias=x86_64-linux-gnu
配置选项:LVS VRRP VRRP_AUTH VRRP_VMAC JSON BFD OLD_CHKSUM_COMPAT SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 DBUS DBUS_CREATE_INSTANCE INIT=SYSV
系统选项:VSYSLOG MEMFD_CREATE IPV4_DEVCONF LIBNL3 RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_L3MDEV FRA_UID_RANGE RTAX_FASTOPEN_NO_COOKIE RTA_VIA FRA_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE IFA_FLAGS LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA IPTABLES NET_LINUX_IF_H_COLLISION LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS VRRP_IPVLAN IFLA_LINK_NETNSID GLOB_BRACE GLOB_ALTDIRFUNC INET6_ADDR_GEN_MODE VRF SO_MARK
发行版(请填写以下信息):
- 名称:Debian
- 版本:10.10
- 建筑:64
配置文件: 掌握
global_defs {
max_auto_priority
}
vrrp_script chk_vi_1 {
script "/etc/keepalived/keepalived-health-checks-1.sh"
interval 2
fall 1
rise 1
timeout 3
}
! vrrp_primary_node for cenvlifeproxb.aminerals.cl
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 30
priority 200
advert_int 1
virtual_ipaddress {
10.200.6.26/24 dev eth0 label eth0:1
}
track_script {
chk_vi_1
}
notify "/etc/keepalived/keepalived-state.sh"
}
奴隶
global_defs {
max_auto_priority
}
vrrp_script chk_vi_1 {
script "/etc/keepalived/keepalived-health-checks-1.sh"
interval 2
fall 1
rise 1
timeout 3
}
! vrrp_primary_node for cenvlifeproxa.aminerals.cl
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 30
priority 150
advert_int 1
virtual_ipaddress {
10.200.6.26/24 dev eth0 label eth0:1
}
track_script {
chk_vi_1
}
notify "/etc/keepalived/keepalived-state.sh"
}
通知和跟踪脚本 通知脚本
#!/bin/sh
### BEGIN INIT INFO
# Provides: keepalived-server
# Required-Start: $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: keepalived server
# chkconfig: - 80 75
# description: keepalived server
### END INIT INFO
/usr/bin/php /usr/share/artica-postfix/exec.keepalived-state.php --state $1 $2 $3
轨迹脚本
#!/bin/bash
### BEGIN INIT INFO
# Provides: keepalived-health-checks-1
### END INIT INFO
### BEGIN Proxy INFO
Proxy_id=$(/bin/pidof squid)
if [[ -z $Proxy_id ]]
then
/usr/bin/php /usr/share/artica-postfix/exec.keepalived-state.php --state primary_node _1 'Proxy is down'
exit 1
fi
### END Proxy INFO
### BEGIN Proxy INFO
Proxy_id=$(/bin/pidof squid)
if [[ -z $Proxy_id ]]
then
/usr/bin/php /usr/share/artica-postfix/exec.keepalived-state.php --state primary_node _1 'Proxy is down'
exit 1
fi
### END Proxy INFO
### BEGIN DISK SPACE INFO
DISK_USAGE_sda1=`/bin/df /dev/sda1 | tail -1 | awk '{print $5}' | sed 's/[^0-9]*//g'`
if (( $DISK_USAGE_sda1 > 96 ))
then
/usr/bin/php /usr/share/artica-postfix/exec.keepalived-state.php --state primary_node _1 'sda1 low disk space'
exit 1
fi
### END DISK SPACE INFO
exit 0