[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
    评论
"Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.5.103:6379" 这个错误提示表明无法连接到Redis数据库。具体的异常信息是 io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.5.103:6379。这可能是由于以下几个原因导致的: 1. Redis服务器未运行或未正常启动。请确保Redis服务器已经正确安装并正在运行,并且已经启动在指定的地址和端口上(192.168.5.103:6379)。 2. 网络连接问题。可能是由于网络故障或防火墙配置问题导致无法连接到Redis服务器,请检查网络连接是否正常,并确保防火墙允许与Redis服务器的通信。 3. Redis服务器配置问题。可能是由于Redis服务器的配置错误导致连接失败,请检查Redis服务器的配置文件,并确保地址和端口配置正确。 如果以上方法仍然无法解决问题,您可以尝试使用telnet命令或其他Redis客户端工具连接到Redis服务器,以进一步诊断连接问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [redis无法连接](https://blog.csdn.net/weixin_52238787/article/details/125294352)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [记录服务器上,不定时出现io.lettuce.core.RedisCommandTimeoutException: Command timed out after xxx ...](https://blog.csdn.net/jllion/article/details/124405570)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值