连接redis中配置的节点:
spring:
redis:
cluster:
nodes: 8.136.33.185:7000,8.136.33.185:7001,8.136.33.185:7002,8.136.33.185:7003,8.136.33.185:7004,8.136.33.185:700 ,8.136.33.185:7006,8.136.33.185:7007
报错:节点不存在,超时
2021-09-26 19:50:17.638 WARN 17696 --- [ioEventLoop-4-3] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7002]: connection timed out: /172.19.27.236:7002
2021-09-26 19:50:17.639 WARN 17696 --- [ioEventLoop-4-4] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7003]: connection timed out: /172.19.27.236:7003
2021-09-26 19:50:17.638 WARN 17696 --- [ioEventLoop-4-1] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7000]: connection timed out: /172.19.27.236:7000
2021-09-26 19:50:17.638 WARN 17696 --- [ioEventLoop-4-2] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7001]: connection timed out: /172.19.27.236:7001
2021-09-26 19:50:17.644 WARN 17696 --- [ioEventLoop-4-4] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7007]: connection timed out: /172.19.27.236:7007
2021-09-26 19:50:17.644 WARN 17696 --- [ioEventLoop-4-1] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7004]: connection timed out: /172.19.27.236:7004
2021-09-26 19:50:17.644 WARN 17696 --- [ioEventLoop-4-3] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7006]: connection timed out: /172.19.27.236:7006
2021-09-26 19:50:17.645 WARN 17696 --- [ioEventLoop-4-2] i.l.c.c.t.DefaultClusterTopologyRefresh : Unable to connect to [172.19.27.236:7005]: connection timed out: /172.19.27.236:7005
2021-09-26 19:50:30.473 WARN 17696 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.connection.ClusterCommandExecutionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000
2021-09-26 19:50:30.481 WARN 17696 --- [ main] io.lettuce.core.RedisChannelHandler : Connection is already closed
2021-09-26 19:50:30.482 WARN 17696 --- [ main] io.lettuce.core.RedisChannelHandler : Connection is already closed
2021-09-26 19:50:30.483 WARN 17696 --- [ main] io.lettuce.core.RedisChannelHandler : Connection is already closed
2021-09-26 19:50:30.607 WARN 17696 --- [ main] io.lettuce.core.RedisChannelHandler : Connection is already closed
详细信息:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-09-26 19:50:30.688 ERROR 17696 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.connection.ClusterCommandExecutionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.10.jar:5.3.10]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.5.jar:2.5.5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.5.jar:2.5.5]
at com.bdqn.RedisSessionManagerApplication.main(RedisSessionManagerApplication.java:10) ~[classes/:na]
Caused by: org.springframework.data.redis.connection.ClusterCommandExecutionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 172.19.27.236:7000
at org.springframework.data.redis.connection.ClusterCommandExecutor.collectResults(ClusterCommandExecutor.java:267) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.data.redis.connection.ClusterCommandExecutor.executeCommandAsyncOnNodes(ClusterCommandExecutor.java:210) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.data.redis.connection.ClusterCommandExecutor.executeCommandOnAllNodes(ClusterCommandExecutor.java:178) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.data.redis.connection.lettuce.LettuceClusterServerCommands.executeCommandOnAllNodes(LettuceClusterServerCommands.java:390) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.data.redis.connection.lettuce.LettuceClusterServerCommands.getConfig(LettuceClusterServerCommands.java:240) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.data.redis.connection.DefaultedRedisConnection.getConfig(DefaultedRedisConnection.java:1416) ~[spring-data-redis-2.5.5.jar:2.5.5]
at org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction.getNotifyOptions(ConfigureNotifyKeyspaceEventsAction.java:76) ~[spring-session-data-redis-2.5.2.jar:2.5.2]
at org.springframework.session.data.redis.config.ConfigureNotifyKeyspaceEventsAction.configure(ConfigureNotifyKeyspaceEventsAction.java:57) ~[spring-session-data-redis-2.5.2.jar:2.5.2]
at org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration$EnableRedisKeyspaceNotificationsInitializer.afterPropertiesSet(RedisHttpSessionConfiguration.java:333) ~[spring-session-data-redis-2.5.2.jar:2.5.2]
error: Unable to connect to [172.19.27.236:7002]: connection timed out: /172.19.27.236:7002 【所有节点都不对】
是redis集群环境下会改变节点?
#已引入
<!--springboot-redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--spring-data-redis session 管理-->
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>