Balu
Balu Platform Engineer | Devops | Monitoring | CICD | ODD | SQL/NoSQL | ELK | AWS | Jhipster | Microservices | Agile | Scrum

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
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
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