redis报错:java.net.SocketException: Broken pipe (Write failed); nested exception is redis.clients.jedi...

   最近写了一个服务通过springboot构建,里面使用了redis作为缓存,发布到服务器运行成功,但是有时候会报redis的错误:org.springframework.data.redis.RedisConnectionFailureException: java.net.SocketException: Broken pipe (Write failed); nested exception is redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Broken pipe (Write failed)   

  在网上查了一下原因是因为redis的客户端超时时间超时导致写入失败,然后我把配置文件的 timeout 参数设置为0 同时配置testOnReturn,testWhileIdle,testOnBorrow为true 这样就没有提示这样的错误了

#客户端超时时间
redis.timeout=0
#是否在从池中取出连接前进行检验,如果检验失败,则从池中去除连接并尝试取出另一个
redis.testOnBorrow=true  
#在空闲时检查有效性, 默认false
redis.testWhileIdle=true  
#是否进行有效性检查
redis.testOnReturn=true

 

 SpringBoot|MVC|SpringCloud

 技术交流QQ群号:216868740

转载于:https://www.cnblogs.com/tangyin/p/9951181.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值