当前位置:网站首页>Redis cluster reports an error cluster_ State:fail, how to solve and restore the cluster (IP problem / incomplete slot allocation problem)
Redis cluster reports an error cluster_ State:fail, how to solve and restore the cluster (IP problem / incomplete slot allocation problem)
2022-06-09 01:38:00 【Non famous operation and maintenance】
Report errors
127.0.0.1:6379> set name tom ---》 Test in redis Error reporting for data stored in the cluster
-> Redirected to slot [5798] located at 192.168.3.2:6379
(error) CLUSTERDOWN The cluster is down
192.168.3.2:6379> cluster info
cluster_state:fail ---》 Shows that the cluster status is off
cluster_slots_assigned:16384
cluster_slots_ok:10923
cluster_slots_pfail:0
cluster_slots_fail:5461
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:2
cluster_stats_messages_ping_sent:2203
cluster_stats_messages_pong_sent:392
cluster_stats_messages_meet_sent:4
cluster_stats_messages_fail_sent:4
cluster_stats_messages_sent:2603
cluster_stats_messages_ping_received:391
cluster_stats_messages_pong_received:310
cluster_stats_messages_meet_received:1
cluster_stats_messages_fail_received:1
cluster_stats_messages_received:703
solve
View all redis Log discovery redis-5 The container has been repeatedly connected 192.168.3.1:6379 This master node node-1
[[email protected] ~]# docker logs -f redis-5
......
1:S 28 May 2022 13:07:53.233 # Cluster state changed: fail
1:S 28 May 2022 13:07:53.442 * Connecting to MASTER 192.168.3.1:6379
1:S 28 May 2022 13:07:53.442 * MASTER <-> REPLICA sync started
1:S 28 May 2022 13:07:53.442 # Error condition on socket for SYNC: Connection refused
1:S 28 May 2022 13:07:54.481 * Connecting to MASTER 192.168.3.1:6379
1:S 28 May 2022 13:07:54.481 * MASTER <-> REPLICA sync started
......
see node-1 Of redis Node profile redis.conf The nodes in the IP
[[email protected] ~]# cat /root/redis/node-1/conf/redis.conf
port 6379
bind 0.0.0.0
cluster-enabled yes
cluster-config-file nodes.conf ---》redis Cluster node configuration file
cluster-node-timeout 5000
cluster-announce-ip 192.168.3.11 ---》 You can see node-1 Node configuration file IP by 192.168.3.11
cluster-announce-port 6379
cluster-announce-bus-port 16379
appendonly yes
View the current redis State of the cluster , In the form of arrays
192.168.3.2:6379> cluster slots ---》 Current cluster state , In the form of arrays
1) 1) (integer) 10923
2) (integer) 16383
3) 1) "192.168.3.3"
2) (integer) 6379
3) "ff0d1d636f94d9b092e6012408c1d0918e00e6ed"
4) 1) "192.168.3.4"
2) (integer) 6379
3) "2113cf366ad27ebd73585f03d368e77f03b1a2e1"
2) 1) (integer) 0
2) (integer) 5460
3) 1) "192.168.3.1" ---》 You can see the of this node in the cluster IP yes 192.168.3.1
2) (integer) 6379
3) "c856c94ba8d2c55a0d176831bc85aa34a96fde88"
4) 1) "192.168.3.5"
2) (integer) 6379
3) "d92ff5984ab29370af0adeaca71e7938c0287ca5"
3) 1) (integer) 5461
2) (integer) 10922
3) 1) "192.168.3.2"
2) (integer) 6379
3) "8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3"
4) 1) "192.168.3.6"
2) (integer) 6379
3) "2108a90495c147c675328f9b8b4fa49e2b856faf"
see redis Cluster node configuration file nodes.conf
[[email protected] ~]# cat /root/redis/node-1/data/nodes.conf
c856c94ba8d2c55a0d176831bc85aa34a96fde88 192.168.3.1:[email protected] myself,master - 0 1653743266000 1 connected 0-5460
d92ff5984ab29370af0adeaca71e7938c0287ca5 192.168.3.5:[email protected] slave c856c94ba8d2c55a0d176831bc85aa34a96fde88 0 1653743274000 5 connected
2108a90495c147c675328f9b8b4fa49e2b856faf 192.168.3.6:[email protected] slave 8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 0 1653743275531 6 connected
2113cf366ad27ebd73585f03d368e77f03b1a2e1 192.168.3.4:[email protected] slave ff0d1d636f94d9b092e6012408c1d0918e00e6ed 0 1653743275531 4 connected
8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 192.168.3.2:[email protected] master - 0 1653743275531 2 connected 5461-10922
ff0d1d636f94d9b092e6012408c1d0918e00e6ed 192.168.3.3:[email protected] master - 0 1653743275000 3 connected 10923-16383
vars currentEpoch 6 lastVoteEpoch 0
[[email protected] ~]# cat /root/redis/node-2/data/nodes.conf
ff0d1d636f94d9b092e6012408c1d0918e00e6ed 192.168.3.3:[email protected] master - 0 1653743273233 3 connected 10923-16383
2113cf366ad27ebd73585f03d368e77f03b1a2e1 192.168.3.4:[email protected] slave ff0d1d636f94d9b092e6012408c1d0918e00e6ed 0 1653743271151 4 connected
c856c94ba8d2c55a0d176831bc85aa34a96fde88 192.168.3.1:[email protected] master,fail - 1653743267074 1653743266961 1 connected 0-5460
d92ff5984ab29370af0adeaca71e7938c0287ca5 192.168.3.5:[email protected] slave c856c94ba8d2c55a0d176831bc85aa34a96fde88 0 1653743272000 1 connected
8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 192.168.3.2:[email protected] myself,master - 0 1653743271000 2 connected 5461-10922
2108a90495c147c675328f9b8b4fa49e2b856faf 192.168.3.6:[email protected] slave 8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 0 1653743272194 6 connected
vars currentEpoch 6 lastVoteEpoch 0
You can see redis Cluster configuration files for all nodes nodes.conf Medium is 192.168.3.1:6379, And node-1 Node redis.conf Inconsistencies in the documents .
Batch modify all redis node nodes.conf This node in the file IP To configure
[[email protected] ~]# for i in $(seq 1 6); do \
> sed -i 's/192.168.3.1/192.168.3.11/' /root/redis/node-${i}/data/nodes.conf
> done
View all modified redis colony nodes.conf file
[[email protected] ~]# cat /root/redis/node-1/data/nodes.conf
c856c94ba8d2c55a0d176831bc85aa34a96fde88 192.168.3.11:[email protected] myself,master - 0 1653743266000 1 connected 0-5460
d92ff5984ab29370af0adeaca71e7938c0287ca5 192.168.3.5:[email protected] slave c856c94ba8d2c55a0d176831bc85aa34a96fde88 0 1653743274000 5 connected
2108a90495c147c675328f9b8b4fa49e2b856faf 192.168.3.6:[email protected] slave 8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 0 1653743275531 6 connected
2113cf366ad27ebd73585f03d368e77f03b1a2e1 192.168.3.4:[email protected] slave ff0d1d636f94d9b092e6012408c1d0918e00e6ed 0 1653743275531 4 connected
8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 192.168.3.2:[email protected] master - 0 1653743275531 2 connected 5461-10922
ff0d1d636f94d9b092e6012408c1d0918e00e6ed 192.168.3.3:[email protected] master - 0 1653743275000 3 connected 10923-16383
vars currentEpoch 6 lastVoteEpoch 0
[[email protected] ~]# cat /root/redis/node-2/data/nodes.conf
ff0d1d636f94d9b092e6012408c1d0918e00e6ed 192.168.3.3:[email protected] master - 0 1653743273233 3 connected 10923-16383
2113cf366ad27ebd73585f03d368e77f03b1a2e1 192.168.3.4:[email protected] slave ff0d1d636f94d9b092e6012408c1d0918e00e6ed 0 1653743271151 4 connected
c856c94ba8d2c55a0d176831bc85aa34a96fde88 192.168.3.11:[email protected] master,fail - 1653743267074 1653743266961 1 connected 0-5460
d92ff5984ab29370af0adeaca71e7938c0287ca5 192.168.3.5:[email protected] slave c856c94ba8d2c55a0d176831bc85aa34a96fde88 0 1653743272000 1 connected
8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 192.168.3.2:[email protected] myself,master - 0 1653743271000 2 connected 5461-10922
2108a90495c147c675328f9b8b4fa49e2b856faf 192.168.3.6:[email protected] slave 8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 0 1653743272194 6 connected
vars currentEpoch 6 lastVoteEpoch 0
...
...
Batch restart redis Cluster all node containers
[[email protected] ~]# docker restart $(docker ps | grep redis | awk '{print $1}')
dcd802a160c6
6e2f628457f6
f05d3dfb9c8b
220df78836e9
31e7b232f1d1
1de91b4d4e68
[[email protected] ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e2f628457f6 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6376->6379/tcp, :::6376->6379/tcp, 0.0.0.0:16376->16379/tcp, :::16376->16379/tcp redis-6
f05d3dfb9c8b redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6375->6379/tcp, :::6375->6379/tcp, 0.0.0.0:16375->16379/tcp, :::16375->16379/tcp redis-5
220df78836e9 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6374->6379/tcp, :::6374->6379/tcp, 0.0.0.0:16374->16379/tcp, :::16374->16379/tcp redis-4
31e7b232f1d1 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6373->6379/tcp, :::6373->6379/tcp, 0.0.0.0:16373->16379/tcp, :::16373->16379/tcp redis-3
1de91b4d4e68 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6372->6379/tcp, :::6372->6379/tcp, 0.0.0.0:16372->16379/tcp, :::16372->16379/tcp redis-2
dcd802a160c6 redis:5.0.9-alpine3.11 "docker-entrypoint.s…" 3 hours ago Up 2 hours 0.0.0.0:6371->6379/tcp, :::6371->6379/tcp, 0.0.0.0:16371->16379/tcp, :::16371->16379/tcp redis-1
Review redis State of the cluster
[[email protected] ~]# docker exec -it redis-1 /bin/sh ---》redis There is no bash Interpreter
/data # redis-cli -c
127.0.0.1:6379> cluster info
cluster_state:ok ---》 You can see redis The cluster status is already OK
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:236
cluster_stats_messages_pong_sent:233
cluster_stats_messages_sent:469
cluster_stats_messages_ping_received:233
cluster_stats_messages_pong_received:232
cluster_stats_messages_received:465
127.0.0.1:6379> cluster nodes
c856c94ba8d2c55a0d176831bc85aa34a96fde88 192.168.3.11:[email protected] master - 0 1653752958838 1 connected 0-5460
8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 192.168.3.2:[email protected] myself,master - 0 1653752957000 2 connected 5461-10922
2113cf366ad27ebd73585f03d368e77f03b1a2e1 192.168.3.4:[email protected] slave ff0d1d636f94d9b092e6012408c1d0918e00e6ed 0 1653752957804 4 connected
2108a90495c147c675328f9b8b4fa49e2b856faf 192.168.3.6:[email protected] slave 8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3 0 1653752957086 6 connected
ff0d1d636f94d9b092e6012408c1d0918e00e6ed 192.168.3.3:[email protected] master - 0 1653752958000 3 connected 10923-16383
d92ff5984ab29370af0adeaca71e7938c0287ca5 192.168.3.5:[email protected] slave c856c94ba8d2c55a0d176831bc85aa34a96fde88 0 1653752958529 1 connected
127.0.0.1:6379> cluster slots
1) 1) (integer) 5461
2) (integer) 10922
3) 1) "192.168.3.2"
2) (integer) 6379
3) "8b01b1bc6202e1dc7ff9f15013d8200b10ecb3f3"
4) 1) "192.168.3.6"
2) (integer) 6379
3) "2108a90495c147c675328f9b8b4fa49e2b856faf"
2) 1) (integer) 0
2) (integer) 5460
3) 1) "192.168.3.11" ---》 You can see the of this node in the cluster IP Has been modified IP
2) (integer) 6379
3) "c856c94ba8d2c55a0d176831bc85aa34a96fde88"
4) 1) "192.168.3.5"
2) (integer) 6379
3) "d92ff5984ab29370af0adeaca71e7938c0287ca5"
3) 1) (integer) 10923
2) (integer) 16383
3) 1) "192.168.3.3"
2) (integer) 6379
3) "ff0d1d636f94d9b092e6012408c1d0918e00e6ed"
4) 1) "192.168.3.4"
2) (integer) 6379
3) "2113cf366ad27ebd73585f03d368e77f03b1a2e1"
Another situation
When the cluster reports an error cluster_state:fail when , Maybe it's because slot The problem of incomplete allocation makes the cluster unavailable . because redis To ensure cluster integrity , By default, when the cluster 16384 When any one of the slots is not assigned to a node , Whole redis The cluster will be unavailable . This is a protection measure for cluster integrity , Ensure that all slots are assigned to online redis node . In this case , Reassign these slots The cluster unavailability problem can be solved .
In this case, you can take a look at this article : Unassigned slots Problem solving
【 Official account number 】
【 WeChat official account 】 Search for : Non famous operation and maintenance --》 The official account replied “ Information ” Send a gift package of self-study materials for operation and maintenance ! It will also share some operation and maintenance knowledge , Let's get rich and pay attention to a wave , Thank you for your .
边栏推荐
- Shell 减法
- Win10 rename user folder
- ORA-01017
- 在苹果和三星都降价超千元后,国产手机坐不住了纷纷降价抛货
- 数论 --- 朴素筛法、埃氏筛法、线性筛法
- Dom----- register events (bind events)
- Swift GCD DispatchGroup Notify wait DispatchSourceTimer Monitor system file Two apps communicate
- 音視頻的理論基礎與底層技術研究資料
- Shell 报告服务器信息
- Abviewer layout detector function and performance improvement
猜你喜欢

PHP install CI framework solution

Uview - checkbox setting placement attribute row / column is invalid (the arrangement mode cannot be horizontal, but can only be vertical)

How to improve the click through rate of push messages through a/b testing?

涉案资金超10亿,又一洗钱团伙被端,“二清”警钟不能忘

ORA - 07445

大四学长谈程序员

Google Chrome uses bookmarks to retrieve bookmarks

Explication détaillée du nombre de points flottants (une étude approfondie du nombre de points flottants)

Shell循环for while(四)

MySQL starts the binlog log to recover the erroneously deleted tables, data and MySQL database
随机推荐
【Unity中的MVC思想——使用MVC制作UI逻辑】
Openeuler notebook networking
Assembly language integrated development environment learning notes
After apple and Samsung both reduced their prices by more than 1000 yuan, domestic mobile phones were unable to sit still and sold off at reduced prices
shell 菱形图案
前迪士尼高管称德普将回归《加勒比海盗》 继续演船长
涉案资金超10亿,又一洗钱团伙被端,“二清”警钟不能忘
Young people's "new favorite" cold tea: can we start the next "Lipton era"?
Redis集群报错cluster_state:fail,如何解决并重新恢复集群(IP问题/ slot未完全分配问题)
Official account mall system makes e-commerce easier!
C语言猜数字游戏
How to use mongodb database in laravel framework
Version number ^ and~
大四学长谈程序员
[niuke.com SQL] SQL must know and know
Dry goods | first glimpse of pytest test framework, which can easily hold even if the foundation is weak
GDB notes (10) - check for memory leak, heap overflow, stack overflow, global memory overflow, and continue using after release
浮点数详解(一篇彻底学通浮点数)
Codeforces Round #797 (Div. 3)A~E
C语言学生课程管理系统