redis-sentinel

7

哨兵yaml

一主两从三哨兵

version: '3.8'

# redis集群 1 主 2 从

services:
  redis_master:
    image: redis:7.2
    container_name: r-master
    network_mode: "host"
    volumes:
      - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./data/m1:/data
    command: redis-server /usr/local/etc/redis/redis.conf --port 6379

  redis_slave-1:
    image: redis:7.2
    container_name: r-slave1
    network_mode: "host"
    volumes:
      - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./data/s1:/data
    command: redis-server /usr/local/etc/redis/redis.conf --port 6380 --replicaof 192.168.2.130 6379

  redis_slave_2:
    image: redis:7.2
    container_name: r-slave2
    network_mode: "host"
    volumes:
      - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./data/s2:/data
    command: redis-server /usr/local/etc/redis/redis.conf --port 6381 --replicaof 192.168.2.130 6379

# sentinel 集群
  sentinel-1:
    image: redis:7.2
    container_name: s-1
    network_mode: "host"
    volumes:
      - ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
    command: redis-sentinel /usr/local/etc/redis/sentinel.conf --port 26379

  sentinel-2:
    image: redis:7.2
    container_name: s-2
    network_mode: "host"
    volumes:
    volumes:
      - ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
    command: redis-sentinel /usr/local/etc/redis/sentinel.conf --port 26380

  sentinel-3:
    image: redis:7.2
    container_name: s-3
    network_mode: "host"
    volumes:
      - ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
    command: redis-sentinel /usr/local/etc/redis/sentinel.conf --port 26381

附件地址:http://mirror.zhaoxi.work/docker_compose_yaml/sentinel.yaml.tar