Wednesday, February 16, 2022

Running Cassandra in Docker Docker-Compose

 Docker is a software platform that allows you to build, test, and deploy applications quickly.
Docker Compose is a tool that was developed to help define and share multi-container applications.              
Apache Cassandra is an open-source distributed storage system.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      | IP -192.168.1.60        |Hostname - server.yourdomain.com
_________________________________________________________________________________________
cat /etc/system-release ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y
docker-compose --version ; docker --version
docker run -d \
    --name my-cassandra \
    -p 9042:9042 \
    -v ~/apps/cassandra:/var/lib/cassandra \
    -e CASSANDRA_CLUSTER_NAME=anand \
    cassandra:4.0

docker ps
docker exec -it my-cassandra /bin/sh
cqlsh -u cassandra -p cassandra
show version
docker ps
docker stop my-cassandra
docker rm my-cassandra
__________________________________________________________________________________________
Method - 2  Docker-Compose Tool
nano docker-compose.yaml
version: '3.9'

services:
  cassandra:
    image: cassandra:4.0
    ports:
      - 9042:9042
    volumes:
      - ~/apps/cassandra:/var/lib/cassandra
    environment:
      - CASSANDRA_CLUSTER_NAME=quicknotepad

docker-compose up -d
docker-compose ps
docker-compose exec cassandra /bin/bash
cqlsh -u cassandra -p cassandra
__________________________________________________________________________________________






No comments:

Post a Comment