前几天公司后端系统出现了故障,导致app多个功能无法使用,查看日志,发现日志出现较多的redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool的异常信息,显而易见,jedis/redis出现了问题。因为是connection的相关的问题,所以看了一下jedis和连接数相关的配置项,maxIdle和maxTotal都是200,jedis的封装也在finally中释放了connection,所以初步猜测问题发生在redis服务端

1.jedis机器-->ping-->redis机器,毫秒级的响应时间----网络畅通

2.使用netstat -apn |grep redis-server连接数为20多个--网络连接数正常

3.free  -m内存使用率60%---(表面上)内存够用

4.df     -h磁盘使用率15%---磁盘空间充足

5.使用redis-cli,执行info命令,client部分:

#Clients

connected_clients:18

client_longest_output_list:0

client_biggest_input_buf:0

blocked_clients:0

clients数量也正常

6.使用redis-cli,执行ping命令,异常信息出来了:

(error)MISCONF Redis is configured to save RDB snapshots, but is currently

not able to persist on disk. Commands that may modify the data set

are disabled. Please check Redis logs for details about the error.

然后查看redis日志,出现了

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

问题已经很清晰了,bgsave会fork一个子进程,因为vm.overcommit_memory = 0,所以申请的内存大小和父进程的一样,由于redis已经使用了60%的内存空间,所以fork失败

解决办法:

/etc/sysctl.conf 添加 vm.overcommit_memory=1

sysctl  vm.overcommit_memory=1

作者:hhhh2 链接:http://www.jianshu.com/p/bb552ccc43b9 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

jedis异常:Could not get a resource from the pool的更多相关文章

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

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

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

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

  3. redis使用问题一:Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool] with root cause

    本文使用的是spring-data-redis 首先说下redis最简单得使用,除去配置. 需要在你要使用得缓存得地方,例如mybatis在mapper.xml中加入: <cache evict ...

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

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

  5. 【Azure Redis 缓存 Azure Cache For Redis】当使用Jedis客户端连接Redis时候,遇见JedisConnectionException: Could not get a resource from the pool / Redis connection lost

    问题情形 当在执行Redis一直指令时,有可能会遇见如下几种错误: 1) redis.clients.jedis.exceptions.JedisConnectionException: Could ...

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

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

  7. 通过jedis连接redis单机成功,使用redis客户端可以连接集群,但使用JedisCluster连接redis集群一直报Could not get a resource from the pool

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

  8. 记一次jedis并发使用问题JedisException: Could not return the resource to the pool

    今天线上突然发现个奇怪的问题项目第一次启动的时候redis报错JedisException: Could not return the resource to the pool 直接访问接口的时候不报 ...

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

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

随机推荐

  1. R语言 rds文件 和 文本文件 转换

    library(data.table) ## 读取 rds 文件,然后保存为文本文件 data <- readRDS("pneumonia_pathogens.rds") w ...

  2. js之切换全屏和退出全屏实现

    应用场景:比如很多网页游戏全屏之类的,或者是网上看小说等. 核心代码: //控制全屏 function enterfullscreen() { //进入全屏 $("#fullscreen&q ...

  3. 刷题记录:[强网杯 2019]Upload

    目录 刷题记录:[强网杯 2019]Upload 一.知识点 1.源码泄露 2.php反序列化 刷题记录:[强网杯 2019]Upload 题目复现链接:https://buuoj.cn/challe ...

  4. Siam R-CNN: Visual Tracking by Re-Detection

    Siam R-CNN: Visual Tracking by Re-Detection 2019-12-02 22:21:48 Paper:https://128.84.21.199/abs/1911 ...

  5. 【转】解决chrome浏览器不支持audio和video标签的autoplay自动播放

    声音无法自动播放这个在 IOS/Android 上面一直是个惯例,桌面版的 Safari 在 2017 年的 11 版本也宣布禁掉带有声音的多媒体自动播放功能,紧接着在 2018 年 4 月份发布的 ...

  6. Proj.4 升级新版本5.x和6.x

    目录 Proj.4 升级新版本5.x和6.x 0.缘起 1.5.x和6.x更新情况简述 PROJ 5.x 更新 PROJ 6.x 更新 2.从PROJ.4向新版本迁移 迁移到5.x版本 迁移到6.x版 ...

  7. win7环境下,vagrant,在启动虚拟机的时候报错io.rb:32:in `encode': incomplete "\xC8" on GBK (Encoding::InvalidByteSequenceError)

    描述: 这几天在windows环境上,部署了vagrant,在启动虚拟机的时候报错: [c:\~]$ vagrant upBringing machine 'default' up with 'vir ...

  8. 【WPF】修改ListBox的Item的样式

    <ListBox> <!-- 数据 --> <ListBoxItem>AAAA</ListBoxItem> <ListBoxItem>BB& ...

  9. Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录

    [root@localhost /]# systemctl status jenkins.service ● jenkins.service - LSB: Jenkins Automation Ser ...

  10. Appium基础之屏幕截图

    应用背景 在实际自动化项目运行过程中,很多时候App可以会出现各种异常,为了更好的定位问题,除了捕捉日志我们还需要对运行时的设备状态来进行截屏.从而达到一种“有图有真相”的效果. 截图方法 方法1 s ...