redis 哨兵集群配置(从0-1)

1、创建3个文件

  • s1,s2,s3
    port 27001 sentinel announce-ip ip sentinel monitor mymaster ip 7001 2 sentinel auth-pass mymaster 123456 dir "/www/server/redis/s1/"
    port 27002 sentinel announce-ip ip.45 sentinel monitor mymaster ip 7001 2 sentinel auth-pass mymaster 123456 dir "/www/server/redis/s2/"
    port 27003 sentinel announce-ip ip sentinel monitor mymaster ip 7001 2 sentinel auth-pass mymaster 123456 dir "/www/server/redis/s3/"

2、启动

  • ./src/redis-sentinel ./s2/sentinel.conf

3、整合spring-boot

  • 导入依赖
    • <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>
  • yml配置
    • 123
posted @ 2023-02-18 16:29  写代码的小哥哥  阅读(22)  评论(0)    收藏  举报