当前位置: 首页 > article >正文

CLUSTERDOWN Hash slot not served问题复现

1、一主两从,

172.31.4.18:6381> cluster nodes
f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 172.31.4.20:6383@16383 master - 0 1726278342891 10 connected 5461-10922
9a79febbfb1d7a8f7a6ba3fb11e86b0f122f71e7 172.31.4.21:6386@16386 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726278344894 2 connected
23bb415a72cf125c8205be6b1de4f8f5a0a636c8 172.31.4.18:6381@16381 myself,master - 0 1726278336000 1 connected 0-5460
602fbfe65cf83178c0b897441013ec0bae590c96 172.31.4.20:6385@16385 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726278341890 2 connected
3dec7d5dd8139854f766417611026b07785c0a76 172.31.4.19:6382@16382 slave 23bb415a72cf125c8205be6b1de4f8f5a0a636c8 0 1726278342000 1 connected
83d609a16f5fc2605ff8fd698197533c6ad29334 172.31.4.18:6383@16383 master - 0 1726278343000 9 connected
401730ba6e1c2cd8b60243990f0965606edfc083 172.31.4.18:6385@16385 master - 0 1726278343000 2 connected 10923-16383
4e25e8f87029a22bbba7aa5f6fb2edba4a342da5 172.31.4.21:6384@16384 slave f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 0 1726278343892 10 connected
172.31.4.18:6381> exit

2、从172.31.4.22上发4个并发

redis-benchmark -h 172.31.4.18 -p 6383 -a Redis_6.2.1_Sc -t set,get -e -c 4 -d 1 -n 100000000000000

[cpcn@redis01 redis6383]$ netstat -anltp |grep 4.22
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0     31 172.31.4.18:6383        172.31.4.22:54100       ESTABLISHED 30548/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54098       ESTABLISHED 30548/redis-server  
tcp        0      7 172.31.4.18:6385        172.27.16.58:4422       ESTABLISHED 30559/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54102       ESTABLISHED 30548/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54096       ESTABLISHED 30548/redis-server  
tcp        0      0 172.31.4.18:16383       172.31.4.21:46224       ESTABLISHED 30548/redis-server  

3、172.31.4.18 6383 切为从,老链接还在:

172.31.4.18:6383> cluster failover takeover
OK
172.31.4.18:6383> cluster nodes
83d609a16f5fc2605ff8fd698197533c6ad29334 172.31.4.18:6383@16383 myself,slave f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 0 1726278372000 10 connected
401730ba6e1c2cd8b60243990f0965606edfc083 172.31.4.18:6385@16385 master - 0 1726278374588 2 connected 10923-16383
4e25e8f87029a22bbba7aa5f6fb2edba4a342da5 172.31.4.21:6384@16384 slave f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 0 1726278373587 10 connected
f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 172.31.4.20:6383@16383 master - 0 1726278372840 10 connected 5461-10922
23bb415a72cf125c8205be6b1de4f8f5a0a636c8 172.31.4.18:6381@16381 master - 0 1726278371000 1 connected 0-5460
9a79febbfb1d7a8f7a6ba3fb11e86b0f122f71e7 172.31.4.21:6386@16386 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726278369000 2 connected
602fbfe65cf83178c0b897441013ec0bae590c96 172.31.4.20:6385@16385 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726278371000 2 connected
3dec7d5dd8139854f766417611026b07785c0a76 172.31.4.19:6382@16382 slave 23bb415a72cf125c8205be6b1de4f8f5a0a636c8 0 1726278370582 1 connected
172.31.4.18:6383> 

4、将 172.31.4.18 6383 下线,该进程还在,老链接还在。

[cpcn@redis01 redis6381]$ ./bin/redis-cli -a Redis_6.2.1_Sc --cluster del-node 172.31.4.18:6383 83d609a16f5fc2605ff8fd698197533c6ad29334
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Removing node 83d609a16f5fc2605ff8fd698197533c6ad29334 from cluster 172.31.4.18:6383
>>> Sending CLUSTER FORGET messages to the cluster...
>>> Sending CLUSTER RESET SOFT to the deleted node.

[cpcn@redis01 redis6383]$ ps -ef |grep redis
avahi     1161     1  0 Sep12 ?        00:00:00 avahi-daemon: running [redis01.local]
cpcn     30529     1  7 09:07 ?        00:03:50 /usr/local/redis6381/bin/redis-server 172.31.4.18:6381 [cluster]
cpcn     30559     1  8 09:07 ?        00:03:57 /usr/local/redis6385/bin/redis-server 172.31.4.18:6385 [cluster]
cpcn     31308     1  0 09:57 ?        00:00:00 /usr/local/redis6383/bin/redis-server 172.31.4.18:6383 [cluster]
cpcn     31314 29933  0 09:57 pts/1    00:00:00 grep --color=auto redis

[cpcn@redis01 redis6383]$ netstat -anltp |grep 4.22
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0     31 172.31.4.18:6383        172.31.4.22:54100       ESTABLISHED 30548/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54098       ESTABLISHED 30548/redis-server  
tcp        0      7 172.31.4.18:6385        172.27.16.58:4422       ESTABLISHED 30559/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54102       ESTABLISHED 30548/redis-server  
tcp        0     31 172.31.4.18:6383        172.31.4.22:54096       ESTABLISHED 30548/redis-server  
tcp        0      0 172.31.4.18:16383       172.31.4.21:46224       ESTABLISHED 30548/redis-server  


172.31.4.18:6383> cluster nodes
83d609a16f5fc2605ff8fd698197533c6ad29334 172.31.4.18:6383@16383 myself,master - 0 1726278605000 11 connected
172.31.4.18:6383> 

5、下线 172.31.4.18 6383 集群信息:

172.31.4.20:6383> cluster nodes
401730ba6e1c2cd8b60243990f0965606edfc083 172.31.4.18:6385@16385 master - 0 1726277099000 2 connected 10923-16383
4e25e8f87029a22bbba7aa5f6fb2edba4a342da5 172.31.4.21:6384@16384 slave f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 0 1726277098872 8 connected
23bb415a72cf125c8205be6b1de4f8f5a0a636c8 172.31.4.18:6381@16381 master - 0 1726277099874 1 connected 0-5460
602fbfe65cf83178c0b897441013ec0bae590c96 172.31.4.20:6385@16385 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726277098000 2 connected
9a79febbfb1d7a8f7a6ba3fb11e86b0f122f71e7 172.31.4.21:6386@16386 slave 401730ba6e1c2cd8b60243990f0965606edfc083 0 1726277097871 2 connected
f5e774bd5cd8f5bcba53f1297015f3245dd3f18c 172.31.4.20:6383@16383 myself,master - 0 1726277096000 8 connected 5461-10922
3dec7d5dd8139854f766417611026b07785c0a76 172.31.4.19:6382@16382 slave 23bb415a72cf125c8205be6b1de4f8f5a0a636c8 0 1726277097000 1 connected
172.31.4.20:6383> 

此时的状态,下线172.31.4.18 6383,该进程还在,老链接还在。172.31.4.22上并发过的链接 报槽位错误:

Error from server: CLUSTERDOWN Hash slot not served(overall: 0.244)
Error from server: CLUSTERDOWN Hash slot not served(overall: 0.244)
Error from server: CLUSTERDOWN Hash slot not served(overall: 0.244)

6、解决的办法,是尽快关闭下线的 redis 进程:

172.31.4.18:6383> cluster nodes
83d609a16f5fc2605ff8fd698197533c6ad29334 172.31.4.18:6383@16383 myself,master - 0 1726278605000 11 connected
172.31.4.18:6383> 
172.31.4.18:6383> 
172.31.4.18:6383> shutdown
not connected> exit
[cpcn@redis01 redis6383]$ 
[cpcn@redis01 redis6383]$ 
[cpcn@redis01 redis6383]$ ps -ef |grep redis
avahi     1161     1  0 Sep12 ?        00:00:00 avahi-daemon: running [redis01.local]
cpcn     30529     1  7 09:07 ?        00:03:49 /usr/local/redis6381/bin/redis-server 172.31.4.18:6381 [cluster]
cpcn     30559     1  8 09:07 ?        00:03:56 /usr/local/redis6385/bin/redis-server 172.31.4.18:6385 [cluster]
cpcn     31302 29933  0 09:57 pts/1    00:00:00 grep --color=auto redis

此时172.31.4.22上并发过的链接中断,4.22上的redis-benchmark进程中断,报:

报:

Error from server: CLUSTERDOWN Hash slot not served(overall: 0.237)
Error: Server closed the connection avg_msec=0.240 (overall: 0.238)
[cpcn@redis003 bin]$ 

[cpcn@redis003 bin]$ 
[cpcn@redis003 bin]$ ps -ef |grep redis
cpcn      67809  67655  0 10:08 pts/0    00:00:00 grep --color=auto redis
[cpcn@redis003 bin]$ 

7附:连接日志:

[cpcn@redis003 bin]$ redis-benchmark -h 172.31.4.18 -p 6383 -a Redis_6.2.1_Sc -t set,get -e -c 4 -d 1 -n 100000000000000
Error from server: MOVED 13782 172.31.4.18:6385rall: -nan)
Error from server: MOVED 13782 172.31.4.18:6385
Error from server: MOVED 13782 172.31.4.18:6385242 (overall: 0.226)

http://www.kler.cn/a/304093.html

相关文章:

  • 算法训练(leetcode)二刷第二十三天 | 455. 分发饼干、*376. 摆动序列、53. 最大子数组和
  • JavaScript数组去重的实用方法汇总
  • LFD STM32编程规范20241111
  • Android Studio打包时不显示“Generate Signed APK”提示信息
  • shell--dpkg
  • 泷羽sec学习打卡-Windows基础命令2总结篇
  • react 事件处理
  • 前端——标签二(超链接)
  • Linux中的简单命令2
  • 场外期权合法吗?
  • 如何在vim中批量注释和取消注释
  • 【秋招笔试】9.09阿里国际秋招(已改编)-三语言题解
  • Go语言 管道1
  • 基于单片机的仔猪喂饲系统设计
  • vue原理分析(八)研究new Vue()中的initProxy
  • 集群聊天服务器项目【C++】(二)Json的简单使用
  • C++笔记---list
  • [QT] QT事件与事件重写
  • Spring扩展点系列-SmartInstantiationAwareBeanPostProcessor
  • 通过策略模式实现对象创建工厂
  • QMainWindow,调用exec()实现QDialog阻塞效果
  • HTTPS和HTTP区别是什么?
  • 【Python机器学习】循环神经网络(RNN)——利用Keras实现循环神经网络
  • 【XR】AR HUD
  • 交换机vlan配置实现
  • Java、python、php三个版本 抗震救灾物资管理系统 抗洪救灾物资分配系统 救援物资申请平台(源码、调试、LW、开题、PPT)