Springboot 配置redis连接

单机redis

 spring
   redis:
     host: 192.168.2.94
     port: 6379
     password: 123456

分片集群(cluster)

 spring
   redis:
     password: 123456   # 密码(默认为空)
     cluster:
       nodes: 192.168.2.64:6370,192.168.2.64:6371,192.168.2.64:6372,192.168.2.24:6373,192.168.2.24:6374,192.168.2.24:6375,192.168.2.34:6376,192.168.2.34:6377,192.168.2.34:6378

哨兵集群(sentinel)

spring:
    redis:
        password: 123456   # 密码(默认为空)
        sentinel:
            master: mymaster  #哨兵监控的名称,创建时自己定义
            nodes: 192.168.2.24:26373,192.168.2.24:26374,192.168.2.24:26375 #哨兵的ip:port,不是redis服务的!

  

posted @ 2021-11-10 14:38  蓝色土耳其  阅读(716)  评论(0编辑  收藏  举报