-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathdocker-compose.cluster.yml
More file actions
85 lines (73 loc) · 3.28 KB
/
docker-compose.cluster.yml
File metadata and controls
85 lines (73 loc) · 3.28 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
version: '3.8'
services:
# Here we have six Valkey containers with Cluster mode enabled,
# three of them will work as primary nodes and each one of
# will have a replica, so in case of failures, the replica becomes the primary.
# They are configured by the `cluster_initiator` container.
# To make Docker compatible with Valkey Cluster, you need to use Docker's host
# networking mode. Please see the --net=host option in the Docker documentation
# for more information.
valkey_1:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_1
command: valkey-server --port 36001 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_2:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_2
command: valkey-server --port 36002 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_3:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_3
command: valkey-server --port 36003 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_4:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_4
command: valkey-server --port 36004 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_5:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_5
command: valkey-server --port 36005 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_6:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_6
command: valkey-server --port 36006 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_7:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_7
command: valkey-server --port 36007 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_8:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_8
command: valkey-server --port 36008 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
valkey_9:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: valkey_9
command: valkey-server --port 36009 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
# Ephemeral container to create the valkey cluster connections.
# Once the setup is done, this container shuts down
# and the cluster can be used by the service app container
cluster_initiator:
image: 'valkey/valkey:latest'
network_mode: "host"
container_name: cluster_initiator
command: valkey-cli --cluster create localhost:36001 localhost:36002 localhost:36003 localhost:36004 localhost:36005 localhost:36006 localhost:36007 localhost:36008 localhost:36009 --cluster-replicas 2 --cluster-yes
tty: true
depends_on:
- valkey_1
- valkey_2
- valkey_3
- valkey_4
- valkey_5
- valkey_6
- valkey_7
- valkey_8
- valkey_9