Could not get a resource from the pool 错误解决
错误信息:Could not get a resource from the pool
可能造成错误原因:
1 没关闭Linux防火墙
查看防火墙状态
systemctl status firewalld.service
Active: active(running),说明防火墙是开启状态
关闭防火墙命令
systemctl stop firewalld.service
Active: inactive (dead),说明防火墙关闭
2 没有修改redis.conf文件
对redis.conf文件内容进行修改
(1)将redis.conf中的bind:127.0.0.1注释掉
(2)将redis.conf中的protected-mode yes改为protected-mode no
然后杀死原有redis进程并重新开启redis服务
ps -ef|grep redis
kill -9 进程号
3 SpringBoot中application.properties内容问题
连接延迟不要设置太小
spring.redis.timeout=18000000
当遇到'Couldnotgetaresourcefromthepool'错误时,可能的原因包括Linux防火墙未关闭、Redis配置文件未正确修改或SpringBoot应用的连接超时设置过小。关闭防火墙可以通过'systemctlstopfirewalld.service'命令实现,修改redis.conf文件需取消bind的限制并禁用protected-mode,同时检查SpringBoot的timeout配置,确保连接延迟适当。
1万+





