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或更高版本)

要是还没有解决,那只能寻找其他的方法了,我搞了很久很久…

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