[ERR] Node xxxxx is not empty. Either the node already knows other nodes (check with CLUSTER NODES)

问题示例:

执行创建redis集群命令时,

# 我这里ip都是172.17.0.1是因为我这里的redis节点都是docker容器,每个容器都已经映射到了主机172.17.0.1的不同端口
redis-cli --cluster create 172.17.0.1:6391 172.17.0.1:6392 172.17.0.1:6393 172.17.0.1:6394 172.17.0.1:6395 172.17.0.1:6396 --cluster-replicas 1

报错:

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

解决办法:

  • 1.停止所有redis进程(我集群节点是 docker-compose 创建的,所以只需要docker-compose down即可)
  • 2.将每个节点对应的.aof,.rdb .conf 文件删除,(注意:启动配置文件也是.conf后缀,请不要误删),具体文件对应位置需要查看每一个redis节点的启动配置文件的配置项,如我的集群配置文件:
dbfilename dump-6379.rdb
appendfilename "appendonly_6379.aof"
cluster-config-file "cluster/nodes-6379.conf"
  • 3.启动redis进程(.我集群节点是 docker-compose 创建的,所以只需要docker-compose -d up即可),并重新创建集群
redis-cli --cluster create 172.17.0.1:6391 172.17.0.1:6392 172.17.0.1:6393 172.17.0.1:6394 172.17.0.1:6395 172.17.0.1:6396 --cluster-replicas 1

参考文章:

1.
标题:[ERR] Node xxxxx is not empty. Either the node already knows other nodes (check with CLUSTER NODES)
地址:https://cloud.tencent.com/developer/article/1351139
2.
标题:[ERR] Node 172.168.63.202:7001 is not empty. Either the nodealready knows other nodes (check with CLUSTER NODES) or contains some
地址:https://www.cnblogs.com/huxinga/p/6644226.html

你可能感兴趣的:(Redis集群,Linux,Docker,redis,redis集群,redis-cli报错,is,not,empty)