首页 技术 正文
技术 2022年11月21日
0 收藏 376 点赞 3,990 浏览 1759 个字

服务器重启后,集群报错:

[root@SHH-HQ-NHS11S nhsuser]# redis-cli -c -h ip -p 7000
ip:7000> set cc dd
(error) CLUSTERDOWN Hash slot not served

检查集群节点情况

> cluster nodes
c0767666bee76e5e0dc67f24031a3e1b574235cc :7000@17000 myself,master – 0 0 0 connected

发现集群的节点只剩一个,其余节点都不见了。

将集群节点加入:

# redis-cli --cluster add-node ip: ip:
>>> Adding node ip: to cluster ip:
>>> Performing Cluster Check (using node ip:)
M: c0767666bee76e5e0dc67f24031a3e1b574235cc ip:
slots: ( slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[ERR] Not all slots are covered by nodes.

这个往往是由于主node移除了,但是并没有移除node上面的slot,从而导致了slot总数没有达到16384,其实也就是slots分布不正确。所以在删除节点的时候一定要注意删除的是否是Master主节点。现在这样情况,我们先修复集群:

# redis-cli --cluster fix IP:7000

>>> Covering slot 9675 with ip:7000

有点久,稍等下
然后检查修复情况:
# redis-cli --cluster check ip:
ip: (c0767666...) -> keys | slots | slaves.
[OK] keys in masters.
0.00 keys per slot on average.
>>> Performing Cluster Check (using node ip:)
M: c0767666bee76e5e0dc67f24031a3e1b574235cc IP:
slots:[-] ( slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All slots covered.

将节点加入集群:

[root@SHH-HQ-NHS11S nhsuser]# redis-cli --cluster add-node ip: ip:
>>> Adding node ip: to cluster ip:
>>> Performing Cluster Check (using node ip:)
M: c0767666bee76e5e0dc67f24031a3e1b574235cc ip:
slots:[-] ( slots) master
M: a98432e520af41117f5d8a81e2c0e2a430940c7e ip:
slots: ( slots) master
M: 2ff0c7ee051e26f484b6826d6aa8a5a3fbc93d17 ip:
slots: ( slots) master
M: 26bf8ce786d7c9d0bbb9d9d78978497f86fbbe0a ip:
slots: ( slots) master
M: 0a7718d2c53a16debdbfb391a7acd23a50a05faa ip:
slots: ( slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All slots covered.
>>> Send CLUSTER MEET to node ip: to make it join the cluster.
[OK] New node added correctly.

测试一把:

[root@SHH-HQ-NHS11S nhsuser]# redis-cli -c -h IP -p
IP:> set aa dd
OK
IP:> get aa
"dd"
IP:>

    					
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,557
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898