spring-boot-start-data-redis-reactive包使用趟過的坑


[2019-01-10 11:05:03] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:03] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xf2d217fb, /ip:25550 -> host/ip:port
[2019-01-10 11:05:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0x688cbf8e, /ip:25551 -> host/ip:port
[2019-01-10 11:05:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xf266dcbc, /ip:25552 -> host/ip:port
[2019-01-10 11:05:33] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:33] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xd706f5e2, /ip:25553 -> host/ip:port
[2019-01-10 11:05:40] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:40] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0x29543207, /ip:25554 -> host/ip:port
[2019-01-10 11:05:40] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:05:40] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xad71de60, /ip:25555 -> host/ip:port
[2019-01-10 11:06:03] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:03] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0x5781f808, /ip:25556 -> host/ip:port
[2019-01-10 11:06:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xc0ab2538, /ip:25557 -> host/ip:port
[2019-01-10 11:06:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0x0dc5f68c, /ip:25558 -> host/ip:port
[2019-01-10 11:06:34] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:34] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xf6012d5d, /ip:25560 -> host/ip:port
[2019-01-10 11:06:40] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:40] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xcb89cf58, /ip:25561 -> host/ip:port
[2019-01-10 11:06:40] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:06:40] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xb45a50d5, /ip:25562 -> host/ip:port
[2019-01-10 11:07:04] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:07:04] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xc69092b3, /ip:25563 -> host/ip:port
[2019-01-10 11:07:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:07:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0x1fb4372e, /ip:25564 -> host/ip:port
[2019-01-10 11:07:10] [INFO ] [io.lettuce.core.protocol.ConnectionWatchdog:106]-- Reconnecting, last destination was host/ip:port
[2019-01-10 11:07:10] [INFO ] [io.lettuce.core.protocol.ReconnectionHandler:111]-- Reconnected to host:port, Channel channel=0xec5583ac, /ip:25565 -> host/ip:port

在開發中選用 spring-boot-starter-data-redis-reactive 包

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
            <version>2.0.5.RELEASE</version>
</dependency>

內部引用包括了

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>

打開spring-data-redis的pom文件可以看到包括

<lettuce>5.0.4.RELEASE</lettuce>
<jedis>2.9.0</jedis>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${jedis}</version>
<optional>true</optional>
</dependency>

<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>${lettuce}</version>
<optional>true</optional>
</dependency>

而開始的重連輸出就是由包lettuce-core打印的,開始以為重連是因為連接redis失敗導致的,放大了超時時間,沒有用,於是研究官網說明沒看到特殊配置,終於在https://github.com/lettuce-io/lettuce-core/issues/861看到了原因,

Lettuce is designed to maintain long-lived connections. Summarizing this issue, Lettuce behaves as designed as it reconnects after Redis disconnects idle connections regularly.

所以該提示只是包的info級別log,可以在日志配置文件中設置包日志輸出級別

eg:
<logger name="io.lettuce.core.protocol" level="ERROR">
<appender-ref ref="ERROR_FILE" />
</logger>
or
log4j.logger.my.pkg=info


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM