开发手记: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, ...
随机推荐
- 「Android」GreenDao
译文 版本:greenDAO 3.2.2 官网:http://greenrobot.org/greendao/ GitHub:https://github.com/greenrobot/greenDA ...
- 深入理解Java虚拟机06--虚拟机字节码执行引擎
一.前言 物理机的执行引擎是直接在物理硬件如CPU.操作系统.指令集上运行的,但是对于虚拟机来讲,他的执行引擎由自己实现. 执行引擎有统一的外观(Java虚拟机规范),不同类型的虚拟机都遵循了这一规范 ...
- python之restful api(flask)获取数据
需要用到谷歌浏览器的扩展程序 Advanced Rest Client进行模拟请求 1.直接上代码 from flask import Flask from flask import request ...
- windows 获取用户的Sid的方法
正常获取: whoami /user 如果要获取其他用户的SID就显得力不从心了,我们可以使用微软提供的系统工具 Sysinternals Suite 下载地址:https://docs.micros ...
- strlen strcat strcpy strcmp 自己实现
strlen strcat strcpy strcmp 自己实现 strlen include <stdio.h> #include <string.h> #include & ...
- Python爬虫之Urllib库的基本使用
# get请求 import urllib.request response = urllib.request.urlopen("http://www.baidu.com") pr ...
- Windows单机最大TCP连接数的问题
本文和大家分享一下Windows下单机最大TCP连接数,因为在做Socket 编程时,我们经常会要问,单机最多可以建立多少个 TCP 连接,本文将介绍如何调整系统参数来调整单机的最大TCP连接数. W ...
- Hibernate 5 入门指南-基于JPA
首先创建\META-INF\persistence.xml配置文件并做简单的配置 <persistence xmlns="http://java.sun.com/xml/ns/pers ...
- 如何修改discuz论坛的图像地址
今天帮别人修改discuz论坛,遇到一个问题,就是图像显示不出来,按F12键后,发现是自己的图像路径设置有问题,于是就要去修改这个设置路径了.有两种方法: 一,直接修改配置文件,打开config/co ...
- June. 21 2018, Week 25th. Thursday
Summertime is always the best of what might be. 万物最美的一面,总在夏季展现. From Charles Bowden. It was June, an ...