当前位置:网站首页>The remote connection to redis is disconnected and reconnected after a while

The remote connection to redis is disconnected and reconnected after a while

2022-06-11 22:36:00 Shan Xiaofeng

1. problem

You will be prompted without operating the console

[ioEventLoop-4-3] i.l.core.protocol.ReconnectionHandler    : Reconnected to *****:6379

Slow reconnection response , The experience is terrible

2. It uses lettuce Connection pool , This thing has bug, So replace it with jedis

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.lettuce</groupId>
                    <artifactId>lettuce-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>
spring.redis.jedis.pool.max-active=20
spring.redis.jedis.pool.max-wait=-1
# Maximum blocking waiting time ( A negative number means no limit )
spring.redis.jedis.pool.max-idle=5
spring.redis.jedis.pool.min-idle=0

Replace as above , I solved the reconnection problem

原网站

版权声明
本文为[Shan Xiaofeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206112234038926.html