Skip to content

Instantly share code, notes, and snippets.

@tnarik
Last active November 13, 2016 12:58
Show Gist options
  • Save tnarik/33b524adc4e436b45201befce3582df6 to your computer and use it in GitHub Desktop.
Save tnarik/33b524adc4e436b45201befce3582df6 to your computer and use it in GitHub Desktop.
Test setup with 3 cassandra nodes in a cluster and a client container
version: '2'
services:
cassandra-1:
image: cassandra:2
environment:
- CASSANDRA_CLUSTER_NAME="demo_3nodes"
- CASSANDRA_BROADCAST_ADDRESS=cassandra-1
ports:
- "9042:9042"
- "7000:7000"
cassandra-2:
image: cassandra:2
depends_on:
- cassandra-1
environment:
- CASSANDRA_CLUSTER_NAME="demo_3nodes"
- CASSANDRA_SEEDS=cassandra-1
- CASSANDRA_BROADCAST_ADDRESS=cassandra-2
ports:
- "9043:9042"
restart: always
cassandra-3:
image: cassandra:2
depends_on:
- cassandra-1
environment:
- CASSANDRA_CLUSTER_NAME="demo_3nodes"
- CASSANDRA_SEEDS=cassandra-1
- CASSANDRA_BROADCAST_ADDRESS=cassandra-3
ports:
- "9044:9042"
restart: always
cassandra_cqlsh:
image: cassandra:2
environment:
- CASSANDRA_CLUSTER_NAME="demo_3nodes"
command: sh -c "cqlsh cassandra-1"
@tnarik
Copy link
Author

tnarik commented Nov 13, 2016

First start the cassandra-1 node and once it the DB is running, start up cassandra-2 and cassandra-3 (relying only on the dependency with the official image makes the status somehow uncertain, and I needed this for testing a different component).

Then just create you keyspaces and tables, or let your component do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment