Article

Table of Contents
Theme:
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles!

Install Apache Cassandra on Ubuntu 20.04

Author: Thomas Rakwach

Last Updated: Tue, Oct 5, 2021
Databases Ubuntu

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

Install Apache Cassandra

  1. Install Java.

    $ sudo apt install openjdk-8-jdk -y
    
  2. Verify the installation.

    $ java -version
    
  3. Install the required dependencies.

    $ sudo apt install apt-transport-https gnupg2 -y
    
  4. Download and add the Apache Cassandra GPG key.

    $ sudo wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
    
  5. 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'
    
  6. Update the system.

    $ sudo apt update
    
  7. Install Apache Cassandra.

    $ sudo apt install cassandra -y
    
  8. Verify the status of the Apache Cassandra.

    $ sudo systemctl status cassandra
    
  9. 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.

  1. Log in with the cqlsh command-line tool to interact with Cassandra.

    $ cqlsh
    
  2. Change the Cluster name.

    UPDATE system.local SET cluster_name = 'My Cluster' WHERE KEY = 'local';
    
  3. Exit the prompt.

    EXIT;
    
  4. Edit the Cassandra configuration file cassandra.yaml.

    $ sudo nano /etc/cassandra/cassandra.yaml
    
  5. Find the cluster_name directive and edit it to your preference. Save and exit the file.

    cluster_name: 'My Cluster'
    
  6. Clear the system cache.

    $ nodetool flush system
    
  7. Restart the Cassandra service.

    $ sudo systemctl restart cassandra
    
  8. Verify the changes.

    $ cqlsh
    

More Information

For more information on Apache Cassandra, please visit the official documentation.

Want to contribute?

You could earn up to $600 by adding new articles