对于Redis,生产环境是集群模式,测试环境是单例模式,如果在生产环境中用单例模式会报错。

解决办法,通过云配置,将配置进行自动化配置。

另附一份Redis配置:

  1. #*********************Redis单节点配置************************
  2. # Redis服务器地址
  3. spring.redis.host=10.5.172.67
  4. # Redis服务器连接端口
  5. spring.redis.port=
  6.  
  7. #*********************RedisCluster集群配置************************
  8. # Redis服务器地址
  9. 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:
  10. # 读取超时时间(毫秒),源码:JedisConnectionFactory中在jedisCluster中设置的和timeout连接超时是一致的。
  11. # return StringUtils.hasText(getPassword())
  12. # ? new JedisCluster(hostAndPort, timeout, timeout, redirects, password, poolConfig)
  13. # : new JedisCluster(hostAndPort, timeout, redirects, poolConfig);
  14. spring.redis.sotimeout=
  15. # 最大重试次数
  16. spring.redis.maxAttempts=
  17. #集群间最大跳转次数,如果不设置maxRedirects值,源码中默认为5。一般当此值设置过大时,容易报:Too many Cluster redirections
  18. #源码是在JedisConnectionFactory中设置的new JedisCluster(hostAndPort, timeout, timeout, redirects, password, poolConfig)
  19. spring.redis.maxRedirects=
  20.  
  21. #*********************Redis通用配置************************
  22. # Redis服务器连接密码(默认为空)
  23. spring.redis.password= hol@
  24. # 连接池最大连接数(使用负值表示没有限制)
  25. spring.redis.pool.max-active=
  26. # 连接池最大阻塞等待时间(使用负值表示没有限制),单位毫秒
  27. spring.redis.pool.max-wait=-
  28. # 连接池中的最大空闲连接
  29. spring.redis.pool.max-idle=
  30. # 连接池中的最小空闲连接
  31. spring.redis.pool.min-idle=
  32. # 连接池中逐出连接的最小空闲时间 默认1800000毫秒(30分钟)
  33. spring.redis.pool.min-evictableIdleTimeMillis=
  34. # 连接超时时间(毫秒)
  35. spring.redis.timeout=
  36. # redis cacheManager过期时间,单位秒,默认为0,代表永不过期
  37. 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. <自动化测试方案书>方案书目录排版

    自动化测试方案书 一.介绍 QQ交流群:585499566 这篇是一个系列,用来给需要做自动化测试方案的人做个参考,文章的内容是我收集网上和自己工作经验所得,希望能够给你们有所帮助 背景:因为工作需要 ...

  2. mysql数据表的基本操作:表结构操作,字段操作

    本节介绍: 表结构操作 创建数据表. 查看数据表和查看字段. 修改数据表结构 删除数据表 字段操作 新增字段. 修改字段数据类型.位置或属性. 重命名字段 删除字段 首发时间:2018-02-18  ...

  3. python3接收、解析邮件

    邮件接收 python3可以使用poplib.POP3进行邮件接收,具体如下: import poplib from email.parser import Parser def get_email( ...

  4. ERP承接新后台优惠规则问题

    一.后台在哪配置优惠规则? 1.设置优惠时间段: 2.添加优惠活动: 关于自动和手动: 自动:创建后,ERP同步数据后即生效.     点餐,活动会自动生效,自动计算金额. 手动:创建后,ERP需要手 ...

  5. Add correct host key in /root/.ssh/known_hosts to get rid of this message

    bug: Add correct host key in /root/.ssh/known_hosts to get rid of this message 解决办法: rm ~/.ssh/known ...

  6. java----自动类型转换

  7. MyBatis笔记----MyBatis查询表全部的两种方法:XML与注解

    查询单条信息的在 http://www.cnblogs.com/tk55/p/6659285.html  已经有了 XML 修改UserMapper.xml <?xml version=&quo ...

  8. [20190322]测试相同语句遇到导致cursor pin S的疑问.txt

    [20190322]测试相同语句遇到导致cursor pin S的疑问.txt--//昨天测试遇到的情况,链接:http://blog.itpub.net/267265/viewspace-26388 ...

  9. spring applicationContext.xml最全约束

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  10. 洗礼灵魂,修炼python(65)--爬虫篇—BeautifulSoup:“忘掉正则表达式吧,我拉车养你”

    前面解析了正则表达式,其实内容还挺多的对吧?确实挺适用的,不仅是python,其他语言或者web前端后端基本都要掌握正则表达式知识,但是你说,这么多,要完全的掌握,灵活运用的话,得搞多久啊?并且如果一 ...