(error) CLUSTERDOWN Hash slot not served

版权声明:如笔记。一点一滴,伴我成长。可转载 https://blog.csdn.net/Butterfly_resting/article/details/82084426

创建Redis集群命令如下:

./redis-trib.rb create --replicas 1 192.168.179.128:7001 192.168.179.128:7002 192.168.179.128:7003 192.168.179.128:7004 192.168.179.128:7005 192.168.179.128:7006

由于手贱未正常操作,导致在后面查看集群是否创建成功时(cluster nodes),只显示了一个master连接。

>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.179.128:7001
192.168.179.128:7002
192.168.179.128:7003
Adding replica 192.168.179.128:7004 to 192.168.179.128:7001
Adding replica 192.168.179.128:7005 to 192.168.179.128:7002
Adding replica 192.168.179.128:7006 to 192.168.179.128:7003
M: 5ae627ca508f5c4ae51d28358cb87b40a7f5d3f2 192.168.179.128:7001
   slots:0-5460 (5461 slots) master
M: f6f85dbde5024e2839068334afa568f18362b163 192.168.179.128:7002
   slots:5461-10922 (5462 slots) master
M: fd9bbecffd39e247263c9b26a443fbf051f6aaa8 192.168.179.128:7003
   slots:10923-16383 (5461 slots) master
S: 1a467b7e898dca6adcb4cc2ebc8e7ab36ad6d90e 192.168.179.128:7004
   replicates 5ae627ca508f5c4ae51d28358cb87b40a7f5d3f2
S: 9037f35bd160fc39fea530d6ba142c8f5c42602c 192.168.179.128:7005
   replicates f6f85dbde5024e2839068334afa568f18362b163
S: 3b767ca399bab27c8a7f04a6b2b39193710b10e7 192.168.179.128:7006
   replicates fd9bbecffd39e247263c9b26a443fbf051f6aaa8
Can I set the above configuration? (type 'yes' to accept): yew^Hs^H^H^H
*** Aborting...
[root@localhost src]# /usr/local/redis/bin/redis-cli -c -h 192.168.179.128 -p7001
Unrecognized option or bad number of args for: '-p7001'
[root@localhost src]# /usr/local/redis/bin/redis-cli -c -h 192.168.179.128 -p 7001
192.168.179.128:7001> cluster nodes
5ae627ca508f5c4ae51d28358cb87b40a7f5d3f2 :7001 myself,master - 0 0 0 connected
192.168.179.128:7001> set name huang
(error) CLUSTERDOWN Hash slot not served


-----------------------------------------------

192.168.179.128:7001> cluster nodes
f6f85dbde5024e2839068334afa568f18362b163 :7002 myself,master - 0 0 0 connected

解决办法:

重新创建集群。如下步选择yes十分关键,创建时必须Assign a different config epoch to each node

Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join......
>>> Performing Cluster Check (using node 192.168.179.128:7001)
M: 5ae627ca508f5c4ae51d28358cb87b40a7f5d3f2 192.168.179.128:7001
   slots:0-5460 (5461 slots) master
   1 additional replica(s)

结果:

192.168.179.128:7004> get name
-> Redirected to slot [5798] located at 192.168.179.128:7002
"kei"

猜你喜欢

转载自blog.csdn.net/Butterfly_resting/article/details/82084426