Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolExcep

错误:org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 6379:6379

解决:注意yml文件配置有没有写错。

如下可以参考部分:

spring:
  redis:
    host: 192.168.111.111
    port: 6379
    password: 111111
    lettuce:
      pool:
        max-active: 8
        max-idle: 8
        min-idle: 0
        max-wait: 1000ms

我当时将host和port两个配置写反了。网上找了半天也没解决,最后才发现yml里面配置写错。

当时试着修改的有:

① .yml文件里password改为auth;(这个应该不影响吧)

② reids里的redis.conf文件protected-mode yes 改为 protected-mode no;

bind 127.0.0.1改为bind 0.0.0.0; (这个之前配置redis就改过了,我的不是这个问题)。

如果报错提示的是Unable to connect to 192.168.xxx.xxx:6379,那bind 127.0.0.1改为bind 0.0.0.0可以一试。我的Unable to connect to 6379:6379当时很纳闷都没意识到是什么问题,找到问题了才知道port和host写反了。

③ 版本不兼容问题,说下面这两个包不用加版本。(我自己也没加版本,我当时以为版本太低了,弄版本问题也弄了半天,也不是这个问题)。对了,该导的包都记得导好。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值