-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
62 lines (59 loc) · 1.52 KB
/
docker-compose.yml
File metadata and controls
62 lines (59 loc) · 1.52 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
services:
# Shard 1 - Users with ID hash % 3 == 0
postgres_shard1:
image: postgres:18-bookworm
container_name: shard1_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: shard_db
ports:
- "5433:5432"
volumes:
- shard1_data:/var/lib/postgresql
- ./init/shard1:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# Shard 2 - Users with ID hash % 3 == 1
postgres_shard2:
image: postgres:18-bookworm
container_name: shard2_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: shard_db
ports:
- "5434:5432"
volumes:
- shard2_data:/var/lib/postgresql
- ./init/shard2:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# Shard 3 - Users with ID hash % 3 == 2
postgres_shard3:
image: postgres:18-bookworm
container_name: shard3_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: shard_db
ports:
- "5435:5432"
volumes:
- shard3_data:/var/lib/postgresql
- ./init/shard3:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
volumes:
shard1_data:
shard2_data:
shard3_data: