
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 Vultr Ubuntu 20.04 Server.
- Create a non-root user with sudo access.
Install Apache Cassandra
Install Java.
$ sudo apt install openjdk-8-jdk -yVerify the installation.
$ java -versionInstall the required dependencies.
$ sudo apt install apt-transport-https gnupg2 -yDownload 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 updateInstall Apache Cassandra.
$ sudo apt install cassandra -yVerify the status of the Apache Cassandra.
$ sudo systemctl status cassandraVerify 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
cqlshcommand-line tool to interact with Cassandra.$ cqlshChange 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.yamlFind the
cluster_namedirective and edit it to your preference. Save and exit the file.cluster_name: 'My Cluster'Clear the system cache.
$ nodetool flush systemRestart the Cassandra service.
$ sudo systemctl restart cassandraVerify the changes.
$ cqlsh
More Information
For more information on Apache Cassandra, please visit the official documentation.