Node XXX is not empty. Either the node already knows other nodes or contains some key in database 0

来源:互联网 发布:ezdsdpro软件下载 编辑:程序博客网 时间:2024/06/07 17:23

关于启动redis集群或者集群(主、从)节点添加时:[ERR] Node 192.168.1.115:7007 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.的问题

1.启动redis集群报该错误解决办法:
1)将每个节点下aof、rdb、nodes.conf本地备份文件删除;
[root@localhost 7001]# rm -rf appendonly.aof dump.rdb
……
2)192.168.1.115:7001> flushdb 清空当前数据库
3)重新连接redis集群,成功

[root@localhost redis-cluster]# vi startCluster.sh ./redis-trib.rb create --replicas l 192.168.1.115:7001 192.168.1.115:7002 192.168.1.115:7003 192.168.1.115:7004 192.168.1.115:7005 192.168.1.115:7006[root@localhost redis-cluster]# chmod 777 startCluster.sh [root@localhost redis-cluster]# ./startCluster.sh >>> Creating clusterConnecting to node 192.168.1.115:7001: OK>>> Performing hash slots allocation on 6 nodes...Using 3 masters:192.168.1.115:7001 192.168.1.115:7002 192.168.1.115:7003............................Can I set the above configuration? (type 'yes' to accept): yes..........................[OK] All nodes agree about slots configuration.>>> Check for open slots...>>> Check slots coverage...[OK] All 16384 slots covered.

这种情况发生在每次非正常关闭redis集群的时候

2.集群(主、从)节点添加报该错误解决办法:
错误原因:如果原来该结点在集群中的配置信息已经生成到cluster-config-file指定的配置文件中(如果cluster-config-file没有指定则默认为nodes.conf),这时可能会报错:
[ERR] Node XXXXXX is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0

解决方法:删除生成的配置文件nodes.conf,删除后再执行./redis-trib.rb add-node指令

阅读全文
0 0
原创粉丝点击