Closed louis-6wind closed 3 years ago
@louis-oui First of all it would probably be sensible for you to correct the configuration errors that are highlighted in the log:
also you have track_file blocks in the VRRP_INSTANCEs, but no track file is specified.
Why do you expect the notify script to run after a reload? The notify script runs at startup because the sync group transitions to backup state. When the reload occurs there is no state transition of the sync group, and so the notify script is not run. When the sync group transitions to master state, the notify script will run again.
If you modify you notify.sh script as follows, then you will be able to see better what is happening.
cat>/tmp/notify.sh <<\EOF
#!/bin/sh
echo $(date): $* >>/tmp/toto
EOF
Describe the bug Changing notify script and reload does not execute the new script At least, a signal to re-execute the script would be appreciated.
To Reproduce
ifconfig ens4 192.168.15.41/28 up ifconfig ens5 192.168.16.41/28 up kill $(pgrep keepalived) sleep 1 cat>/tmp/notify.sh <<\EOF
!/bin/sh
date>/tmp/toto EOF cp -p /tmp/notify.sh /tmp/notify2.sh chmod 700 /tmp/notify*.sh cat>/etc/keepalived/keepalived.conf <<\EOF global_defs { router_id router enable_script_security script_user root dynamic_interfaces }
vrrp_sync_group group15 { group { vrrp vrrp2 } notify /tmp/notify.sh }
vrrp_track_file fp_tracker { file /var/run/keepalived/fp-tracker weight 0 }
vrrp_instance vrrp { version 2 state BACKUP interface ens4
use_vmac vrrp
track_file { }
garp_master_delay 5
virtual_router_id 15
priority 200 advert_int 1.0
virtual_ipaddress { 192.168.15.38/28 }
preempt_delay 0 }
vrrp_instance vrrp2 { version 2 state BACKUP interface ens5
use_vmac vrrp
track_file { }
garp_master_delay 5
virtual_router_id 15
priority 200 advert_int 1.0
virtual_ipaddress { 192.168.16.38/28 }
preempt_delay 0 } EOF
keepalived -D sleep 2 cat /tmp/toto sed -e 's|notify.sh|notify2.sh|g' -i /etc/keepalived/keepalived.conf kill -s SIGHUP $(pgrep keepalived | head -n1) #signal for conf reload cat /tmp/toto
Observed behavior notify.sh script runs at startup. It writes the date in /tmp/toto After changing from notify.sh to notify2.sh, notify2.sh script does not run at reload. It does not write as expected the date in /tmp/toto
Expected behavior notify2.sh script runs at reload.
Keepalived version Keepalived v2.1.5 (07/13,2020)
Copyright(C) 2001-2020 Alexandre Cassen, acassen@gmail.com
Built with kernel headers for Linux 4.15.18 Running on Linux 4.15.0-123-generic #126-Ubuntu SMP Wed Oct 21 09:40:11 UTC 2020
configure options: --prefix=/usr --sysconfdir=/etc --with-extra-cflags=-I/usr/include/libnl3 --with-extra-ldflags= --with-extra-libs=-lnl-genl-3 --disable-lvs --with-init=systemd --host=x86_64-linux-gnu host_alias=x86_64-linux-gnu
Config options: VRRP VRRP_AUTH OLD_CHKSUM_COMPAT FIB_ROUTING
System options: PIPE2 SIGNALFD INOTIFY_INIT1 VSYSLOG EPOLL_CREATE1 IPV4_DEVCONF IPV6_ADVANCED_API 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_OIFNAME RTA_TTL_PROPAGATE IFA_FLAGS IP_MULTICAST_ALL LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA NET_LINUX_IF_H_COLLISION LIBIPTC_LINUX_NET_IF_H_COLLISION VRRP_VMAC VRRP_IPVLAN IFLA_LINK_NETNSID CN_PROC SOCK_NONBLOCK SOCK_CLOEXEC O_PATH GLOB_BRACE INET6_ADDR_GEN_MODE VRF SO_MARK SCHED_RESET_ON_FORK
Distro (please complete the following information):
Details of any containerisation or hosted service (e.g. AWS) no container
Configuration file: see to reproduce
Notify and track scripts no
System Log entries root@ubuntu:~/keepalived# journalctl _PID=$(pgrep keepalived | tail -n1) -- Logs begin at Fri 2020-10-23 11:17:41 UTC, end at Thu 2021-02-11 14:36:44 UTC. -- Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Registering Kernel netlink reflector Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Registering Kernel netlink command channel Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: "vrrp_track_file" is deprecated, please use "track_file" Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: (/etc/keepalived/keepalived.conf: Line 51) (vrrp2) VRRP instance vrrp is already using vrrp - ignoring name Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Assigned address 192.168.15.41 for interface ens4 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Assigned address fe80::e56:39ff:feb3:bd01 for interface ens4 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: (vrrp): Success creating VMAC interface vrrp Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: NOTICE: setting sysctl net.ipv4.conf.all.rp_filter from 1 to 0 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Assigned address 192.168.16.41 for interface ens5 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Assigned address fe80::e56:39ff:feb3:bd02 for interface ens5 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: (vrrp2): Success creating VMAC interface vrrp.15 Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: Registering gratuitous ARP shared channel Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: (vrrp) Entering BACKUP STATE (init) Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: (vrrp2) Entering BACKUP STATE (init) Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: VRRP sockpool: [ifindex( 24), family(IPv4), proto(112), fd(13,14)] Feb 11 14:36:34 ubuntu Keepalived_vrrp[8825]: VRRP sockpool: [ifindex( 25), family(IPv4), proto(112), fd(15,16)] Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: Reloading Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: "vrrp_track_file" is deprecated, please use "track_file" Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: (/etc/keepalived/keepalived.conf: Line 51) (vrrp2) VRRP instance vrrp is already using vrrp - ignoring name Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: (vrrp) Found matching interface vrrp Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: Assigned address 192.168.15.41 for interface ens4 Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: Assigned address fe80::e56:39ff:feb3:bd01 for interface ens4 Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: (vrrp2) Found matching interface vrrp.15 Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: Assigned address 192.168.16.41 for interface ens5 Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: Assigned address fe80::e56:39ff:feb3:bd02 for interface ens5 Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: VRRP sockpool: [ifindex( 24), family(IPv4), proto(112), fd(13,14)] Feb 11 14:36:36 ubuntu Keepalived_vrrp[8825]: VRRP sockpool: [ifindex( 25), family(IPv4), proto(112), fd(15,16)] Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: (vrrp2) Receive advertisement timeout Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: (vrrp) Receive advertisement timeout Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: (vrrp) Entering MASTER STATE Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: (vrrp) setting VIPs. Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: (vrrp) Sending/queueing gratuitous ARPs on vrrp for 192.168.15.38 Feb 11 14:36:39 ubuntu Keepalived_vrrp[8825]: Sending gratuitous ARP on vrrp for 192.168.15.38
Did keepalived coredump? no
Additional context no