網站首頁 編程語言 正文
問題:
搭建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
相關推薦
- 2022-09-01 C語言全面梳理結構體知識點_C 語言
- 2022-06-09 詳解C++?functional庫中的仿函數使用方法_C 語言
- 2023-02-18 Nginx中Location配置超詳細講解_nginx
- 2022-05-14 Python實現屏幕代碼雨效果的示例代碼_python
- 2022-01-09 出現Got permission denied while trying to connect to
- 2022-03-03 iview 在 Table 組件中,文字過長用省略號代替,鼠標放上去 Tooltip 文字提示
- 2022-12-21 Redis?RDB與AOF持久化方式詳細講解_Redis
- 2022-10-03 Docker容器/bin/bash?start.sh無法找到not?found問題解決_docker
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支