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