记一次Redis Sentinel配置失败过程

Redis Version:4.0.10、4.0.11

Deploy Node:3 sentinel、1 master、2 slave

启动顺序:先启动master,然后slave,最后启动sentinel


sentinel.conf    #按照redis官网配置

port 30001

daemonize yes

loglevel notice

dir "/home/work/redis_setinel_test/tmp"

logfile "/home/work/redis_setinel_test/30001.log"

sentinel monitor redis-config-1 127.0.0.1 6666 2

sentinel down-after-milliseconds redis-config-1 5000

sentinel failover-timeout redis-config-1 60000


redis6666.conf

port 6666

daemonize yes

pidfile "/home/work/redis_setinel_test/6666.pid"

tcp-backlog 511

timeout 0

tcp-keepalive 0

loglevel notice

logfile "/home/work/redis_setinel_test/6666.log"

databases 16

save 3600 1

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename "dump.rdb"

dir "/home/work/redis_setinel_test/db"

slave-serve-stale-data yes

slave-read-only yes

repl-diskless-sync no

repl-diskless-sync-delay 5

repl-timeout 60

repl-disable-tcp-nodelay no

repl-backlog-size 10mb

repl-backlog-ttl 3600

slave-priority 100

# requirepass foobared

rename-command CONFIG _CONFIG

rename-command FLUSHALL ""

maxclients 20000

maxmemory 14gb

maxmemory-policy allkeys-lru

appendonly no

appendfilename "appendonly.aof"

appendfsync everysec

no-appendfsync-on-rewrite yes

auto-aof-rewrite-percentage 80

auto-aof-rewrite-min-size 128mb

aof-load-truncated yes

aof-rewrite-incremental-fsync yes

lua-time-limit 5000

#REDIS CLUSTER

cluster-enabled no

cluster-config-file "nodes.conf"

cluster-node-timeout 15000

cluster-migration-barrier 1

cluster-require-full-coverage no

slowlog-log-slower-than 10000

slowlog-max-len 128

latency-monitor-threshold 0

hash-max-ziplist-entries 512

hash-max-ziplist-value 64

list-max-ziplist-entries 512

list-max-ziplist-value 64

set-max-intset-entries 512

zset-max-ziplist-entries 128

zset-max-ziplist-value 64

hll-sparse-max-bytes 3000

activerehashing yes

client-output-buffer-limit normal 0 0 0

client-output-buffer-limit slave 1gb 256mb 600

client-output-buffer-limit pubsub 32mb 8mb 60

hz 10


sentinel日志报错:

31307:X 31 Oct 20:23:40.307 # +sdown master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:23:40.399 # +new-epoch 1

31307:X 31 Oct 20:23:40.399 # +vote-for-leader 36b0a741a9288f4ff5e26441c748a82e0b476e5e 1

31307:X 31 Oct 20:23:41.397 # +odown master redis-config-1 127.0.0.1 6666 #quorum 3/2

31307:X 31 Oct 20:23:41.397 # Next failover delay: I will not start a failover before Wed Oct 31 20:25:41 2018

31307:X 31 Oct 20:25:40.546 # +new-epoch 2

31307:X 31 Oct 20:25:40.546 # +vote-for-leader 36b0a741a9288f4ff5e26441c748a82e0b476e5e 2

31307:X 31 Oct 20:25:40.607 # Next failover delay: I will not start a failover before Wed Oct 31 20:27:40 2018

31307:X 31 Oct 20:27:40.592 # +new-epoch 3

31307:X 31 Oct 20:27:40.592 # +try-failover master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:27:40.592 # +vote-for-leader 4e0d6414c879007e3b55e8517bd9c319a9ae6da5 3

31307:X 31 Oct 20:27:40.593 # 36b0a741a9288f4ff5e26441c748a82e0b476e5e voted for 4e0d6414c879007e3b55e8517bd9c319a9ae6d

a5 3

31307:X 31 Oct 20:27:40.593 # d7cd4ee54fcc63cf3b0419daa065c836b4d56634 voted for 4e0d6414c879007e3b55e8517bd9c319a9ae6d

a5 3

31307:X 31 Oct 20:27:40.654 # +elected-leader master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:27:40.654 # +failover-state-select-slave master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:27:40.721 # +selected-slave slave 127.0.0.1:6667 127.0.0.1 6667 @ redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:27:40.721 * +failover-state-send-slaveof-noone slave 127.0.0.1:6667 127.0.0.1 6667 @ redis-config-1 1

27.0.0.1 6666

31307:X 31 Oct 20:27:40.804 * +failover-state-wait-promotion slave 127.0.0.1:6667 127.0.0.1 6667 @ redis-config-1 127.0

.0.1 6666

31307:X 31 Oct 20:28:40.867 # -failover-abort-slave-timeout master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:28:40.957 # Next failover delay: I will not start a failover before Wed Oct 31 20:29:40 2018

31307:X 31 Oct 20:28:51.194 * +reboot master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:28:51.277 # -sdown master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:28:51.277 # -odown master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:30:02.674 # +sdown master redis-config-1 127.0.0.1 6666

31307:X 31 Oct 20:30:02.691 # +new-epoch 4

即master已经处于odown,但failover一直没发生切换,sentinel节点无法向redis节点发出slaveof no one命令。


尝试解决:

1. 更新redis版本,由4.0.10 --> 4.0.11

2. 在线下机器部署测试。

但都无法解决。


====================== 解决了 ======================

咳咳咳~ 去掉redis.conf 中rename-command 配置后,重启redis节点主从切换正常。

最重要的是 rename-command CONFIG _CONFIG 这个。


总结:前期测试sentinel/cluster 尽量不要改动默认配置,除了基本配置信息。

后期可以根据实际需要修改配置。

你可能感兴趣的:(记一次Redis Sentinel配置失败过程)