version: '2'
services:
master:
image: redis ## 镜像
container_name: redis-master
ports:
- "6380:6379"
privileged: true
networks:
- redis-master
slave1:
image: redis ## 镜像
container_name: redis-slave-1
ports:
- "6381:6379" ## 暴露端口
command: redis-server --slaveof redis-master 6379
depends_on:
- master
privileged: true
networks:
- redis-master
slave2:
image: redis ## 镜像
container_name: redis-slave-2
ports:
- "6382:6379" ## 暴露端口
command: redis-server --slaveof redis-master 6379
depends_on:
- master
privileged: true
networks:
- redis-master
networks:
redis-master:
version: '2'
services:
sentinel1:
image: redis
container_name: redis-sentinel-1
command: redis-sentinel /usr/local/etc/redis/sentinel.conf
ports:
- "26380:26379"
volumes:
- "./sentinel1.conf:/usr/local/etc/redis/sentinel.conf"
privileged: true
networks:
- redis-network
sentinel2:
image: redis
container_name: redis-sentinel-2
ports:
- "26381:26379"
command: redis-sentinel /usr/local/etc/redis/sentinel.conf
volumes:
- "./sentinel2.conf:/usr/local/etc/redis/sentinel.conf"
privileged: true
networks:
- redis-network
sentinel3:
image: redis
container_name: redis-sentinel-3
ports:
- "26382:26379"
command: redis-sentinel /usr/local/etc/redis/sentinel.conf
volumes:
- "./sentinel3.conf:/usr/local/etc/redis/sentinel.conf"
privileged: true
networks:
- redis-network
networks:
redis-network:
port 26379
dir /tmp
sentinel monitor mymaster 服务器ip 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 100000
sentinel deny-scripts-reconfig yes
port 26379
dir /tmp
sentinel monitor mymaster 服务器ip 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 100000
sentinel deny-scripts-reconfig yes
port 26379
dir /tmp
sentinel monitor mymaster 服务器ip 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 100000
sentinel deny-scripts-reconfig yes