错误: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写反了。
③ 版本不兼容问题,说下面这两个包不用加版本。(我自己也没加版本,我当时以为版本太低了,弄版本问题也弄了半天,也不是这个问题)。对了,该导的包都记得导好。
