“Spring Boot 连 Redis Cluster”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) |
Jihongchang(讨论 | 贡献) |
||
第62行: | 第62行: | ||
</syntaxhighlight>访问集群其实也只需要一个密码 | </syntaxhighlight>访问集群其实也只需要一个密码 | ||
− | max-redirects | + | max-redirects Maximum number of redirects to follow when executing commands across the cluster. |
+ | |||
+ | 不需要再进行 @Configuration 的配置就可以连接上1个 Redis Cluster | ||
+ | |||
+ | |||
+ | === 代码 === |
2023年2月20日 (一) 04:54的版本
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.13</version>
</parent>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
application.yml
spring:
redis:
password: vn4sj5kbxdaG
cluster:
nodes:
- 127.0.0.1:6379
- 127.0.0.1:6380
- 127.0.0.1:6381
- 127.0.0.1:6479
- 127.0.0.1:6480
- 127.0.0.1:6481
max-redirects: 3
访问集群其实也只需要一个密码
max-redirects Maximum number of redirects to follow when executing commands across the cluster.
不需要再进行 @Configuration 的配置就可以连接上1个 Redis Cluster