Проблема с конфигурацией аварийного переключения Redis Sentinel

Я использую архитектуру Redis-Sentinel в своей среде. У меня 3 разных сервера. Я установил и настроил Redis и Sentinel. В основном у меня есть три Redis и 3 Sentinels, работающие на 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

person cankaya07    schedule 25.07.2018    source источник
comment
аварийное переключение не происходит, когда вы останавливаете мастер? вы переименовали некоторые команды Redis   -  person Spock    schedule 26.07.2018
comment
no не переименовывал и не связывал никакую команду с Redis. Почему ты спрашиваешь?   -  person cankaya07    schedule 30.07.2018
comment
Оба ваших часовых должны следить за мастером, а не за собственным IP-адресом, верно? sentinel monitor redis-cluster 10.0.23.242 6379 2. У вас есть sentinel.conf для ведомых устройств, контролирующих свой собственный IP-адрес, поэтому я не думаю, что они автоматически перейдут на другой ресурс.   -  person scientific_explorer    schedule 20.11.2019


Ответы (1)


Оба ваших ведомых часовых должны контролировать главный IP-адрес, а не свой собственный IP-адрес.

sentinel monitor redis-cluster 10.0.23.242 6379 2 для обоих ведомых.

У вас есть sentinel.conf для ведомых устройств, контролирующих свой собственный IP-адрес, поэтому я не думаю, что они автоматически переключатся на другой ресурс.

person scientific_explorer    schedule 20.11.2019