-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcassandra4-3-servers-cluster-docker-compose.yml
82 lines (76 loc) · 3.43 KB
/
cassandra4-3-servers-cluster-docker-compose.yml
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
# Latest version of the Docker-compose language to this date
version: '3.9'
# The virtual network all the nodes will be into - let Docker organize everything
# Though you can set up networks manually if you need correlation between nodes and IPs, for instance...
networks:
cassandra4-cluster-network:
services:
cassandra4-cluster-server-1:
# Feel free to fix the versions
image: cassandra:4.0
container_name: cassandra4-cluster-server-1
hostname: cassandra4-cluster-server-1
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 10s
timeout: 10s
retries: 10
networks:
- cassandra4-cluster-network
ports:
# Native port of Cassandra
- "9042:9042"
volumes:
- ./docker-volumes/cassandra4-cluster-server-1:/var/lib/cassandra
- ./docker-sources/etc-slash-cassandra4/cassandra4-cluster-server-1:/etc/cassandra
# Declare and save environments variables into "environment"
environment: &environment
# The first two nodes will be seeds
CASSANDRA_SEEDS: "cassandra4-cluster-server-1,cassandra4-cluster-server-2"
CASSANDRA_CLUSTER_NAME: CassandraPW
CASSANDRA_DC: Mars
CASSANDRA_RACK: West
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
CASSANDRA_NUM_TOKENS: 128
cassandra4-cluster-server-2:
# Feel free to fix the versions
image: cassandra:4.0
container_name: cassandra4-cluster-server-2
hostname: cassandra4-cluster-server-2
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 10s
timeout: 10s
retries: 10
networks:
- cassandra4-cluster-network
ports:
- "9043:9042" # Expose native binary CQL port for your apps
volumes:
- ./docker-volumes/cassandra4-cluster-server-2:/var/lib/cassandra # This is the volume that will persist data for cass2 node
- ./docker-sources/etc-slash-cassandra4/cassandra4-cluster-server-2:/etc/cassandra # Use your own config files for full control
environment: *environment # point to "environment" to use the same environment variables as cass1
# Set up some startup dependencies
depends_on:
- 'cassandra4-cluster-server-1'
cassandra4-cluster-server-3:
# Feel free to fix the versions
image: cassandra:4.0
container_name: cassandra4-cluster-server-3
hostname: cassandra4-cluster-server-3
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 10s
timeout: 10s
retries: 10
networks:
- cassandra4-cluster-network
ports:
- "9044:9042" # Expose native binary CQL port for your apps
volumes:
- ./docker-volumes/cassandra4-cluster-server-3:/var/lib/cassandra # This is the volume that will persist data for cass3 node
- ./docker-sources/etc-slash-cassandra4/cassandra4-cluster-server-3:/etc/cassandra # Use your own config files for full control
environment: *environment # point to "environment" to use the same environment variables as cass1
# Set up some startup dependencies
depends_on:
- 'cassandra4-cluster-server-2'