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

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. 【YOLOv5】实现扑克牌的点数识别

    前言 其实年初的时候,我也跟着别人的源码,用 Tensoflow 实现过扑克牌的目标检测.虽然也通过博文的方式记录了,但是那个项目使用的 TF 版本比较旧,自身对 TF 并不熟.后期如果说要升级或修改 ...

  2. Codeforces #449 div2 C题

    C. Nephren gives a riddle time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  3. flask请求钩子(就是django的中间件)

    flask中的请求钩子就是域django的中间件类似,作用都是用于在请求前.后.响应前.后进行一些hook操作. 请求钩子装饰器 @app.before_request # 请求前会调用,一般可以用来 ...

  4. 接手了个项目,被if..else搞懵逼了

    背景 领导:"这个项目,今后就给你维护了啊,仔细点." 小猫:"好,没问题". 可当满怀信心的小猫打开项目工程包翻看一些代码之后,瞬间懵逼没了信心. 是这样的 ...

  5. Rabin-Karp 字符串查找算法

    和一般的比较字符串的方式不同,Rabin-Karp 查找算法通过对子字符串进行 hash,如果在原有字符串中找到了 hash 值相同的字符串,那么继续比较是否是需要查找的字串,一般来讲,如果 hash ...

  6. 一行代码解决Three.js中只能在一侧看到物体的问题

    项目场景:   因为该项目比较复杂庞大,在此就简单介绍一下:   通过Three.js创建若干个物体进行了组装,从而形成了一个类似眼球模拟模型的项目,用户可以通过拖动鼠标来达到控制视角(摄像机)的目的 ...

  7. 26、Flutter中命名路由

    Flutter 中的命名路由 main.dart中配置路由 void main() { runApp(MaterialApp( theme: ThemeData( appBarTheme: const ...

  8. Llama2-Chinese项目:5-推理加速

      随着大模型参数规模的不断增长,在有限的算力资源下,提升模型的推理速度逐渐变为一个重要的研究方向.常用的推理加速框架包含lmdeploy.FasterTransformer和vLLM等. 一.lmd ...

  9. 华为云推出全自研数据库,GaussDB(openGauss)能否撑起一片天?

    摘要:GaussDB(openGauss) 基于华为云底座,能够快速全球化部署,同时支持用户的本地化部署诉求,跟云上生态工具紧密结合让用户在迁移.开发.运维上省时省心. GaussDB(openGau ...

  10. 自定义TBE算子入门,不妨从单算子开发开始

    摘要:以单算子开发为例,带你了解算子开发及测试全流程. 为什么要自定义算子 深度学习算法由一个个计算单元组成,我们称这些计算单元为算子(Operator,简称Op).算子是一个函数空间到函数空间上的映 ...