Either the node already knows other nodes check with CLUSTER NODES or contains some key in databas
- 介绍
- 遇到的问题
- 解决方法
- 创建Redis集群
介绍
使用redis-trib.rb创建群集时报错
[ERR] Node 10.3.139.223:8001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
遇到的问题
修改redis.conf后,重新执行每个redis.conf,最后再创建集群,但报错
redis-trib.rb create --replicas 1 192.168.100.10:8001 192.168.100.10:8002 \
192.168.100.11:8001 192.168.100.11:8002 \
192.168.100.12:8001 192.168.100.12:8002
>>> Creating cluster
[ERR] Node 10.3.139.223:8001 is not empty. Either the node already knows other nodes
(check with CLUSTER NODES) or contains some key in database 0.
解决方法
停止每个节点上的redis服务
pkill redis
删除data文件夹中的文件
rm /data/redis/data/* -f
启动每个节点上的redis服务
redis-server /data/redis/conf/redis-8001.conf
redis-server /data/redis/conf/redis-8002.conf
创建Redis集群
redis-trib.rb create --replicas 1 192.168.100.10:8001 192.168.100.10:8002 \
192.168.100.11:8001 192.168.100.11:8002 \
192.168.100.12:8001 192.168.100.12:8002
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.100.10:8001
192.168.100.11:8001
192.168.100.12:8001
Adding replica 192.168.100.11:8002 to 192.168.100.10:8001
Adding replica 192.168.100.11:8002 to 192.168.100.11:8001
Adding replica 192.168.100.10:8002 to 192.168.100.12:8001
M: 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c 192.168.100.10:8001
slots:0-5460 (5461 slots) master
S: 5a3c23ee70ee1a77aabb33e93b59611aa48790e1 192.168.100.10:8002
replicates fdc7022e98e9619a9dd4574501f3648627d58c38
M: 71663ec6304e762565cd73512bef7a7e4f764235 192.168.100.11:8001
slots:5461-10922 (5462 slots) master
S: 0ac27a24f78ff7d3e5b4fff8c97ad4a09700d930 192.168.100.11:8002
replicates 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c
M: fdc7022e98e9619a9dd4574501f3648627d58c38 192.168.100.12:8001
slots:10923-16383 (5461 slots) master
S: 4a0a20b6c6c925e582997be447848edeee9e8456 192.168.100.11:8002
replicates 71663ec6304e762565cd73512bef7a7e4f764235
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.100.10:8001)
M: 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c 192.168.100.10:8001
slots:0-5460 (5461 slots) master
1 additional replica(s)
S: 4a0a20b6c6c925e582997be447848edeee9e8456 192.168.100.11:8002
slots: (0 slots) slave
replicates 71663ec6304e762565cd73512bef7a7e4f764235
S: 0ac27a24f78ff7d3e5b4fff8c97ad4a09700d930 192.168.100.11:8002
slots: (0 slots) slave
replicates 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c
M: fdc7022e98e9619a9dd4574501f3648627d58c38 192.168.100.12:8001
slots:10923-16383 (5461 slots) master
1 additional replica(s)
M: 71663ec6304e762565cd73512bef7a7e4f764235 192.168.100.11:8001
slots:5461-10922 (5462 slots) master
1 additional replica(s)
S: 5a3c23ee70ee1a77aabb33e93b59611aa48790e1 192.168.100.10:8002
slots: (0 slots) slave
replicates fdc7022e98e9619a9dd4574501f3648627d58c38
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
创建集群成功
CSDN_码404:Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in databas 全文
https://www.code404.icu/1499.html
