问题描述:
Redis搭建三主三从集群架构,起初读写均没有问题,但是主动将一个主节点停掉后,主从没有切换。请各位路过的哥哥姐姐帮忙看下是怎么回事,小弟刚接触Redis,对于这个问题,无从下手,小弟感谢各位了。
环境:
Redis5.0.5,Centos6
三主三从信息
>>> Performing hash slots allocation on 6 nodes... Master[0] -> Slots 0 - 5460 Master[1] -> Slots 5461 - 10922 Master[2] -> Slots 10923 - 16383 Adding replica 192.168.2.75:6379 to 192.168.2.71:6379 Adding replica 192.168.2.76:6379 to 192.168.2.72:6379 Adding replica 192.168.2.74:6379 to 192.168.2.73:6379 M: 2a5fa57157d4c2b43629f78942b3ec0305f57ba9 192.168.2.71:6379 slots:[0-5460] (5461 slots) master M: acd2a3854732506858b015e4d9048450ab512e0a 192.168.2.72:6379 slots:[5461-10922] (5462 slots) master M: 334d875ad8ca3663feb22d2775d96854f962c81a 192.168.2.73:6379 slots:[10923-16383] (5461 slots) master S: 196dd8c746c6b057c7c37be57d00cd9d396366b6 192.168.2.74:6379 replicates 334d875ad8ca3663feb22d2775d96854f962c81a S: 2a2b0de71889d8c467fb5e006660f477ccf33eeb 192.168.2.75:6379 replicates 2a5fa57157d4c2b43629f78942b3ec0305f57ba9 S: 58d35bdf869b02001564daf426f54cfd3e2634db 192.168.2.76:6379 replicates acd2a3854732506858b015e4d9048450ab512e0a Can I set the above configuration? (type 'yes' to accept): yes
发生的现象:
196dd8c746c6b057c7c37be57d00cd9d396366b6 192.168.2.74:6379@16379 slave 334d875ad8ca3663feb22d2775d96854f962c81a 0 1591350576714 4 connected 334d875ad8ca3663feb22d2775d96854f962c81a 192.168.2.73:6379@16379 master - 0 1591350576000 3 connected 10923-16383 58d35bdf869b02001564daf426f54cfd3e2634db 192.168.2.76:6379@16379 slave acd2a3854732506858b015e4d9048450ab512e0a 0 1591350575000 6 connected 2a5fa57157d4c2b43629f78942b3ec0305f57ba9 192.168.2.71:6379@16379 master,fail - 1591350570681 1591350569000 1 disconnected 0-5460 acd2a3854732506858b015e4d9048450ab512e0a 192.168.2.72:6379@16379 master - 0 1591350576614 2 connected 5461-10922 2a2b0de71889d8c467fb5e006660f477ccf33eeb 192.168.2.75:6379@16379 myself,slave 2a5fa57157d4c2b43629f78942b3ec0305f57ba9 0 1591350575000 5 connected
报一个警告【WARNING: 192.168.2.75:6379 claims to be slave of unknown node ID 2a5fa57157d4c2b43629f78942b3ec0305f57ba9.】
报一个错误【[ERR] Not all 16384 slots are covered by nodes.】
执行get命令,报一个错误【(error) CLUSTERDOWN The cluster is down】
总结:
只要设置了密码,那么每台节点的密码都需要一致,且masterauth必须要配置,因为每一个节点都有成为master的可能性。
说的很nice
问题解决了,原因出在了密码上:没台节点都配置了密码,但masterauth没有配置,增加了masterauth 配置后,就没有任何问题了。
– mesen 4年前