-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdocker-compose.yml
69 lines (66 loc) · 2.49 KB
/
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
networks:
cassandra: # docker network where all cassandra nodes will be put in
services:
cass1:
image: cassandra:3.11.13 # better to use a specific version, if you want to control upgrades
container_name: cass1
hostname: cass1
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 5s
timeout: 5s
retries: 60
networks:
- cassandra
ports:
- "9042:9042" # Expose native binary CQL port for your apps
volumes:
- ./data/cass1:/var/lib/cassandra # This is the volume that will persist data for cass1 node
- ./etc/cass1:/etc/cassandra # Use your own config files for full control
environment: &environment # Declare and save environments variables into "environment"
CASSANDRA_SEEDS: "cass1,cass2" # The first two nodes will be seeds
CASSANDRA_CLUSTER_NAME: SolarSystem
CASSANDRA_DC: Mars
CASSANDRA_RACK: West
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
CASSANDRA_NUM_TOKENS: 128
cass2:
image: cassandra:3.11.13
container_name: cass2
hostname: cass2
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 5s
timeout: 5s
retries: 60
networks:
- cassandra
ports:
- "9043:9042" # Expose native binary CQL port for your apps
volumes:
- ./data/cass2:/var/lib/cassandra # This is the volume that will persist data for cass2 node
- ./etc/cass2:/etc/cassandra # Use your own config files for full control
environment: *environment # point to "environment" to use the same environment variables as cass1
depends_on:
cass1: # start cass2 only after cass1 is healthy
condition: service_healthy
cass3:
image: cassandra:3.11.13
container_name: cass3
hostname: cass3
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 5s
timeout: 5s
retries: 60
networks:
- cassandra
ports:
- "9044:9042" # Expose native binary CQL port for your apps
volumes:
- ./data/cass3:/var/lib/cassandra # This is the volume that will persist data for cass3 node
- ./etc/cass3:/etc/cassandra # Use your own config files for full control
environment: *environment # point to "environment" to use the same environment variables as cass1
depends_on:
cass2: # start cass3 only after cass1 is healthy
condition: service_healthy