io.lettuce.core.RedisConnectionException: DENIED Redis is running in protected mode because protecte

Caused by: io.lettuce.core.RedisException: io.lettuce.core.RedisConnectionException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

根据日志提示,先检查一下网络

telnet ip 6379 

超时,果然连接不上了,打开redis服务是不是异常了?

ps -ef|grep redis

我看的时候不存在上面 11034 这个线程。

没有redis服务,重启试一下,时间长了,忘记路径在哪里了,根目录搜一下:find . -name "*redis.*"

可以查到 /data/redis-5.0.2/redis.conf

cd /data/redis-5.0.2/src

./redis-server ../redis.conf  #根据配置文件启动

如上图启用成功。

如果是首次安装,那么就需要改一下redis的配置文件

vim ./data/redis-5.0.2/redis.conf 编辑以下内容:

1、# bind 127.0.0.1  防止远程连接不上
2、daemonize  yes  #后台运行
3、protected-mode no #关闭保护模式

重新启动就好了。

注意: 如果此刻应用服务还是会报错,要记得应用服务也要重启

 

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
根据引用提供的信息,您遇到的问题是`org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect`。这个错误是由于在连接Redis时无法从连接池中获取资源引起的,具体的嵌套异常是`io.lettuce.core.RedisConnectionException: Unable to connect`。而根据引用的提示,您需要确保在`application.yml`的Redis配置中,`spring.redis.timeout`参数的值不能为0。 此外,根据引用提供的配置信息,您在`application.yml`中的Redis配置中指定了Redis服务器的地址为`192.168.30.103`,连接端口为`6379`。您还可以确认一下`spring.redis.host`和`spring.redis.port`这两个参数是否与实际的Redis服务器地址和端口一致。 因此,针对您遇到的`nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379`的问题,您可以按照以下步骤来解决: 1. 首先,确认您的Redis服务器是否正在运行,并且可以从您的应用程序所在的主机访问。 2. 检查`application.yml`文件中的Redis配置,确保`spring.redis.host`和`spring.redis.port`的值与您的Redis服务器的地址和端口一致。 3. 检查`spring.redis.timeout`参数的值,确保它不为0,可以尝试设置一个适当的连接超时时间。 4. 如果您的应用程序在连接池中使用了其他配置项,请确保这些配置项也正确设置。 5. 如果问题仍然存在,可以尝试使用Redis的命令行工具或其他客户端来连接您的Redis服务器,以验证服务器是否正常运行,并检查是否有其他配置或网络问题导致连接失败。 通过以上步骤,您应该能够解决`nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379`的问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值