Introduction
Apache Cassandra is an open-source NoSQL database engine used to store large amounts of data in a distributed architecture with dynamic replication. It delivers high performance, linear scalability, high availability, and fault tolerance. This article explains how to how to install Apache Cassandra on Ubuntu 20.04 server.
Prerequisites
- Deploy a fully updated Rcs Ubuntu 20.04 Server.
- Create a non-root user with sudo access.
Install Apache Cassandra
Install Java.
$ sudo apt install openjdk-8-jdk -y
Verify the installation.
$ java -version
Install the required dependencies.
$ sudo apt install apt-transport-https gnupg2 -y
Download and add the Apache Cassandra GPG key.
$ sudo wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
Add the downloaded repository.
$ sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'
Update the system.
$ sudo apt update
Install Apache Cassandra.
$ sudo apt install cassandra -y
Verify the status of the Apache Cassandra.
$ sudo systemctl status cassandra
Verify the stats of your node.
$ sudo nodetool status
Configure Apache Cassandra
By default, Apache Cassandra listens for a cluster named Test Cluster on localhost.
Log in with the
cqlsh
command-line tool to interact with Cassandra.$ cqlsh
Change the Cluster name.
UPDATE system.local SET cluster_name = 'My Cluster' WHERE KEY = 'local';
Exit the prompt.
EXIT;
Edit the Cassandra configuration file
cassandra.yaml
.$ sudo nano /etc/cassandra/cassandra.yaml
Find the
cluster_name
directive and edit it to your preference. Save and exit the file.cluster_name: 'My Cluster'
Clear the system cache.
$ nodetool flush system
Restart the Cassandra service.
$ sudo systemctl restart cassandra
Verify the changes.
$ cqlsh
More Information
For more information on Apache Cassandra, please visit the official documentation.