springboot连接Linux服务器中redis出现异常org.springframework.data.redis.RedisConnectionFailureException:

异常

org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.36.129:6379

解决办法
  1. 查看项目中的application.properties中的host的端口号是否写错了。
  2. 查看Linux服务器中的端口号6379是不是已经开放。
    在这里插入图片描述
  3. 查看虚拟机的防火墙是不是已经关闭了,这也可能导致redis连接不上。
查看防火墙状态的命令:
systemctl status firewalld

在这里插入图片描述
如上图代表防火墙已经打开了,用下面的命令进行关闭。

关闭防火墙的命令:
systemctl  stop firewalld

在这里插入图片描述
4. 修改redis的配置文件
找到redis对应的配置文件的目录进行编辑。

编辑命令
sudo vim redis.conf
  • 找到bind 127.0.0.1,将其注释掉
  • 找到protected-mode yes,将其改成protected-mode yes
    在这里插入图片描述
    修改后进行保存。
    编辑完成后一定要重启redis,先shutdown退出,再用配置文件进行重启
    编辑完成后一定要重启redis,先shutdown退出,再用配置文件进行重启
    编辑完成后一定要重启redis,先shutdown退出,再用配置文件进行重启
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
org.springframework.data.redis.RedisConnectionFailureException是一个Redis连接失败的异常。在这个异常,嵌套的异常是io.lettuce.core.RedisConnectionException: Unable to connect to [IP]:,其IP和Port是连接Redis时指定的IP地址和端口号。这个异常通常是由于无法建立与Redis服务器连接造成的。可能的原因包括Redis服务器未运行、网络连接问题、配置错误等。要解决这个问题,可以尝试以下几个方法: 1. 确保Redis服务器正常运行:检查Redis服务器是否已启动,并且确保它正在监听正确的IP地址和端口号。 2. 检查网络连接:确保客户端能够与Redis服务器进行通信。可以尝试使用telnet命令连接Redis服务器的IP地址和端口号,看是否能够成功建立连接。 3. 检查配置文件:检查Redis客户端的配置文件,确保指定的IP地址和端口号与实际情况相符。 4. 检查防火墙设置:检查防火墙设置,确保允许客户端与Redis服务器之间的通信。 5. 检查密码设置:如果Redis服务器需要密码进行认证,确保客户端已正确地配置了密码。 通过排除以上可能的问题,您应该能够解决org.springframework.data.redis.RedisConnectionFailureException异常。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [springboot连接redis出现org.springframework.data.redisRedisConnectionFailureException异常](https://blog.csdn.net/m0_67393828/article/details/123684060)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [org.springframework.data.redis.RedisConnectionFailureException异常解决](https://blog.csdn.net/Sexycool/article/details/122352805)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Redis连接超时异常的处理方法](https://download.csdn.net/download/weixin_38517113/12822673)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

西瓜程序设计

您的打赏将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值