Cassandra - Cassandra single node cluster as a container


Cassandra - Cassandra single node cluster as a container

Cassandra - Cassandra single node cluster as a container
  • How to run cassandra as a container?
  • How to run cassandra as a single node cluster?

To answer the above, Docker provides a Docker Official Images for Apache Cassandra, is an open-source distributed storage system.

Create the docker-compose

  • Create a docker-compose.yml with the following
version: '3'
services:
    cassandra-one:
        image: cassandra:3.9
        # volumes:
        #     - cassandra-volume:/var/lib/cassandra/
        ports:
            - 7000:7000
            - 7001:7001
            - 7199:7199
            - 9042:9042
            - 9160:9160
        environment:
            - CASSANDRA_CLUSTER_NAME='sample-cluster'
            - CASSANDRA_NUM_TOKENS=256
            - CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
            - CASSANDRA_DC=sample-datacenter-one
            - CASSANDRA_RPC_ADDRESS=0.0.0.0
        restart: always
# volumes:
#   cassandra-volume:
#     driver: local
#     driver_opts:
#       o: bind
#       type: none
#       device: /root/db/cassandra-volume/
    

Try in PWD

  • To maintain the persistency of the data uncomment the volumes in the service and respective Volume

comments powered by Disqus