日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

搭建Redis集群遇到的問題:Waiting for the cluster to join~~~

作者:gblfy 更新時間: 2022-10-25 編程語言

問題:
搭建Redis集群的過程中,執行到cluster create : … 的時候,發現程序發生阻塞,顯示:Waiting for the cluster to join 的字樣,然后就無休無盡的等待…
在這里插入圖片描述

遇到這種情況大部分是因為集群總線的端口沒有開放!

集群總線
每個Redis集群中的節點都需要打開兩個TCP連接。一個連接用于正常的給Client提供服務,比如6379,還有一個額外的端口(通過在這個端口號上加10000)作為數據端口,例如:redis的端口為6379,那么另外一個需要開通的端口是:6379 + 10000, 即需要開啟 16379。16379端口用于集群總線,這是一個用二進制協議的點對點通信信道。這個集群總線(Cluster bus)用于節點的失敗偵測、配置更新、故障轉移授權,等等。

解決方案:
知道了問題所在, 自然就知道如何去解決了, 只需要將開啟Redis端口對應的 集群總線端口即可。例如: 6379 + 10000 = 16379。所以開放每個集群節點的客戶端端口和集群總線端口才能成功創建集群!

防火墻策略
centos7.x

firewall-cmd --zone=public --add-port=7001/tcp --permanent
firewall-cmd --zone=public --add-port=7002/tcp --permanent
firewall-cmd --zone=public --add-port=7003/tcp --permanent
firewall-cmd --zone=public --add-port=7004/tcp --permanent
firewall-cmd --zone=public --add-port=7005/tcp --permanent
firewall-cmd --zone=public --add-port=7006/tcp --permanent
firewall-cmd --zone=public --add-port=17001/tcp --permanent
firewall-cmd --zone=public --add-port=17002/tcp --permanent
firewall-cmd --zone=public --add-port=17003/tcp --permanent
firewall-cmd --zone=public --add-port=17004/tcp --permanent
firewall-cmd --zone=public --add-port=17005/tcp --permanent
firewall-cmd --zone=public --add-port=17006/tcp --permanent
firewall-cmd --reload

在這里插入圖片描述
在這里插入圖片描述

在這里插入圖片描述

[root@VM-24-10-centos redis-cluster]# redis-cli -a pwd@2022gblfy --cluster create --cluster-replicas 1 192.168.0.80:7001 192.168.0.80:7004 192.168.0.80:7003 192.168.0.80:7006 192.168.0.80:7005 192.168.0.80:7002
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.0.80:7005 to 192.168.0.80:7001
Adding replica 192.168.0.80:7002 to 192.168.0.80:7004
Adding replica 192.168.0.80:7006 to 192.168.0.80:7003
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 64ab97133edd09d0de90d7646f158cc0c27c6dbc 192.168.0.80:7001
   slots:[0-5460] (5461 slots) master
M: a3fbce0abdd2555a966d778aece4827a70e133e9 192.168.0.80:7004
   slots:[5461-10922] (5462 slots) master
M: 13f76c0f3b16f251ffc4802c3af89bb3dccfa664 192.168.0.80:7003
   slots:[10923-16383] (5461 slots) master
S: d3e0ed7ec783a368602130af5ef405581b20246f 192.168.0.80:7006
   replicates 13f76c0f3b16f251ffc4802c3af89bb3dccfa664
S: 3ab99d5dc392b2011b34a52478c4a8ef0152e187 192.168.0.80:7005
   replicates 64ab97133edd09d0de90d7646f158cc0c27c6dbc
S: 8b2f5b506b1bdbef9e9fed5844a0bfdc5f88dcc6 192.168.0.80:7002
   replicates a3fbce0abdd2555a966d778aece4827a70e133e9
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.0.80:7001)
M: 64ab97133edd09d0de90d7646f158cc0c27c6dbc 192.168.0.80:7001
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: 8b2f5b506b1bdbef9e9fed5844a0bfdc5f88dcc6 192.168.0.80:7002
   slots: (0 slots) slave
   replicates a3fbce0abdd2555a966d778aece4827a70e133e9
M: a3fbce0abdd2555a966d778aece4827a70e133e9 192.168.0.80:7004
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
S: 3ab99d5dc392b2011b34a52478c4a8ef0152e187 192.168.0.80:7005
   slots: (0 slots) slave
   replicates 64ab97133edd09d0de90d7646f158cc0c27c6dbc
M: 13f76c0f3b16f251ffc4802c3af89bb3dccfa664 192.168.0.80:7003
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: d3e0ed7ec783a368602130af5ef405581b20246f 192.168.0.80:7006
   slots: (0 slots) slave
   replicates 13f76c0f3b16f251ffc4802c3af89bb3dccfa664
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

原文鏈接:https://blog.csdn.net/weixin_40816738/article/details/127455161

欄目分類
最近更新