dockerredisdocker-composeredis-sentinel

Redis sentinel failover


I created a learning project using Spring Data Redis, bitnami/redis and bitnami/redis-sentinel images. The Docker Compose file is here. The deployment command is docker-compose -f redis-sentinel.yaml up --scale redis-sentinel=3 --scale redis-replica=2 -d, so the Redis configuration is as follows:

enter image description here

After bringing everything up, I stop the master container with docker stop redis-master. After 10 seconds, the sentinels failover to one of the replicas. So far so good. However, nothing is shown in the container console logs for the following very important things:

  1. master down has been detected.
  2. Failover has been initiated.
  3. Failover has successfully completed.

I was expecting the sentinel to log the aspects indicated above.

Also, when I run sentinel masters command from the Redis CLI of one of the sentinels, I see no difference in the number of replica before and after failover. I was expecting to see the number drop by 1 when the master is shut down.

31) "num-slaves"
32) "2"
33) "num-other-sentinels"
34) "2"

Solution

  • Please ensure 1. Sentinel Logs are enabled 2. Make sure you are looking at sentinel logs and not master/slave logs. You can find the sentinel.conf file, which has the log file path defined in it .. the default value is logfile "", which logs to standard output.