springboot2.0整合redis集群,其实好简单

配置

#redis配置
redis:
   cluster:
     nodes:
      - 127.0.0.1:9000
      - 127.0.0.1:9001
      - 127.0.0.1:9002
      - 127.0.0.1:9003
      - 127.0.0.1:9004
      - 127.0.0.1:9005
   timeout: 6000ms
   password:
   lettuce:
     pool:
       max-active: 8
       max-wait: -1ms
       max-idle: 8
       min-idle: 0
   database: 0

 

依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- 集群需要 -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
</dependency>

 

 
posted @ 2023-08-17 16:08  咔咔皮卡丘  阅读(72)  评论(0编辑  收藏  举报