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

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的最大连接数之后 异常便得以解决。

Could not get a resource from the pool 异常定位和解决的更多相关文章

  1. 记redis一次Could not get a resource from the pool 异常的解决过程

    最近有个项目中的redis每天都会报 "Could not get a resource from the pool"的错误,而这套代码在另一地方部署又没有问题.一直找不到错误原因 ...

  2. redis中 Could not get a resource from the pool 异常解决

    https://blog.csdn.net/qh_java/article/details/54669973

  3. Redis一个异常的解决办法,异常描述:Could not get a resource from the pool

    异常描述: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the poo ...

  4. redis提示Could not get a resource from the pool(jedis连接池配置)

    起初在JedisPool中配置了50个活动连接,但是程序还是经常报错:Could not get a resource from the pool 连接池刚开始是这样配置的: JedisPoolCon ...

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

    超时 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: jav ...

  6. redis性能调优笔记(can not get Resource from jedis pool和jedis connect time out)

    对这段时间redis性能调优做一个记录. 1.单进程单线程 redis是单进程单线程实现的,如果你没有特殊的配置,redis内部默认是FIFO排队,即你对redis的访问都是要在redis进行排队,先 ...

  7. redis客户端可以连接集群,但JedisCluster连接redis集群一直报Could not get a resource from the pool

    一,问题描述: (如题目)通过jedis连接redis单机成功,使用JedisCluster连接redis集群一直报Could not get a resource from the pool 但是使 ...

  8. spring整合redis使用RedisTemplate的坑Could not get a resource from the pool

    一.背景 项目中使用spring框架整合redis,使用框架封装的RedisTemplate来实现数据的增删改查,项目上线后,我发现运行一段时间后,会出现异常Could not get a resou ...

  9. Could not get a resource from the pool 错误解决

    错误关键信息:Could not get a resource from the pool 通常原因是因为远程服务器上的redis没有配置好. 解决方案如下:(1)将redis.conf中的bind: ...

  10. [报错]Could not get a resource from the pool

    redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool解决:开启 ...

随机推荐

  1. 开源不挣钱?这个项目上线半年月入超 30w

    很兴奋的告诉大家,Sealos 自从 6 月份上线以来,仅半年时间注册用户已经突破 7万,月收入超过 30w,本文来向大家介绍我们是怎么做开源商业化的.每月平均增速超过 40%,而且这些收入大部分来自 ...

  2. X2加密的PcbDoc类型导出内容有误,不加密的PcbDoc导出的表格正常

    出现该类问题说明读取PcbDoc文件文件出了文件,加密类型添加tmp类型即可

  3. Weblogic获取端口IP

    Weblogic获取端口IP 获取端口IP只为了判断哪个节点 调用 private WebMBeanServer server=new WebMBeanServer(); synlog.info(&q ...

  4. 解决QObject::moveToThread: Current thread (0x56059f9b0f70) is not the object's t

    对 opencv 降级 pip install opencv-python==4.1.2.30

  5. 文心一言 VS 讯飞星火 VS chatgpt (45)-- 算法导论6.1 3题

    三.证明:在最大堆的任一子树中,该子树所包含的最大元素在该子树的根结点上. 文心一言: 在最大堆中,根结点是整个堆中最大元素的孩子,因此它包含的最大元素是在该子树的根结点上. 我们可以通过递归的方式证 ...

  6. 什么是HuggingFace

    一.HuggingFace简介 1.HuggingFace是什么 可以理解为对于AI开发者的GitHub,提供了模型.数据集(文本|图像|音频|视频).类库(比如transformers|peft|a ...

  7. 一图看懂CodeArts Inspector 三大特性,带你玩转漏洞管理服务

    ​​​​本文分享自华为云开发者联盟公众号<一图看懂华为云CodeArts Inspector三大特性,带你玩转漏洞管理服务>. 华为云漏洞管理服务CodeArts Inspector是面向 ...

  8. 实践案例丨Pt-osc工具连接rds for mysql 数据库失败

    [现象] 主机可以telent 通rds 端口,并且使用mysql-client 连接正常: 如下图所示:使用pt-osc工具连接时,一直没有响应,一直卡在哪里 等了4-5分钟左右后,会有响应,如下图 ...

  9. 基于MRS-Hudi构建数据湖的典型应用场景介绍

    摘要:华为云FunsionInsight MRS已集成Apache Hudi 0.8版本,基于MRS-Hudi构建数据湖解决方案. 本文分享自华为云社区<基于MRS-Hudi构建数据湖的典型应用 ...

  10. 火山引擎 DataLeap:在数据研发中,如何提升效率?

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 在数仓及中台研发过程中,研发人员经常需要在不同任务中维护相同或类似代码,不仅费时费力,并且代码迭代后也面临不同业务 ...