开发手记:JedisConnectionException: Could not get a resource from the pool
对于Redis,生产环境是集群模式,测试环境是单例模式,如果在生产环境中用单例模式会报错。
解决办法,通过云配置,将配置进行自动化配置。

另附一份Redis配置:
#*********************Redis单节点配置************************
# Redis服务器地址
spring.redis.host=10.5.172.67
# Redis服务器连接端口
spring.redis.port= #*********************RedisCluster集群配置************************
# Redis服务器地址
spring.redis.hosts=10.30.10.169:,10.30.10.170:,10.30.10.171:,10.30.10.169:,10.30.10.170:,10.30.10.171:
# 读取超时时间(毫秒),源码:JedisConnectionFactory中在jedisCluster中设置的和timeout连接超时是一致的。
# return StringUtils.hasText(getPassword())
# ? new JedisCluster(hostAndPort, timeout, timeout, redirects, password, poolConfig)
# : new JedisCluster(hostAndPort, timeout, redirects, poolConfig);
spring.redis.sotimeout=
# 最大重试次数
spring.redis.maxAttempts=
#集群间最大跳转次数,如果不设置maxRedirects值,源码中默认为5。一般当此值设置过大时,容易报:Too many Cluster redirections
#源码是在JedisConnectionFactory中设置的new JedisCluster(hostAndPort, timeout, timeout, redirects, password, poolConfig)
spring.redis.maxRedirects= #*********************Redis通用配置************************
# Redis服务器连接密码(默认为空)
spring.redis.password= hol@
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.pool.max-active=
# 连接池最大阻塞等待时间(使用负值表示没有限制),单位毫秒
spring.redis.pool.max-wait=-
# 连接池中的最大空闲连接
spring.redis.pool.max-idle=
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=
# 连接池中逐出连接的最小空闲时间 默认1800000毫秒(30分钟)
spring.redis.pool.min-evictableIdleTimeMillis=
# 连接超时时间(毫秒)
spring.redis.timeout=
# redis cacheManager过期时间,单位秒,默认为0,代表永不过期
spring.redis.cacheManager.expire =
开发手记:JedisConnectionException: Could not get a resource from the pool的更多相关文章
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
超时 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: jav ...
- 【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 ...
- redis JedisConnectionException: Could not get a resource from the pool
转载:https://blog.csdn.net/testcs_dn/article/details/43052585 产生此错误的原因通常是: 一.Redis没有启动: 我自己遇到一次这样的问题.汗 ...
- 【java异常】redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
产生此错误的原因通常是: 一.Redis没有启动: 我自己遇到一次这样的问题.汗! 二.由于防火墙原因无法连接到Redis; 1.服务器防火墙入站规则. 2.访问Redis的应用程序所在主机的出站规则 ...
- Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
异常描述: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the poo ...
- [报错]Could not get a resource from the pool
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool解决:开启 ...
- java 连接 redis集群时报错:Could not get a resource from the pool
由于弄这个的时候浪费了太多的时间,所以才记录下这个错,给大伙参考下 检查了一下,配置啥的都没问题的,但在redis集群机器上就可以,错误如下: Exception in thread "ma ...
- jedis异常:Could not get a resource from the pool
前几天公司后端系统出现了故障,导致app多个功能无法使用,查看日志,发现日志出现较多的redis.clients.jedis.exceptions.JedisConnectionException: ...
- [分享]源代码&开发手记:SAE应用“车百科” (Python + SAE + Bottle + Bootstrap) - Bottle - Python4cn(news, jobs)
[分享]源代码&开发手记:SAE应用"车百科" (Python + SAE + Bottle + Bootstrap) - Bottle - Python4cn(news, ...
随机推荐
- C# 实现中国象棋【棋盘,棋子】
本文是利用C# 实现中国象棋的棋盘绘制,以及初始化布局,并不实现中国象棋的对弈逻辑.仅供学习参考使用. 思路: 绘制中国象棋棋盘,竖线九条,横线十条.再中间绘制‘楚河’,‘汉界’ . 绘制棋子,然后将 ...
- echarts雷达图点击事件 包含(2.x,3.85,4.02)测试
最近看见别人问的问题,点击雷达图的拐点,获取点击数据的问题,直接上代码. echarts 2x 的点击事件 echarts配置问题:https://www.douban.com/note/509404 ...
- How do I install Daydream on my phone?
Google's philosophy with their newest VR platform is simple. In order to offer the best possible exp ...
- Android ScrollView内部组件设置android:layout_height="fill_parent"无效的解决办法
问题:scrollview内部组件都设置了android:layout_height="fill_parent"却没有效果. 解决办法:设置scrollview的fillViewp ...
- 服务端如何获取客户端请求IP地址
服务端获取客户端请求IP地址,常见的包括:x-forwarded-for.client-ip等请求头,以及remote_addr参数. 一.remote_addr.x-forwarded-for.cl ...
- 【转】JSF中的三大核心组件 UI标签的详细介绍和使用举例
JSF提供了大量的UI标签来简化创建视图.这些UI标签类似于ASP.NET中的服务器组件.使用这些标签,可以通过其value,binding,action,actionListener等属性直接绑定到 ...
- 数据库之mysql篇(4)—— navicat操作mysql
navicat 1.简介: navicat是一个软件,旗下针对不同数据库有不同的软件版本,支持以下数据库,还是挺厉害的: 这里我采用navicat for mysql版本.实现图形化的操作mysql, ...
- 自动化测试基础篇--Selenium文件上传send_keys
摘自https://www.cnblogs.com/sanzangTst/p/8358165.html 文件上传是web页面上很常见的一个功能,自动化成功中操作起来却不是那么简单. 一般分两个场景:一 ...
- 高通 NXP NFC(PN547PN548) 移植流程 android6.0
一.驱动部分 首先向NXP 的 fae要android 6.0 bring up的代码,如:NFC_NCIHALx_AR0F.4.3.0_M_NoSE 结构目录如下: 1. 添加驱动文件 高通平台需使 ...
- vue 之 .sync 修饰符
在一些情况下,我们可能会需要对一个 prop (父子组件传递数据的属性) 进行“双向绑定”. 在vue 1.x 中的 .sync 修饰符所提供的功能.当一个子组件改变了一个带 .sync 的prop的 ...