[ERR] Not all 16384 slots are covered by nodes.

本文介绍了一种解决Redis单节点集群无法启动的问题的方法。通过使用redis-trib.rb工具检查并修复集群状态,最终实现了所有16384个槽位的覆盖,确保集群正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

redis集群开不起来,用redis-cli连接的时候出现如下错误:

CLUSTERDOWN The cluster is down

然后使用redis-trib.rb检查:

./redis-trib.rb check 10.10.25.243:6379

出现如下错误:

Connecting to node 10.10.20.243:6379: OK

>>> Performing Cluster Check(using node 10.10.20.243:6379)

[OK] All nodes agree about slotsconfiguration.

>>> Check for open slots...

>>> Check slots coverage...

[ERR] Not all 16384 slots are covered by nodes.

因为我只有一个节点,单节点集群,所以使用如下方法来修复节点:

./redis-trib.rb fix 10.10.20.243:6379

之后输出如下:

.......
>>> Covering slot 16276 with 10.10.25.243:6379
>>> Covering slot 16277 with 10.10.25.243:6379
>>> Covering slot 16278 with 10.10.25.243:6379
>>> Covering slot 16279 with 10.10.25.243:6379
>>> Covering slot 16280 with 10.10.25.243:6379
>>> Covering slot 16281 with 10.10.25.243:6379
>>> Covering slot 16282 with 10.10.25.243:6379
>>> Covering slot 16283 with 10.10.25.243:6379
>>> Covering slot 16284 with 10.10.25.243:6379
>>> Covering slot 16285 with 10.10.25.243:6379
>>> Covering slot 16286 with 10.10.25.243:6379
>>> Covering slot 16287 with 10.10.25.243:6379
>>> Covering slot 16288 with 10.10.25.243:6379
>>> Covering slot 16289 with 10.10.25.243:6379
>>> Covering slot 16290 with 10.10.25.243:6379
>>> Covering slot 16291 with 10.10.25.243:6379
>>> Covering slot 16292 with 10.10.25.243:6379
>>> Covering slot 16293 with 10.10.25.243:6379
>>> Covering slot 16294 with 10.10.25.243:6379
>>> Covering slot 16295 with 10.10.25.243:6379
>>> Covering slot 16296 with 10.10.25.243:6379
>>> Covering slot 16297 with 10.10.25.243:6379
>>> Covering slot 16298 with 10.10.25.243:6379
>>> Covering slot 16299 with 10.10.25.243:6379
>>> Covering slot 16300 with 10.10.25.243:6379
>>> Covering slot 16301 with 10.10.25.243:6379
>>> Covering slot 16302 with 10.10.25.243:6379
>>> Covering slot 16303 with 10.10.25.243:6379
>>> Covering slot 16304 with 10.10.25.243:6379
>>> Covering slot 16305 with 10.10.25.243:6379
>>> Covering slot 16306 with 10.10.25.243:6379
........

然后再检查下集群的情况:

redis-trib.rb check 10.10.25.243:6379

输出如下:

>>> Performing Cluster Check (using node 10.10.25.243:6379)
M: 4df1b649c1d0d08c2fa2a55e13d8d95c6d4f2b22 10.10.25.243:6379
   slots:0-16383 (16384 slots) master
   0 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

检查下集群信息:

root@nick-VirtualBox:/home/nick/software/redis-3.2.8# redis-cli -h 10.10.25.243 -p 6379
10.10.25.243:6379> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:1
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0

 最后用redis-cli连下,正常了。可以连接,并且放入值和取出值也正常。

root@localhost:/data# redis-cli --cluster check 192.168.23.128:6381 192.168.23.128:6381 (5179e77c...) -> 1 keys | 5461 slots | 1 slaves. 192.168.23.128:6387 (2d3627a0...) -> 0 keys | 0 slots | 0 slaves. 192.168.23.128:6383 (717e40d4...) -> 1 keys | 5462 slots | 1 slaves. 192.168.23.128:6382 (914842ad...) -> 0 keys | 5461 slots | 1 slaves. [OK] 2 keys in 4 masters. 0.00 keys per slot on average. >>> Performing Cluster Check (using node 192.168.23.128:6381) M: 5179e77cd2af6a3237ab7066ec2663675d249b91 192.168.23.128:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) S: dc23983813d9995faaced72ef7a040a4f9def34c 192.168.23.128:6385 slots: (0 slots) slave replicates 5179e77cd2af6a3237ab7066ec2663675d249b91 M: 2d3627a079ca35457dbaf67bdf3db9dde1b57d45 192.168.23.128:6387 slots: (0 slots) master M: 717e40d46660a54c7c717447c3906ec79f13c482 192.168.23.128:6383 slots:[5461-6826],[12288-16383] (5462 slots) master 1 additional replica(s) M: 914842add6cb3726d9eeb018e7070b54fe8dae12 192.168.23.128:6382 slots:[6827-12287] (5461 slots) master 1 additional replica(s) S: b64fa925e9ceedffe7f767fe8ee41abc7b07a828 192.168.23.128:6384 slots: (0 slots) slave replicates 717e40d46660a54c7c717447c3906ec79f13c482 S: bb84473578437766401f5c46895a0d6fa04bb7e8 192.168.23.128:6386 slots: (0 slots) slave replicates 914842add6cb3726d9eeb018e7070b54fe8dae12 [ERR] Nodes don't agree about configuration! >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. 这个有错误吗
03-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值