springboot+redis的案例很多,但是redis集群的案例很少,so~笔者在这里记录一下~
笔者使用的springboot版本为
1.5.7.RELEASE
pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
application
properties:
spring.redis.cluster.nodes=Centos6701:6379,Centos6701:6380,Centos6702:6380,Centos6702:6379,Centos6703:6380,Centos6703:6379
yaml:
spring:
redis:
cluster:
nodes:
- Centos6701:6379
- Centos6701:6379
- Centos6701:6379
- Centos6701:6379
- Centos6701:6379
- Centos6701:6379
使用:
@Autowired
RedisTemplate redisTemplate;
通俗易懂~~~