Dockerized Cassandra-Part2
Overview on Cassandra
History of Cassandra
- Cassandra was developed at Facebook for inbox search.
- It was open-sourced by Facebook in July 2008.
- Cassandra was accepted into Apache Incubator in March 2009.
- It was made an Apache top-level project since February 2010
Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. It is a type of NoSQL database. Let us first understand what a NoSQL database does.
Docker Installation & Creation of a Cassandra Cluster Using Docker Image.
Prerequisites
Enter “ sudo su “ to change it to Root user.
Enter “ apt-get update “ for updating the available packages.
Install Docker
wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
Restart the Docker demon
sudo service docker restart
Creation of Cassandra Cluster
Run the below command to create a Cassandra instance
Sysntax: docker run –name some-cassandra -d cassandra:tag
In the above command,
- “some-cassandra” will be the container name.
- “tag” will be the version of the Cassandra cluster to be installed.
Example: docker run –name ttc-cassandraG1 -d cassandra:3.7
ttc-cassandraG1: is the name of the container.
The above command, creates a single Cassandra instance, by pulling the docker image of the latest cassandra version.
a. Run the below command to get the list of all available containers
-> “ Docker ps –a “
b. Use the docker run –link option to tell the new node where the first is
Syntax:
docker run –name some-cassandra2 -d –link some- cassandra:cassandra cassandra:tag
- docker run –name ttc-cassandraG2 -d –link ttc-cassandraG1:cassandra cassandra:3.7
- docker run –name ttc-cassandraG3 -d –link ttc-cassandraG1:cassandra cassandra:3.7
The above command creates 2 more Cassandra instances, by referring the 1st node.
Execute the command:
- “ docker ps –a “
To view the list of all created containers.
And the Cassandra Cluster is created successfully.