Skip to content

Instantly share code, notes, and snippets.

@chyh1990
Created May 22, 2017 11:30
Show Gist options
  • Select an option

  • Save chyh1990/00ad088273a649de304a29258ccd3f87 to your computer and use it in GitHub Desktop.

Select an option

Save chyh1990/00ad088273a649de304a29258ccd3f87 to your computer and use it in GitHub Desktop.
cassandra-two-dc-test
# docker-compose Cassandra Test Cluster
# docker-compose rm
# docker-compose up
# docker run -it --link cassandra_cassandra-1_1:cassandra --rm cassandra cqlsh cassandra
# copy paste the test script on cassandra-1
# run select on cassandra-2
#
cassandra-1:
hostname: cassandra-1
image: cassandra:3.10
command: /bin/bash -c "sleep 1 && echo ' -- Pausing to let system catch up ... -->' && /docker-entrypoint.sh cassandra -f"
environment:
- CASSANDRA_SEEDS=cassandra-1,cassandra-3
- CASSANDRA_CLUSTER_NAME=test-cluster
- CASSANDRA_DC=cn-north
- CASSANDRA_RACK=az1
- CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
expose:
- 7000
- 7001
- 7199
- 9042
- 9160
volumes: # uncomment if you desire mounts, also uncomment cluster.sh
- ./data/cassandra-1:/var/lib/cassandra:rw
cassandra-2:
hostname: cassandra-2
image: cassandra:3.10
command: /bin/bash -c "sleep 20 && echo ' -- Pausing to let system catch up ... -->' && /docker-entrypoint.sh cassandra -f"
environment:
- CASSANDRA_SEEDS=cassandra-1
- CASSANDRA_CLUSTER_NAME=test-cluster
- CASSANDRA_DC=cn-north
- CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
- CASSANDRA_RACK=az1
links:
- cassandra-1
- cassandra-3
expose:
- 7000
- 7001
- 7199
- 9042
- 9160
volumes: # uncomment if you desire mounts, also uncomment cluster.sh
- ./data/cassandra-2:/var/lib/cassandra:rw
cassandra-3:
hostname: cassandra-3
image: cassandra:3.10
command: /bin/bash -c "sleep 5 && echo ' -- Pausing to let system catch up ... -->' && /docker-entrypoint.sh cassandra -f"
environment:
- CASSANDRA_SEEDS=cassandra-1,cassandra-3
- CASSANDRA_CLUSTER_NAME=test-cluster
- CASSANDRA_DC=cn-south
- CASSANDRA_RACK=az1
- CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
links:
- cassandra-1
expose:
- 7000
- 7001
- 7199
- 9042
- 9160
volumes: # uncomment if you desire mounts, also uncomment cluster.sh
- ./data/cassandra-3:/var/lib/cassandra:rw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment