pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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>
</dependency>
首先是 application.properties
server.port=8080
spring.redis.database=0
spring.redis.cluster.nodes=192.168.228.130:8001,192.168.228.130:8002,192.168.228.131:8003,192.168.228.131:8004,192.168.228.132:8005,192.168.228.132:8006
spring.redis.password=
spring.redis.pool.max-active=8
spring.redis.pool.max-wait=-1