redis报错 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the p

1. spring boot 项目启动报错

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

2. 处理过程

  1. 使用了 其他 vm 中的 redis 没有问题, 从版本到 redis.conf 配置都是一样的(后面发现 requirepass 这一样没有发现
  2. 当前 vm redis 通过 客户端连接也没有问题
  3. 因为 连接redis 使用了 try … catch 包裹,找不到具体错误原因,然后我包代码中 try … catch 去除(我印象中 java 报错 可以 caused by 。。。)。出现 了 caused by 字样 : Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

3. vm 中查看 redis 密码

需要注意的是 redis-desktop manager 客户端连接 误导了我设置了密码, 其实不输入密码也可以使用

如下图 密码没有设置

redis报错 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the p

4. 设置 redis 登录密码

config set 方式设置的密码,重启 vm 会失效

vim /etc/redis.conf

设置 redis 密码
redis报错 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the p

重启 redis : service redis restart

5. 结果

哈哈成功啦!!!
redis报错 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the p