docker/redis/docker-compose-ha.yml
2017-09-16 01:23:00 +08:00

99 lines
2.6 KiB
YAML

version: '3'
networks:
&network network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/16
services:
&master redis-master:
build:
context: ./conf-ha/
dockerfile: Dockerfile-master
container_name: "master"
ports:
- "6379:6379"
restart: on-failure
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
*network :
ipv4_address: 172.16.238.10
redis-slave-1:
build:
context: ./conf-ha/
dockerfile: Dockerfile-slave
container_name: "slave"
ports:
- "6380:6379"
restart: on-failure
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
*network :
ipv4_address: 172.16.238.11
depends_on:
- *master
redis-sentinel-1:
build:
context: ./conf-ha/
dockerfile: Dockerfile-sentinel
container_name: "s1"
ports:
- "26379:26379"
restart: on-failure
command: [ "redis-sentinel", "/usr/local/etc/redis/sentinel.conf" ]
networks:
*network :
ipv4_address: 172.16.238.21
depends_on:
- *master
redis-sentinel-2:
build:
context: ./conf-ha/
dockerfile: Dockerfile-sentinel
container_name: "s2"
ports:
- "26380:26379"
restart: on-failure
command: [ "redis-sentinel", "/usr/local/etc/redis/sentinel.conf" ]
networks:
*network :
ipv4_address: 172.16.238.22
depends_on:
- *master
redis-sentinel-3:
build:
context: ./conf-ha/
dockerfile: Dockerfile-sentinel
container_name: "s3"
ports:
- "26381:26379"
restart: on-failure
command: [ "redis-sentinel", "/usr/local/etc/redis/sentinel.conf" ]
networks:
*network :
ipv4_address: 172.16.238.23
depends_on:
- *master
redis-sentinel-4:
build:
context: ./conf-ha/
dockerfile: Dockerfile-sentinel
container_name: "s4"
ports:
- "26382:26379"
restart: on-failure
command: [ "redis-sentinel", "/usr/local/etc/redis/sentinel.conf" ]
networks:
*network :
ipv4_address: 172.16.238.24
depends_on:
- *master