ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Redis server response timeout (3000 ms) occured after 3 retry attempts. Command: (EXISTS), params: [

2021-01-12 21:01:20  阅读:1052  来源: 互联网

标签:retry java io occured HashedWheelTimer redisson timeout import org


Redis server response timeout (3000 ms) occured after 3 retry attempts. Command: (EXISTS), params: [XXXX], channel: [id: 0xXXXX, L:/XXXXX.45.128:44772 - R:10.122.67.XX/10.122.67.56:6379]X

rg.redisson.client.RedisResponseTimeoutException: Redis server response timeout (3000 ms) occured after 3 retry attempts. Command: (HEXISTS), params: [com.dinsmooth.storehbase.schedule:entryTaskDelay, 1f15dcac-22b6-4865-92a5-a6452e6ae5c3:154], channel: [id: 0x4d120152, L:/10.255.2.30:52607 - R:172.16.0.211/172.16.0.211:6379] at org.redisson.command.RedisExecutor$3.run(RedisExecutor.java:362) at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:682) at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:757) at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:485) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)

 

误原因:客户端长时间未使用,服务端会断开

解决办法:redisson添加配置 

#连接间隔 心跳 pingConnectionInterval: 1000

 

使用代码配置:

package io.lenovo.ecai.portalorder.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.spring.data.connection.RedissonConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {
    /**
     * 设置redisson缓存工厂,由于下面的工厂都是用的是redisson所以注意配置redissonclient
     *
     * @param client
     * @return
     */
    @Bean(name = "redissonconnectionfactory")
    public RedissonConnectionFactory getfactory(RedissonClient client) {
        return new RedissonConnectionFactory(client);
    }

    /**
     * redis单机配置
     *
     * @return
     */
    public RedissonClient getclient() {
        Config config = new Config();

        config.useSingleServer().setAddress("redis://${spring.redis.host}:${spring.redis.port}")
                .setTimeout(1000)
                .setRetryAttempts(3)
                .setRetryInterval(1000)
                .setPingConnectionInterval(1000)//**此项务必设置为redisson解决之前bug的timeout问题关键*****
                .setDatabase(3);
        return Redisson.create(config);
    }
}

 

 

 

 

标签:retry,java,io,occured,HashedWheelTimer,redisson,timeout,import,org
来源: https://blog.csdn.net/zhongguowangzhan/article/details/112547325

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有