Redis Server Cluster Not Working

走远了吗. 提交于 2020-02-21 06:27:04

问题


On src directory, i am running below command

/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

but getting below error.

Creating cluster [ERR] Sorry, can't connect to node 127.0.0.1:7000

However if i am starting the node at 7000 using command "redis-server redis.conf" where redis.conf is below

port 7000 cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 10 cluster-slave-validity-factor 0 appendonly yes

and simillarly i started redis in all ports succesfully.

Now when i am running

/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

i am getting another erorr.

Creating cluster [ERR] Node 127.0.0.1:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

please help.


回答1:


The first error is because redis-trib create attempts to connect to the redis instances while creating the cluster- however you do not have any redis instances running at 127.0.0.1:7000.

The second error looks like you started your redis instance, but now your cluster cannot be created because you already tried to create a cluster on node 7000 (Probably allocated slots to your node) before you got the first error message. To wipe the node clean, run

$redis-cli -p 7000
127.0.0.1:7000> flushall
127.0.0.1:7000> cluster reset
127.0.0.1:7000> exit

then your redis-trib create will work.



来源:https://stackoverflow.com/questions/37206993/redis-server-cluster-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!