SpringBoot集成Redis集群

只需要修改为如下集群模式的配置

spring:
  redis:
    #Redis 集群模式
    #password: larry123456
    cluster:
      nodes: 192.168.127.128:6379,192.168.127.129:6379,192.168.127.130:6379,192.168.127.131:6379,192.168.127.132:6379,192.168.127.133:6379
    #Redis 哨兵模式
    #password: larry123456
    #sentinel:
    #  master: larry-master
    #  nodes: 192.168.127.130:26379,192.168.127.128:26379,192.168.127.129:26379
    #Redis 单机模式
 #   host: 192.168.127.128
 #   port: 6379
 #   password: larry123456

这里的集群架构为redis 3主3从

相关推荐