Could not get a resource from the pool 异常定位和解决

简介: Could not get a resource from the pool 异常定位和解决

  最近在服务中经常看到以下错误,进行下定位和问题解决分析:

2023-12-08 00:10:58.248  WARN [terra-sr-server,a9006fd27ccb81d0,a9006fd27ccb81d0,false] 52 --- [o-14009-exec-38] o.s.b.a.redis.RedisHealthIndicator       : Redis health check failed
org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

  

  这个异常 org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool 表示应用程序无法从连接池中获取一个 Redis 连接。这可能是因为连接池已经耗尽,或者 Redis 服务器无法接受更多的连接。

  解决这个问题的方法是首先确定 Redis 服务器的状态,然后检查应用程序的 Redis 连接配置。

1.登录redis,并查看最大连接数:

redis-cli -h 127.0.0.1 -p 6379
config get maxclients

                 

2.info 查询redis信息:

info

                         

3.服务器端服务器执行以下命令,查看连接数

netstat -nat  |awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -20

       

        注:忽略上图的数据,截图时问题已经修复,截图只是为了查看命令返回的数据和格式

4.最终解决结果

  在项目中配置的redis最大连接数是100,调整了项目中reids的最大连接数之后 异常便得以解决。

 

 

标签: redis , 异常

相关文章
SpringCloud极简入门-Feign开启Hystrix
1.支付服务集成Hystrix 官方文档:https://cloud.spring.io/spring-cloud-static/Greenwich.SR5/single/spring-cloud.html#spring-cloud-feign-hystrix 支付服务 springcloud-pay-server-1040 之前集成了Feign,修改该工程集成Hystrix。我们除了要给Feign开启Hystrix以外还需要为Feign接口编写托底类。
852 0
|
域名解析 Linux Shell
CentOS 7 执行 yum 命令失败问题的排查方法
本文主要为大家讲解CentOS 7系统中执行yum命令失败等常见问题的排查方法。
5799 0
CentOS 7 执行 yum 命令失败问题的排查方法
|
SQL 监控 关系型数据库
【紧急救援】MySQL CPU 100%!一套组合拳教你快速定位并解决!
凌晨三点MySQL CPU飙至100%,业务瘫痪!本文亲历30分钟应急排障全过程:从紧急止血、定位慢查询、分析锁争用,到优化SQL与索引,最终恢复服务。总结一套可复用的排查路径与预防方案,助你告别深夜救火。
|
SQL 数据可视化 关系型数据库
快速导入mysql较大的SQL文件
快速导入mysql较大的SQL文件
1341 0
|
NoSQL 安全 Java
解决Unknown redis exception及event executor terminated错误的方法
解决这类问题时,保持耐心和细致是关键。通常,通过系统地检查和排除潜在原因,大多数问题最终都能被解决。
2844 1
|
缓存 NoSQL Java
【Azure Redis 缓存 Azure Cache For Redis】当使用Jedis客户端连接Redis时候,遇见JedisConnectionException: Could not get a resource from the pool / Redis connection los
【Azure Redis 缓存 Azure Cache For Redis】当使用Jedis客户端连接Redis时候,遇见JedisConnectionException: Could not get a resource from the pool / Redis connection los
1275 0
|
前端开发 Java
后端BUG系列之:SpringBoot上传文件太大 报错 Maximum upload size exceeded
这篇文章讨论了SpringBoot应用中上传文件过大导致的错误"Maximum upload size exceeded",并提供了通过修改`application.properties`文件中的上传限制配置来解决这个问题的方法。
|
Oracle Java 关系型数据库
2022 年超详细过程步骤讲解 CentOS 7 安装jdk1.8
这篇文章提供了在CentOS 7系统上安装JDK 1.8的详细步骤,包括卸载系统自带的JDK、下载Oracle官网的JDK安装包、上传至虚拟机、解压安装包、配置环境变量,并验证安装是否成功。
2022 年超详细过程步骤讲解 CentOS 7 安装jdk1.8
|
SQL Java 数据库连接
成功解决:was not registered for synchronization because synchronization is not active
这篇文章是关于解决Mybatis在同步过程中出现"was not registered for synchronization because synchronization is not active"错误的技术博客。
成功解决:was not registered for synchronization because synchronization is not active