SpringBoot版本:2.0.4.RELEASE
redis版本:redis-5.0.3
JDK:1.8
工具:idea
版本管理:maven
- Spring Boot 创建项目 选择2.0.4.RELEASE版本
- 添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
- application.yml 中添加配置文件
spring:
redis:
database: 0
timeout: 500ms
jedis:
pool:
max-active: 200
max-idle: 100
min-idle: 8
max-redirects: 3
test-on-borrow: true
test-on-return: false
max-wait: 500ms
block-when-exhausted: true
cluster:
nodes:
- 192.168.1.11:7001
- 192.168.1.11:7002
- 192.168.1.11:7003
- 结束