idea报错:Unable to connect to localhost_6379] with root cause

在启动瑞吉外卖项目测试Redis功能时遇到500错误,原因是无法连接到Redis服务器。问题的根本在于Redis的默认配置,bind设置为127.0.0.1且protected-mode设为yes。为解决远程连接问题,需修改redis.windows.conf,取消bind的注释并把protected-mode改为no,然后重新启动redis-server.exe服务。
摘要由CSDN通过智能技术生成

问题描述

启动瑞吉外卖项目后,在测试采用Redis的功能时报错(页面状态码为500,是服务器端出错):

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379] with root cause
java.net.ConnectException: 拒绝连接
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_171]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_171]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:707) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[netty-transport-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-common-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.63.Final.jar!/:4.1.63.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.63.Final.jar!/:4.1.63.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]

分析与解决

我在本地运行了redis-server.exe,由于是直接双击运行的,没有指定配置文件,所以采用了默认配置,而默认配置并不能满足需求。
解决:

  1. 由于是远程连接(非localhost),需要修改配置文件redis.windows.conf
    1. bind 127.0.0.1注释掉
    2. protected-mode yes改为protected-mode no
  2. redis-server.exe安装目录下,按住shift并鼠标右键,打开命令行窗口
  3. 执行.\redis-server.exe .\redis.windows.conf
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
这个错误提示通常表示在使用IDEA下拉取代码时遇到了连接问题。根据提供的引用内容,有几种可能的原因导致这个错误。 1. 首先,可能是网络问题导致无法连接到你的仓库URL。例如,引用中的错误提示中显示了 "Connection was reset" 的错误。这可能是由于网络连接不稳定或者防火墙设置的原因导致的。你可以尝试使用其他网络或者联系你的网络管理员来解决这个问题。 2. 其次,还有可能是SSL证书的问题。引用中提到了 "SSL certificate problem: unable to get local issuer certificate" 的错误。这可能是由于IDEA无法验证SSL证书的真实性。你可以尝试更新或重新安装证书,或者在IDEA的设置中禁用SSL验证来解决这个问题。 3. 最后,还可能是由于访问的URL无效或者超时导致的。引用中的错误提示中显示了 "Failed to connect to github.com port 443: Timed out"。这可能是由于仓库URL不存在或者访问超时导致的。你可以尝试检查URL是否正确,并尝试使用其他可用的URL。 综上所述,解决 IDEA 下拉代码报 Error: Unable to connect to a repository at URL 的问题的方法包括检查网络连接、解决SSL证书问题以及确认URL的有效性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Git版本控制中的一些问题及解决方法](https://blog.csdn.net/yuanziwoxin/article/details/125533428)[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: 50%"] - *3* [Idea中解决Git冲突问题及merge代码消失问题【git常用tips】](https://blog.csdn.net/weixin_45565886/article/details/126926514)[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: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

在逃八阿哥

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值