[Redis]:Sorry, can't connect to node 192.168.xxx.xxx

1 redis默认只允许本地访问,要使redis可以远程访问可以修改redis.conf

解决办法:注释掉bind 127.0.0.1可以使所有的ip访问redis

若是想指定多个ip访问,但并不是全部的ip访问,可以bind

在redis3.2之后,redis增加了protected-mode,在这个模式下,即使注释掉了bind 127.0.0.1,再访问redisd时候还是报错

修改办法:protected-mode no

2.redis服务没有启动。

解决方法:启动redis服务。

/usr/local/redis/bin/redis-server redis_cluster/700*/redis.conf 

开启每个端口后才进行,执行创建redis集群命令

192.168.xxx.xxx【为你虚拟机的ip centos 7 可以使用 ip addr 查看IP】

redis-trib.rb create --replicas 1  192.168.xxx.xxx:7001 192.168.xxx.xxx:7002 192.168.xxx.xxx:7003 192.168.xxx.xxx:7004 192.168.xxx.xxx:7005 192.168.xxx.xxx:7006

3.防火墙没关,导致连接不上redis服务。

先使用命令:firewall-cmd --zone=public --query-port=700*/tcp #查看防火墙700*端口是否开启 no为没开,可以使用以下方式解决:

systemctl start firewalld #启动(此步是出现了 firewall not running时用)

systemctl status firewalld #查看运行状态

firewall-cmd --zone=public --add-port=700*/tcp --permanent #添加700*端口(--permanent表示永久生效,没有此参数重启后失效)

firewall-cmd --zone=public --query-port=700*/tcp #查看防火墙700*端口

firewall -cmd --zone=public --remove-port=700*/tcp --permanent #删除防火墙700*端口

systemctl stop firewalld #关闭

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值