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

news/2025/3/6 3:14:46/

问题描述

启动瑞吉外卖项目后,在测试采用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

http://www.ppmy.cn/news/263195.html

相关文章

【云原生|Kubernetes】08-Pod中的Init容器

【云原生Kubernetes】08-Pod中的Init容器 文章目录 【云原生Kubernetes】08-Pod中的Init容器简介理解 Init 容器Init容器使用场景创建包含Init容器的Pod具体行为资源Pod 重启的原因 调试Init容器理解 Pod 的状态 简介 Init 容器是一种特殊容器,在 Pod内的应用容器启…

ubuntu虚拟机 立即使用客户机 灰色

环境 Ubuntu16.04 VMware 16.2.2 Windows 10 错误 the system is running in low graphic CtrlALTF1 进入控制台输入用户名和密码进入系统cd /etc/X11sudo cp xorg.conf.failsafe xorg.conf重启 分辨率低、无法适应客户机器 sudo apt-get updatesudo apt-get upgrade 界面卡…

使用命令启动IOS模拟器

通过命令行操作iOS模拟器 列出已安装的所有可用的模拟器设备 xcrun instruments -s的MacBook Pro [88D67194-8AC9-5CED-993C-EDAEDC2A3395] Apple TV (12.2) [BAA9D4FF-47F3-4474-AFA1-BB01C1723827] (Simulator) Apple TV 4K (12.2) [478802EF-59F9-4394-A429-A0B2151F90A7]…

mmc二维下料例子

给定如下数据: 最大长度 12560; 最大宽度 1500; 需要长度 {12560, 7890, 8845, 8990, 4890, 7540, 3990, 4890, 5230}; 需要宽度 {210, 325, 410, 646, 180, 284, 232, 575, 760}; 需要数量 {55, 43, 88, 46, 123, 56, 180, 28, 36}; 如何切割,面积…

js将String字符串当作HTML来处理,显示在页面上

接收到string类型的消息&#xff0c;需要转为html&#xff0c;并显示到页面上。 实现如下&#xff1a; 接收到的参数举例&#xff1a; const data {html: "<h1 style\"text-align: center;\">213</h1><p><span style\"color: rgb(20…

[Yarn] info There appears to be trouble with your network connection. Retrying...

yarn install命令时报错&#xff0c;原因是到了timeout时间&#xff0c;没有安装完某个包&#xff0c;一是有可能网络确实太慢&#xff0c;二是可能你的包太大了&#xff0c;安装时间只要超过timeout时间就会说你网络有问题。 解决方法&#xff1a; 1、如果是网络的问题的话&am…

DB2 DPF数据库FCM -6040异常

1 问题现象应用日志抛出 https://www.cndba.cn/hbhe0316/article/4890 https://www.cndba.cn/hbhe0316/article/4890 No FCM buffers are available SQLCODE-6040 (二)问题诊断https://www.cndba.cn/hbhe0316/article/4890 https://www.cndba.cn/hbhe0316/article/4890 #db2 …

linux显卡性能测试工具,Linux系统中A/N显卡通用计算性能测试

【天极网DIY硬件频道】今天我们将给大家带来一份很有趣的测试&#xff0c;在Linux操作系统下对比了NVIDIA、AMD几款显卡的OpenCL通用计算性能&#xff0c;尤其是最近比较抢眼的GeForce GTX 460。 本次测试使用的工具是Phoronix.com自家出品的测试套装Phoronix Test Suite 2.8&a…