对于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的更多相关文章

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

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

  2. 【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 ...

  3. redis JedisConnectionException: Could not get a resource from the pool

    转载:https://blog.csdn.net/testcs_dn/article/details/43052585 产生此错误的原因通常是: 一.Redis没有启动: 我自己遇到一次这样的问题.汗 ...

  4. 【java异常】redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

    产生此错误的原因通常是: 一.Redis没有启动: 我自己遇到一次这样的问题.汗! 二.由于防火墙原因无法连接到Redis; 1.服务器防火墙入站规则. 2.访问Redis的应用程序所在主机的出站规则 ...

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

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

  6. [报错]Could not get a resource from the pool

    redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool解决:开启 ...

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

    由于弄这个的时候浪费了太多的时间,所以才记录下这个错,给大伙参考下 检查了一下,配置啥的都没问题的,但在redis集群机器上就可以,错误如下: Exception in thread "ma ...

  8. jedis异常:Could not get a resource from the pool

    前几天公司后端系统出现了故障,导致app多个功能无法使用,查看日志,发现日志出现较多的redis.clients.jedis.exceptions.JedisConnectionException: ...

  9. [分享]源代码&开发手记:SAE应用“车百科” (Python + SAE + Bottle + Bootstrap) - Bottle - Python4cn(news, jobs)

    [分享]源代码&开发手记:SAE应用"车百科" (Python + SAE + Bottle + Bootstrap) - Bottle - Python4cn(news, ...

随机推荐

  1. Flutter 布局(三)- FittedBox、AspectRatio、ConstrainedBox详解

    本文主要介绍Flutter布局中的FittedBox.AspectRatio.ConstrainedBox,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. FittedBox Scale ...

  2. Java内存管理 -JVM 垃圾回收

    版权声明:本文为博主原创文章,未经博主允许不得转载 一.概述 相比起C和C++的自己回收内存,JAVA要方便得多,因为JVM会为我们自动分配内存以及回收内存. 在之前的JVM 之内存管理 中,我们介绍 ...

  3. java国际化---native2ascii.exe 的使用方法

    从另一个博客迁移 native2ascii.exe使用方法: 命令的语法格式: native2ascii -[options] [inputfile [outputfile]] 说明: -[optio ...

  4. C#面向对象 1

    using System; using System.Collections.Generic; using System.Collections; using System.Linq; using S ...

  5. [Hive_12] Hive 的自定义函数

    0. 说明 UDF //user define function //输入单行,输出单行,类似于 format_number(age,'000') UDTF //user define table-g ...

  6. Linux端口映射,80端口映射到8080端口

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 其中eth0为外网网卡名称 ipt ...

  7. Ubuntu教程

    Ubuntu的发音 Ubuntu,源于非洲祖鲁人和科萨人的语言,发作 oo-boon-too 的音.了解发音是有意义的,您不是第一个为此困惑的人,当然,也不会是最后一个:) 大多数的美国人读 ubun ...

  8. Beta冲刺博客汇总(麻瓜制造者)

    Beta冲刺博客 Beta冲刺(1/5)(麻瓜制造者) Beta冲刺(2/5)(麻瓜制造者) Beta冲刺(3/5)(麻瓜制造者) Beta冲刺(4/5)(麻瓜制造者) Beta冲刺(5/5)(麻瓜制 ...

  9. 【Linux基础】文件处理实例

    1.文件拆分 //每4000行拆分一个文件 epms_t_ep_fx_stl_xy_20190129.dat 2.行处理 //查找第二列为711611且第三列为711100记录,打印行号和整行数据 a ...

  10. [Java] SpringMVC工作原理之一:DispatcherServlet

    一.DispatcherServlet 处理流程 在整个 Spring MVC 框架中,DispatcherServlet 处于核心位置,它负责协调和组织不同组件完成请求处理并返回响应工作.在看 Di ...