1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
| services:
redis-master:
image: redis:7
container_name: redis-master
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
volumes:
- ./conf/redis-master.conf:/usr/local/etc/redis/redis.conf
- ./data/master:/data
ports:
- "6379:6379"
networks:
redisnet:
ipv4_address: 172.28.0.10
redis-replica-1:
image: redis:7
container_name: redis-replica-1
depends_on: [redis-master]
command: ["redis-server", "/usr/local/etc/redis/redis.conf", "--replicaof", "172.28.0.10", "6379"]
volumes:
- ./conf/redis-replica.conf:/usr/local/etc/redis/redis.conf
- ./data/replica1:/data
ports:
- "6380:6379"
networks: [redisnet]
redis-replica-2:
image: redis:7
container_name: redis-replica-2
depends_on: [redis-master]
command: ["redis-server", "/usr/local/etc/redis/redis.conf", "--replicaof", "172.28.0.10", "6379"]
volumes:
- ./conf/redis-replica.conf:/usr/local/etc/redis/redis.conf
- ./data/replica2:/data
ports:
- "6381:6379"
networks: [redisnet]
sentinel-1:
image: redis:7
container_name: sentinel-1
depends_on: [redis-master, redis-replica-1, redis-replica-2]
command:
[
"sh","-c",
"cp /usr/local/etc/redis/sentinel.conf /data/sentinel.conf && exec redis-sentinel /data/sentinel.conf"
]
volumes:
- ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
- ./data/s1:/data
ports:
- "26379:26379"
networks: [redisnet]
sentinel-2:
image: redis:7
container_name: sentinel-2
depends_on: [redis-master, redis-replica-1, redis-replica-2]
command:
[
"sh","-c",
"cp /usr/local/etc/redis/sentinel.conf /data/sentinel.conf && exec redis-sentinel /data/sentinel.conf"
]
volumes:
- ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
- ./data/s2:/data
ports:
- "26380:26379"
networks: [redisnet]
sentinel-3:
image: redis:7
container_name: sentinel-3
depends_on: [redis-master, redis-replica-1, redis-replica-2]
command:
[
"sh","-c",
"cp /usr/local/etc/redis/sentinel.conf /data/sentinel.conf && exec redis-sentinel /data/sentinel.conf"
]
volumes:
- ./conf/sentinel.conf:/usr/local/etc/redis/sentinel.conf
- ./data/s3:/data
ports:
- "26381:26379"
networks: [redisnet]
networks:
redisnet:
driver: bridge
ipam:
config:
- subnet: 172.28.0.0/16
|