redis 哨兵不认主人也不认自己

zu0ti5jz  于 2023-11-16  发布在  Redis
关注(0)|答案(3)|浏览(167)

我在127.0.0.1:637963806381的3个示例之间建立了主从关系。
所有的sentinel和sentinel都运行在同一个IP上,不同的端口。我已经设置了3个sentinel(127.0.0.1:26379,26380,26381),配置如下:

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

字符串
26381端口

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


为了进一步解释我的设置,我只是试图在我的本地机器上测试sentinel是否可以响应master的手动关闭。查看sentinel master mymaster,结果是sentinel无法识别master和其他sentinel:

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"


我不能从配置文件中改变这个哨兵的行为。有没有办法哨兵可以互相交谈,并认识我的主人?

iaqfqrcu

iaqfqrcu1#

我首先要检查的是主人是否需要认证。如果需要,你需要设置。一旦成功,其他一切都将到位,因为哨兵将通过主人发现其他人,而奴隶将以同样的方式被检测到,

c2e8gylq

c2e8gylq2#

在一个很小的机会,任何人都难在我一直有问题:
第一个月
有帮助。

dvtswwa3

dvtswwa33#

我有一个类似的问题:我设置了Sentinel.conf如下:

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

字符串
当在redis-blog-p 26379上命令'sentinel master mymaster'时,它说master断开连接:

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


在sentinel.conf中放置下面的配置不起作用:

sentinel known-sentinel 192.168.111.123 26379
sentinel known-slave 192.168.111.124 26379
sentinel known-slave 192.168.111.125 26379

相关问题