The high availability of Redis+Sentinel cannot execute client-reconfig-script script for VIP drift during master-slave switching.

has been given permission to execute the script.
after shutting down a redis for master-slave switching, VIP drift is not executed (it is not clear whether the script has been executed). Running the script alone can drift.
configuration is as follows
Sentinel configuration (part of the code is automatically generated after master-slave switching)

-sharp Example sentinel.conf

-sharp *** IMPORTANT ***
-sharp
-sharp By default Sentinel will not be reachable from interfaces different than
-sharp localhost, either use the "bind" directive to bind to a list of network
-sharp interfaces, or disable protected mode with "protected-mode no" by
-sharp adding it to this configuration file.
-sharp
-sharp Before doing that MAKE SURE the instance is protected from the outside
-sharp world via firewalling or other means.
-sharp
-sharp For example you may use one of the following:
-sharp
-sharp bind 127.0.0.1 192.168.1.1
-sharp
-sharp protected-mode no
protected-mode no

-sharp port <sentinel-port>
-sharp The port that this sentinel instance will run on

daemonize yes
port 26379
logfile "/var/log/redis/sentinel.log"
pidfile "/var/run/sentinel.pid"

-sharp sentinel announce-ip <ip>
-sharp sentinel announce-port <port>
-sharp
-sharp The above two configuration directives are useful in environments where,
-sharp because of NAT, Sentinel is reachable from outside via a non-local address.
-sharp
-sharp When announce-ip is provided, the Sentinel will claim the specified IP address
-sharp in HELLO messages used to gossip its presence, instead of auto-detecting the
-sharp local address as it usually does.
-sharp
-sharp Similarly when announce-port is provided and is valid and non-zero, Sentinel
-sharp will announce the specified TCP port.
-sharp
-sharp The two options don"t need to be used together, if only announce-ip is
-sharp provided, the Sentinel will announce the specified IP and the server port
-sharp as specified by the "port" option. If only announce-port is provided, the
-sharp Sentinel will announce the auto-detected local IP and the specified port.
-sharp
-sharp Example:
-sharp
-sharp sentinel announce-ip 1.2.3.4

-sharp dir <working-directory>
-sharp Every long running process should have a well-defined working directory.
-sharp For Redis Sentinel to chdir to /tmp at startup is the simplest thing
-sharp for the process to don"t interfere with administrative tasks such as
-sharp unmounting filesystems.
dir "/tmp"

-sharp sentinel monitor <master-name> <ip> <redis-port> <quorum>
-sharp
-sharp Tells Sentinel to monitor this master, and to consider it in O_DOWN
-sharp (Objectively Down) state only if at least <quorum> sentinels agree.
-sharp
-sharp Note that whatever is the ODOWN quorum, a Sentinel will require to
-sharp be elected by the majority of the known Sentinels in order to
-sharp start a failover, so no failover can be performed in minority.
-sharp
-sharp Slaves are auto-discovered, so you don"t need to specify slaves in
-sharp any way. Sentinel itself will rewrite this configuration file adding
-sharp the slaves using additional configuration options.
-sharp Also note that the configuration file is rewritten when a
-sharp slave is promoted to master.
-sharp
-sharp Note: master name should not include special characters or spaces.
-sharp The valid charset is A-z 0-9 and the three characters ".-_".
sentinel myid 7267fb13d88570855d5b6e47915520d3e625afd5

-sharp sentinel auth-pass <master-name> <password>
-sharp
-sharp Set the password to use to authenticate with the master and slaves.
-sharp Useful if there is a password set in the Redis instances to monitor.
-sharp
-sharp Note that the master password is also used for slaves, so it is not
-sharp possible to set a different password in masters and slaves instances
-sharp if you want to be able to monitor these instances with Sentinel.
-sharp
-sharp However you can have Redis instances without the authentication enabled
-sharp mixed with Redis instances requiring the authentication (as long as the
-sharp password set is the same for all the instances requiring the password) as
-sharp the AUTH command will have no effect in Redis instances with authentication
-sharp switched off.
-sharp
-sharp Example:
-sharp
-sharp sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
sentinel monitor mymaster 10.0.0.42 6379 2

-sharp sentinel down-after-milliseconds <master-name> <milliseconds>
-sharp
-sharp Number of milliseconds the master (or any attached slave or sentinel) should
-sharp be unreachable (as in, not acceptable reply to PING, continuously, for the
-sharp specified period) in order to consider it in S_DOWN state (Subjectively
-sharp Down).
-sharp
-sharp Default is 30 seconds.
sentinel client-reconfig-script mymaster /usr/opt/notify_master.sh

-sharp sentinel parallel-syncs <master-name> <numslaves>
-sharp
-sharp How many slaves we can reconfigure to point to the new slave simultaneously
-sharp during the failover. Use a low number if you use the slaves to serve query
-sharp to avoid that all the slaves will be unreachable at about the same
-sharp time while performing the synchronization with the master.
sentinel auth-pass mymaster dell@123

-sharp sentinel failover-timeout <master-name> <milliseconds>
-sharp
-sharp Specifies the failover timeout in milliseconds. It is used in many ways:
-sharp
-sharp - The time needed to re-start a failover after a previous failover was
-sharp   already tried against the same master by a given Sentinel, is two
-sharp   times the failover timeout.
-sharp
-sharp - The time needed for a slave replicating to a wrong master according
-sharp   to a Sentinel current configuration, to be forced to replicate
-sharp   with the right master, is exactly the failover timeout (counting since
-sharp   the moment a Sentinel detected the misconfiguration).
-sharp
-sharp - The time needed to cancel a failover that is already in progress but
-sharp   did not produced any configuration change (SLAVEOF NO ONE yet not
-sharp   acknowledged by the promoted slave).
-sharp
-sharp - The maximum time a failover in progress waits for all the slaves to be
-sharp   reconfigured as slaves of the new master. However even after this time
-sharp   the slaves will be reconfigured by the Sentinels anyway, but not with
-sharp   the exact parallel-syncs progression as specified.
-sharp
-sharp Default is 3 minutes.
sentinel config-epoch mymaster 254

-sharp SCRIPTS EXECUTION
-sharp
-sharp sentinel notification-script and sentinel reconfig-script are used in order
-sharp to configure scripts that are called to notify the system administrator
-sharp or to reconfigure clients after a failover. The scripts are executed
-sharp with the following rules for error handling:
-sharp
-sharp If script exits with "1" the execution is retried later (up to a maximum
-sharp number of times currently set to 10).
-sharp
-sharp If script exits with "2" (or an higher value) the script execution is
-sharp not retried.
-sharp
-sharp If script terminates because it receives a signal the behavior is the same
-sharp as exit code 1.
-sharp
-sharp A script has a maximum running time of 60 seconds. After this limit is
-sharp reached the script is terminated with a SIGKILL and the execution retried.

-sharp NOTIFICATION SCRIPT
-sharp
-sharp sentinel notification-script <master-name> <script-path>
-sharp
-sharp Call the specified notification script for any sentinel event that is
-sharp generated in the WARNING level (for instance -sdown, -odown, and so forth).
-sharp This script should notify the system administrator via email, SMS, or any
-sharp other messaging system, that there is something wrong with the monitored
-sharp Redis systems.
-sharp
-sharp The script is called with just two arguments: the first is the event type
-sharp and the second the event description.
-sharp
-sharp The script must exist and be executable in order for sentinel to start if
-sharp this option is provided.
-sharp
-sharp Example:
-sharp
-sharp sentinel notification-script mymaster /var/redis/notify.sh

-sharp CLIENTS RECONFIGURATION SCRIPT
-sharp
-sharp sentinel client-reconfig-script <master-name> <script-path>
-sharp
-sharp When the master changed because of a failover a script can be called in
-sharp order to perform application-specific tasks to notify the clients that the
-sharp configuration has changed and the master is at a different address.
-sharp
-sharp The following arguments are passed to the script:
-sharp
-sharp <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
-sharp
-sharp <state> is currently always "failover"
-sharp <role> is either "leader" or "observer"
-sharp
-sharp The arguments from-ip, from-port, to-ip, to-port are used to communicate
-sharp the old address of the master and the new address of the elected slave
-sharp (now a master).
-sharp
-sharp This script should be resistant to multiple invocations.
-sharp
-sharp Example:
-sharp
-sharp sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
sentinel leader-epoch mymaster 254

-sharp Generated by CONFIG REWRITE
sentinel known-slave mymaster 10.0.0.40 6379
sentinel known-slave mymaster 10.0.0.41 6379
sentinel known-sentinel mymaster 10.0.0.40 26379 8ed286e02e81d6946e0d007f569e164a9404c03f
sentinel known-sentinel mymaster 10.0.0.41 26379 8e1529d6b3ce060ea4282d99b671330546d723ab
sentinel current-epoch 254

the difference is that the sentence "sentinel client-reconfig-script mymaster / usr/opt/notify_master.sh" was moved to it after the master-slave switch, and I wrote it on the last line when I wrote it

.

Sentinel log (including master-slave switch and original master restart)

3314:X 02 Apr 10:14:07.069 -sharp +sdown master mymaster 10.0.0.41 6379
3314:X 02 Apr 10:14:07.159 -sharp +new-epoch 254
3314:X 02 Apr 10:14:07.161 -sharp +vote-for-leader 8ed286e02e81d6946e0d007f569e164a9404c03f 254
3314:X 02 Apr 10:14:07.679 -sharp +config-update-from sentinel 8ed286e02e81d6946e0d007f569e164a9404c03f 10.0.0.40 26379 @ mymaster 10.0.0.41 6379
3314:X 02 Apr 10:14:07.679 -sharp +switch-master mymaster 10.0.0.41 6379 10.0.0.42 6379
3314:X 02 Apr 10:14:07.680 * +slave slave 10.0.0.40:6379 10.0.0.40 6379 @ mymaster 10.0.0.42 6379
3314:X 02 Apr 10:14:07.680 * +slave slave 10.0.0.41:6379 10.0.0.41 6379 @ mymaster 10.0.0.42 6379
3314:X 02 Apr 10:14:37.742 -sharp +sdown slave 10.0.0.41:6379 10.0.0.41 6379 @ mymaster 10.0.0.42 6379
3314:X 02 Apr 10:48:36.099 -sharp -sdown slave 10.0.0.41:6379 10.0.0.41 6379 @ mymaster 10.0.0.42 6379
3314:X 02 Apr 10:48:46.056 * +convert-to-slave slave 10.0.0.41:6379 10.0.0.41 6379 @ mymaster 10.0.0.42 6379

VIP drift script

-sharp!/bin/bash

MASTER_IP=$6  -sharpredisip

LOCAL_IP=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk "{print $2}"|tr -d "addr:"`  -sharpip

VIP="10.0.0.31"

NETMASK="24"

INTERFACE="eno16777736"  -sharp

if [ ${MASTER_IP} = ${LOCAL_IP} ];then   

    sudo /usr/sbin/ip  addr  add ${VIP}/${NETMASK}  dev ${INTERFACE}  -sharpVIP

    sudo /usr/sbin/arping -q -c 3 -A ${VIP} -I ${INTERFACE}

    exit 0

else

   sudo /usr/sbin/ip  addr del  ${VIP}/${NETMASK}  dev ${INTERFACE}   -sharpVIP

   exit 0

fi

exit 1
Mar.22,2021

I can just get rid of sudo. But why?


after I remove the sudo, the VIP will not drift
Apr 7 18:01:28 master redis-sentinel: 10954 br X 07 Apr 18V 01V 28.335 * + slave slave 192.168.11.13 6379 192.168.11.13 6379 @ def_master 192.168.11.10 6379
Apr 7 18:01:28 master redis-sentinel: 10954 sudo X 07 slave slave 192.168.11.12 @ slave slave 192.168.11.12 Fran 6379 192.168.11.12 @ Def_master 192.168.11.10 6379
Apr 7 18:01:28 master redis-sentinel: 10954 master redis-sentinel: 10954 Apr 18V 01master redis-sentinel: 28.464-sharp-script-error / var/lib/redis/failover.sh 0 2
Apr 7 18:01:33 master redis-sentinel: 10954 Apr 18V 0133.371-sharp + sdown slave 192.168.11.12 Apr 6379 192.168.11.12 6379 @ def_master 192.168.11.10 6379
Apr 7 18:01:34 master redis-sentinel: 10954 : X 07 Apr 18 sdown sentinel 63e8dad4e625ce6ac20ee4221b8c22c5443b3433 01purl 34.600-sharp + sdown sentinel 63e8dad4e625ce6ac20ee4221b8c22c5443b3433 192.168.11.12 26379 @ def_master 192.168.11.10 6379
Apr 7 18:02:48 master redis-sentinel: 10954 Vera X 07 Apr 18V 02VO 48.303-sharp-sdown slave 192.168.11.12 def_master 6379 192.168.11.12 6379 @ def_master 192.168.11.10 6379
Apr 7 18:02:52 master redis-sentinel: 10954 VX 07 Apr 18V 02def_master 52.493-sharp-sdown Sentinel 63e8dad4e625ce6ac20ee4221b8c22c5443b3433 192.168.11.12 26379 @ def_master 192.168.11.10 6379
this is centos7's message log


has the final problem been solved? I also encounter the same problem, hope to give some guidance, thank you!
Log:
16587 Jun X 29 Jun 01 Jun 14V 40.545-sharp Sentinel ID is 6e912d3910d2394ef472b5fd8daa6548ec628d24
16587 Jun 01 14 sharp Sentinel ID is 6e912d3910d2394ef472b5fd8daa6548ec628d24 40.545-sharp + monitor master mymaster 172.16.24.240 6379 quorum 2
16587br X 29 Jun 01 15 sharp + sdown master mymaster 172.16.24.240 6379
16587 Jun X 29 Jun 01 15 sharp + new-epoch 33
16587ZeX 29 Jun 01 15 sharp 37.330-sharp + new-epoch 33
-sharp + odown master mymaster 172.16.24.240 6379-sharpquorum 2 sharp Next failover delay: I will not start a failover before Fri Jun 2
16587 Jun X 29 Jun 01 br 1537.333-sharp Next failover delay: I will not start a failover before Fri Jun 29 01:16:08 2018
16587 sharpquorum 172.16.24.242 26379 @ mymaster 172.16.24.240 6379
16587X 29 Jun 01 br 15V 37.682-sharp + switch-master mymaster 172.16.24.240 172.16.24. 6379
16587slave slave 172.16.24.241 6379 @ mymaster 172.16.24.241 6379 @ mymaster 172.16.24.242 6379
16587Vera X 29 Jun 0115 script-error 37.683 * + slave slave 172.16.24.2406379 172.16.24.240 6379 @ mymaster 172.16.24.242 6379
16587RX 29 Jun 0115 script-error 37.771-sharp-script-error / usr/notify_master.sh 0 2
16587 .765-sharp + sdown slave 172.16.24.240Viru 6379 172.16.24.240 6379 @ mymaster 172.16.24.242 6379

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e43814-44a36.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e43814-44a36.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?