sentinels do not recognize master nor themselves

3.6k views Asked by At

I have set up a master - slave - slave relationship among my 3 instances, at 127.0.0.1:6379, 6380, 6381.

Instances and sentinels all run on same IP, different ports. and I have set up 3 sentinels(127.0.0.1:26379,26380,26381) with following config:

sentinel monitor mymaster 127.0.0.1 6379 1
sentinel down-after-milliseconds mymaster 60000
sentinel failover-timeout mymaster 180000  
sentinel config-epoch mymaster 0
sentinel leader-epoch mymaster 53
sentinel parallel-syncs mymaster 1

port 26381

dir "/usr/local/Cellar/redis/3.0.2"
sentinel announce-ip 127.0.0.1
sentinel announce-port 26381

to explain my setup further, I am just trying to test on my local machine if sentinel can respond to manual shutdown of the master. Looking at the sentinel master mymaster, the result is that sentinel does not recognize the master nor the other sentinels:

127.0.0.1:26381> sentinel master mymaster
1) "name"
2) "mymaster"
3) "ip"
4) "127.0.0.1"
5) "port"
6) "6379"
7) "runid"
8) ""
9) "flags"
10) "s_down,o_down,master,disconnected"
11) "pending-commands"
12) "-1"
13) "last-ping-sent"
14) "479567"
15) "last-ok-ping-reply"
16) "479567"
17) "last-ping-reply"
18) "27895"
19) "s-down-time"
20) "419512"
21) "o-down-time" 
22) "419512"
23) "down-after-milliseconds"
24) "60000"
25) "info-refresh" 
26) "1435337950249"
27) "role-reported"
28) "master"
29) "role-reported-time"
30) "479567"
31) "config-epoch"
32) "0" 
33) "num-slaves"
34) "0"
35) "num-other-sentinels"
36) "0"
37) "quorum"
38) "1"
39) "failover-timeout"
40) "180000"
41) "parallel-syncs"
42) "1"

I am not able to change from the config file this sentinel behavior. Is there any way sentinels can talk to each other, and recognize my master?

3

There are 3 answers

0
The Real Bill On BEST ANSWER

First thing I would check is whether the master requires authentication. If so you need to set that. Once that works, everything else will fall into place as the sentinels will discover at other through the master and the slaves will be detected the same way,

2
gohuskies6842 On

I have a similar problem: I've setup Sentinel.conf like below:

Node 1:
sentinel announce-ip 192.168.111.123
sentinel announce-port 26379
sentinel monitor mymaster 192.168.111.123 6379 1
sentinel down-after-milliseconds mymaster 3000
sentinel failover-timeout mymaster 7000
sentinel parallel-syncs mymaster 1

Node 2:
sentinel announce-ip 192.168.111.124
sentinel announce-port 26379
sentinel monitor mymaster 192.168.111.123 6379 1
sentinel down-after-milliseconds mymaster 3000
sentinel failover-timeout mymaster 7000
sentinel parallel-syncs mymaster 1

Node 3:
sentinel announce-ip 192.168.111.125
sentinel announce-port 26379
sentinel monitor mymaster 192.168.111.123 6379 1
sentinel down-after-milliseconds mymaster 3000
sentinel failover-timeout mymaster 7000
sentinel parallel-syncs mymaster 1

when commanding 'sentinel master mymaster' on redis-cli -p 26379, it says master is disconnected:

10) "s_down,o_down,master,disconnected"

cat /var/log/redis/sentinel.log

8 17:50:11 2023
2894:X 18 Oct 2023 17:50:11.150 # +new-epoch 62
2894:X 18 Oct 2023 17:50:11.150 # +try-failover master mymaster 192.168.111.123 6379
2894:X 18 Oct 2023 17:50:11.153 # +vote-for-leader 11373850e9bf236f4fe541a77175120e17eb0cfb 62
2894:X 18 Oct 2023 17:50:11.153 # +elected-leader master mymaster 192.168.111.123 6379
2894:X 18 Oct 2023 17:50:11.153 # +failover-state-select-slave master mymaster 192.168.111.123 6379
2894:X 18 Oct 2023 17:50:11.211 # -failover-abort-no-good-slave master mymaster 192.168.111.123 6379
2894:X 18 Oct 2023 17:50:11.269 # Next failover delay: I will not start a failover before Wed Oct 18 
17:50:25 2023

putting below config in sentinel.conf doesn't work:

sentinel known-sentinel 192.168.111.123 26379
sentinel known-slave 192.168.111.124 26379
sentinel known-slave 192.168.111.125 26379
1
Joe Jung On

In a slim chance that anyone is stumped on problem I have been having:

sentinel known-sentinel 127.0.0.1 26379 sentinel known-sentinel 127.0.0.1 26380 sentinel known-slave 127.0.0.1 6380 sentinel known-slave 127.0.0.1 6381

helps.