我在我的环境中使用Redis-Sentinel体系结构。我有3个不同的服务器。我安装并配置了redis和哨兵这两个。基本上我有3个redis和3个哨兵在3个服务器上同时运行。所有服务器都在Centos 7上运行。我正在使用Redis 4.0.10。没有任何网络限制。我禁用了selinux和防火墙。看起来不错,但是当我在我的主计算机上停止我的主Redis进程时,我遇到了故障转移问题。
我的主计算机IP是:10.0.23.242
从站1:10.0.23.243
从站2:10.0.23.244
[root@ibs23redistest1 redis]# redis-cli -h 10.0.23.242 -p 26379
10.0.23.242:26379> sentinel masters
1) "name"
2) "redis-cluster"
3) "ip"
4) "10.0.23.242"
5) "port"
6) "6379"
7) "runid"
8) "07b11d5e7cd7aa6efeb6d40a2371f5533529e308"
9) "flags"
10) "master"
11) "link-pending-commands"
12) "0"
13) "link-refcount"
14) "1"
15) "last-ping-sent"
16) "0"
17) "last-ok-ping-reply"
18) "1019"
19) "last-ping-reply"
20) "1019"
21) "down-after-milliseconds"
22) "5000"
23) "info-refresh"
24) "7950"
25) "role-reported"
26) "master"
27) "role-reported-time"
28) "258002"
29) "config-epoch"
30) "0"
31) "num-slaves"
32) "2"
33) "num-other-sentinels"
34) "2"
35) "quorum"
36) "2"
37) "failover-timeout"
38) "10000"
39) "parallel-syncs"
40) "1"
My configs are below
-------------- Master redis.conf --------------
bind 10.0.23.242
port 6379
dir .
-------------- Master sentinel.conf --------------
bind 10.0.23.242
#daemonize yes
port 26379
sentinel myid 68c0aadd673285fcfd87838e0ce4f14e90617371
sentinel monitor redis-cluster 10.0.23.242 6379 2
sentinel down-after-milliseconds redis-cluster 5000
sentinel failover-timeout redis-cluster 10000
sentinel config-epoch redis-cluster 0
#sentinel logfile /var/log/redis-sentinel.log
# Generated by CONFIG REWRITE
dir "/etc/redis"
sentinel leader-epoch redis-cluster 0
sentinel known-slave redis-cluster 10.0.23.244 6379
sentinel known-slave redis-cluster 10.0.23.243 6379
sentinel known-sentinel redis-cluster 10.0.23.243 26379 58051360cb3a05b3cc5b2b093041ce8d11555598
sentinel known-sentinel redis-cluster 10.0.23.244 26379 6056478d3dbd7a370e297c055ba66193a91f32ba
sentinel current-epoch 0
-------------- Slave 2 redis.conf --------------
bind 10.0.23.244
port 6379
dir .
slaveof 10.0.23.242 6379
-------------- Slave 2 sentinel.conf --------------
bind 10.0.23.244
port 26379
sentinel myid 6056478d3dbd7a370e297c055ba66193a91f32ba
sentinel monitor redis-cluster 10.0.23.244 6379 2
sentinel down-after-milliseconds redis-cluster 5000
sentinel failover-timeout redis-cluster 10000
sentinel config-epoch redis-cluster 0
# Generated by CONFIG REWRITE
dir "/root"
sentinel leader-epoch redis-cluster 0
sentinel known-sentinel redis-cluster 10.0.23.242 26379 68c0aadd673285fcfd87838e0ce4f14e90617371
sentinel current-epoch 0
-------------- Slave 1 redis.conf --------------
bind 10.0.23.243
port 6379
dir .
slaveof 10.0.23.242 6379
-------------- Slave 1 sentinel.conf --------------
bind 10.0.23.243
port 26379
sentinel myid 58051360cb3a05b3cc5b2b093041ce8d11555598
sentinel monitor redis-cluster 10.0.23.243 6379 2
sentinel down-after-milliseconds redis-cluster 5000
sentinel failover-timeout redis-cluster 10000
sentinel config-epoch redis-cluster 0
# Generated by CONFIG REWRITE
dir "/root"
sentinel leader-epoch redis-cluster 0
sentinel known-sentinel redis-cluster 10.0.23.242 26379 68c0aadd673285fcfd87838e0ce4f14e90617371
sentinel current-epoch 0
答案 0 :(得分:0)
您的从属哨兵都应监视主IP,而不是自己的IP。
sentinel monitor redis-cluster 10.0.23.242 6379 2
两个奴隶。
您有sentinel.conf
供从属监视自己的IP,因此我认为他们不会自动进行故障转移。