I have three simplest Redis instances: 127.0.0.1:6379(master), 127.0.0.1:6380(slave), 127.0.0.1:6381(slave)
.
And I have three Redis Sentinel instance: 127.0.0.1:26379, 127.0.0.1:26380, 127.0.0.1:26381. they all monitor the master.
three redis.conf files are default, and the only difference is the port.
Here are the three sentinel.config file:
port 26379
sentinel monitor mymaster 127.0.0.1 6379 2
port 26380
sentinel monitor mymaster 127.0.0.1 6379 2
port 26381
sentinel monitor mymaster 127.0.0.1 6379 2
when I shutdown the master(127.0.0.1:6379)
, all sentinel instances log :
23594:X 20 Mar 2023 00:52:42.138 # +sdown master mymaster 127.0.0.1 6379
two slave instances print log endlessly:
20932:S 20 Mar 2023 01:01:38.703 * Connecting to MASTER 127.0.0.1:6379
20932:S 20 Mar 2023 01:01:38.704 * MASTER <-> REPLICA sync started
20932:S 20 Mar 2023 01:01:38.704 # Error condition on socket for SYNC: Connection refused
when I reboot the master instance, they all work fine.
When I shutdown the master instance, the Sentinel cluster start failover and elect a new master. But they just log "+sdown master mymaster 127.0.0.1 6379"
, not to elect a new master as I expect.