redis cluster 搭建報錯Sorry can not connect to node 192.168.8.181:7001

redis集羣搭建的過程中報了一個錯誤:
redis cluster 搭建報錯“ Sorry, can’t connect to node 192.168.8.181:7001”

這個錯誤主要是說連接不上,我們可以通過幾步來排查:

    1. 防火牆關掉
iptables -F
# 或者
systemctl stop firewalld.service          #停止firewall
systemctl disable firewalld.service    #禁止firewall開機啓動
  • 2.檢查配置文件,cluster-enabled需要打開yes,protected-mode需要設置爲no,bind需要綁定自己本機的地址,端口需要設置對。daemonize設置爲yes。
port 7001
cluster-enabled yes
cluster-config-file /etc/redis-cluster/node-7001.conf
cluster-node-timeout 15000
daemonize	yes							
pidfile		/var/run/redis_7001.pid 						
dir 		/var/redis/7001		
logfile /var/log/redis/7001.log
bind 192.168.31.187		
appendonly yes
protected-mode no
  • 3.注意關掉密碼認證,這個是主從的時候搞的,前面加上#,註釋掉。
# requirepass foobared
# masterauth <master-password>
  • 4.單獨啓動一臺機器看有沒有什麼問題,我的就是我把它kill-9,關掉了…無語,執行這個命令的前提是所有的redis實例已經啓動,所以所有的機器都必須先啓動。

  • 5.如果以上都沒有用,嘗試刪除掉之前的rdb,aof文件,看有些博主說會有影響。

  • 6,還有就是ruby的版本不對,一般這個問題很少。
    安裝ruby需要先安裝crul:

yum install curl

然後執行下面命令安裝RVM:

# (有時候會出錯,多執行一次)
curl -L get.rvm.io | bash -s stable

出現下面的祕鑰:

把這一段祕鑰拷貝到命令行回車。

然後執行下面命令:

source /etc/profile.d/rvm.sh
# 或者
source /usr/local/rvm/scripts/rvm

列出ruby版本

rvm list known

我選擇了這個版本:

rvm install 2.6.3

安裝完之後卸載原來的版本,指定版本:

rvm use 2.6.3
rvm remove 2.0.0
ruby --version

然後再執行install命令就可以啦。

gem install redis

版本要求:

  • ruby : 2.0(1.9.2或更高版本)
  • rubygem: 2.0 (1.8.16或更高版本)
  • gem-redis: 3.2.1(3.0.0或更高版本)

要是還沒有解決,那隻能尋找其他的方法了,我搞了很久很久…

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章