-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.redis.yml
More file actions
69 lines (65 loc) · 1.97 KB
/
Copy pathdocker-compose.redis.yml
File metadata and controls
69 lines (65 loc) · 1.97 KB
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
version: "3.9"
# Topologia: 6 masters × 2 replicas. Cada nó roda 3 instâncias:
# - redis-a (port 6379): master do slot do próprio nó
# - redis-b (port 6380): replica do master do nó (i-1)%6 (vizinho anterior)
# - redis-c (port 6381): replica do master do nó (i-2)%6 (dois antes)
# Anel com offsets +1 e +2: qualquer 2 nós caindo, todo master tem
# ao menos 1 replica viva em host diferente → failover continua funcionando.
services:
redis-a:
image: redis:7-alpine
container_name: cluster-redis-a
restart: always
network_mode: host
command: >
redis-server /etc/redis/redis.conf
--port 6379
--dir /data/redis-a
--cluster-config-file nodes.conf
--pidfile /data/redis-a/redis.pid
volumes:
- ./redis/redis.conf:/etc/redis/redis.conf:ro
- /data/redis-a:/data/redis-a
healthcheck:
test: ["CMD", "redis-cli", "-p", "6379", "ping"]
interval: 5s
timeout: 3s
retries: 5
redis-b:
image: redis:7-alpine
container_name: cluster-redis-b
restart: always
network_mode: host
command: >
redis-server /etc/redis/redis.conf
--port 6380
--dir /data/redis-b
--cluster-config-file nodes.conf
--pidfile /data/redis-b/redis.pid
volumes:
- ./redis/redis.conf:/etc/redis/redis.conf:ro
- /data/redis-b:/data/redis-b
healthcheck:
test: ["CMD", "redis-cli", "-p", "6380", "ping"]
interval: 5s
timeout: 3s
retries: 5
redis-c:
image: redis:7-alpine
container_name: cluster-redis-c
restart: always
network_mode: host
command: >
redis-server /etc/redis/redis.conf
--port 6381
--dir /data/redis-c
--cluster-config-file nodes.conf
--pidfile /data/redis-c/redis.pid
volumes:
- ./redis/redis.conf:/etc/redis/redis.conf:ro
- /data/redis-c:/data/redis-c
healthcheck:
test: ["CMD", "redis-cli", "-p", "6381", "ping"]
interval: 5s
timeout: 3s
retries: 5