前几天公司后端系统出现了故障,导致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. mark一下咕掉的题目

    蒟蒻才普及组呀~ 大佬别D我 等集中补一下 CF980F:咋说捏,我觉得要联赛了做这题有点浪费时间,等想颓废了再来写写叭qwq 215E/279D/288E/331C3/431D/433E/750G/ ...

  2. android常见错误之 No resource found that matches the given name

    新手上路,还希望大神多多照顾,刚自学android,遇到很多困难.其中就有这个问题,不知道你们遇到过没有,反正我是很头痛. No resource found that matches the giv ...

  3. jmeter(四十五)常用Beanshell脚本

    整理了一批jmeter常用的beanshell脚本供大家参考! 时间戳 import java.text.SimpleDateFormat; import java.util.Calendar; im ...

  4. 大白话说Java反射:入门、使用、原理 (转)

    文章首发于[博客园-陈树义],点击跳转到原文<大白话说Java反射:入门.进阶.原理> 目录 一个简单的例子 反射常用API 获取反射中的Class对象 通过反射创建类对象 通过反射获取类 ...

  5. kafka安装运行(docker)

    zookeeper参照https://www.cnblogs.com/wintersoft/p/11128484.html mkdir /opt/kafka -pvim /opt/kafka/Dock ...

  6. 前端知识点回顾之重点篇——CSS中flex布局

    flex布局 来源: http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html?utm_source=tuicool 采用 Flex 布局的元素 ...

  7. TortoiseGit用户名密码的更换方法介绍

    http://www.downza.cn/xy/53171.html 有时候因实际需求要更换TortoiseGit用户名密码,怎么办呢?下文就是TortoiseGit用户名密码的更换方法介绍,一起看看 ...

  8. kotlin基础 字符串模板

    ${变量名} var tmp="字符串模板” print("今天学习${tmp}这个知识点")

  9. JavaScript 工厂模式

    //工厂 function FruitMaker() { //function 后不带方法名,这里cococola未定义,make return时,返回 FruitMaker.cococola thi ...

  10. Spark闭包与序列化

    Spark的官方文档再三强调那些将要作用到RDD上的操作,不管它们是一个函数还是一段代码片段,它们都是“闭包”,Spark会把这个闭包分发到各个worker节点上去执行,这里涉及到了一个容易被忽视的问 ...