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

首先说下redis最简单得使用,出去配置。

需要在你要使用得缓存得地方,例如mybatis在mapper.xml中加入:

<cache eviction="LRU" type="cn.jbit.cache.RedisCache"/>

由于是第一次使用redis,再调试代码得时候报错:Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool] with root cause

无法获得redis的链接。

后来重新配置了redis连接池得参数:

#最大空闲数,数据库连接的最大空闲时间。超过空闲数量,数据库连接将被标记为不可用,然后被释放。设为0表示无限制redis.maxIdle=50  #最大连接数:能够同时建立的“最大链接个数”#jedis的最大活跃连接数设为0表示无限制redis.maxActive=50#最大等待时间:单位ms#jedis池没有连接对象返回时,等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。#如果超过等待时间,则直接抛出JedisConnectionExceptionredis.maxWait=1000  ##############################问题注解###############################注解:运行报错:Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool] with root cause

maxActive是最大激活连接数,这里取值为50,表示同时最多有50个数据连 接。maxIdle是最大的空闲连接数,这里取值为50,表示即使没有数据库连接时依然可以保持20空闲的连接,而不被清除,随时处于待命状态。MaxWait是最大等待秒钟数,这里取值-1,表示无限等待,直到超时为止,也可取值9000,表示9秒后超时。
而自己开始的设置是:redis.maxIdle=10 redis.maxActive=50
#########################################################################
 
 

原文地址:https://www.cnblogs.com/zeussbook/p/9033222.html

时间: 2024-08-24 15:44:03

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

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

今天在链接redis时,遇到问题: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool Could not get a resource from the pool. redis的配置是: <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig&qu

Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:

七月 17, 2014 4:56:01 下午 org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemExc

jdbc连接oracle时报错 Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableC

错误: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure Last packet sent

JDBC报错 消息 Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

今天用JDBCTemplate时,发现启动服务器之后报错: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'. 网上说是因为MySQL版本过高的问题,我的MySQL版本是8.0,里面已经没有tx_isolation,变成了transaction_isolation,用了以下几种解决方法: (1)更改MySQL  无效,仍然

redis JedisConnectionException: Could not get a resource from the pool

HTTP Status 500 - Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool type Exception report message Cannot get Jedis connection; nested exception is redis.cl

redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set

1.项目启动报错: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool redis.clients.util.Pool.getResource(Pool.java:50) redis.clients.jedis.JedisPool.getResource(JedisPool.java:88) com.radiadesign.catalina.session.

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

异常描述: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.util.Pool.getResource(Pool.java:22) at com.derbysoft.jredis.longkeytest.BorrowObject.run(BorrowObject.java:22) at java.lang.Thread.

java 连接 redis集群时报错:Could not get a resource from the pool

由于弄这个的时候浪费了太多的时间,所以才记录下这个错,给大伙参考下 检查了一下,配置啥的都没问题的,但在redis集群机器上就可以,错误如下: Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool 原因: 是因为我在创集群的时候的ip地址是:127.0.0.1,不是本机的电脑访问的话是不能访问的,

redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots

最近在学习Redis ,在写test测试的时候碰到这个报错: redis.clients.jedis.exceptions.JedisDataException: 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