Skip to main content

Step-by-Step Guide to Installing Apache Cassandra on Ubuntu

Apache Cassandra is a high-performance, distributed NoSQL database designed to handle large volumes of data across many servers with no single point of failure. This guide will walk you through the process of installing Cassandra on an Ubuntu system.


Prerequisites

  1. Ubuntu System: This guide assumes you're using Ubuntu 20.04 or later.
  2. Java Installed: Apache Cassandra requires Java (JRE version 8 or later).
  3. Root or Sudo Access: Ensure you have administrative privileges.

Step 1: Update System Packages
    Always start with updating your package index to ensure all dependencies are up-to-date. Open a terminal and run:

    sudo apt update && sudo apt upgrade -y

Step 2: Install Java

    Apache Cassandra requires Java to run. You can install OpenJDK using the following commands:

     sudo apt install openjdk-11-jdk -y

    Verify the installation:

    java -version

    The output should display the Java version installed.

Step 3: Add the Cassandra Repository
    To get the latest stable version of Cassandra, add the Apache Cassandra repository to your system:

    Import the GPG key:

    curl https://downloads.apache.org/cassandra/KEYS | sudo gpg --dearmor -o /usr/share/keyrings/cassandra-archive-keyring.gpg

    Add the repository:

    echo "deb [signed-by=/usr/share/keyrings/cassandra-archive-keyring.gpg] https://downloads.apache.org/cassandra/debian 40x main" | sudo tee /etc/apt/sources.list.d/cassandra.list

Step 4: Install Apache Cassandra
    Update the package list and install Cassandra:
    sudo apt update
    sudo apt install cassandra -y

Step 5: Start and Enable Cassandra
    After the installation, start the Cassandra service and enable it to run at boot:
    sudo systemctl start cassandra
    sudo systemctl enable cassandra
    
    Check the service status to confirm it's running:
    
    sudo systemctl status cassandra

Step 6: Verify the Installation
    To ensure Cassandra is running correctly, use the cqlsh tool (Cassandra Query Language Shell):
    cqlsh

    You should see a prompt like this:

    Connected to Test Cluster at 127.0.0.1:9042.
    [cqlsh 6.0.0 | Cassandra 4.x.x | CQL spec 3.x.x | Native protocol vX]
    Use HELP for help.

    Exit cqlsh by typing:
    
    exit

Step 7: Configure Cassandra (Optional)
    The default configuration works well for testing, but for production, you'll likely need to modify the cassandra.yaml file:

    sudo nano /etc/cassandra/cassandra.yaml

    Key configurations to consider:
  • Cluster Name: Set a meaningful cluster name.
  • Seed Nodes: Define the seed nodes in your cluster.
  • Data Directory: Ensure sufficient disk space is allocated.
  • Heap Size: Adjust for optimal performance.
    After making changes, restart Cassandra:

    sudo systemctl restart cassandra

Step 8: Enable Firewall Rules
    If your system uses a firewall, allow Cassandra's ports (default: 9042 for CQL, 7000 for intra-node communication):

    sudo ufw allow 9042/tcp
    sudo ufw allow 7000/tcp

    

Conclusion

Congratulations! You have successfully installed Apache Cassandra on Ubuntu. You can now use this powerful NoSQL database for your applications.

For more details, refer to the official Apache Cassandra documentation or join the active community for support.


    Feel free to comment below if you encounter any issues during the installation!




                

Comments

Popular posts from this blog

How to Change Git Remote Origin: A Step-by-Step Guide

Introduction Changing the remote origin of your Git repository is a common task, especially when you need to move your repository to a different hosting service or update its URL. In this step-by-step guide , we will walk you through the process of changing the remote origin of your Git repository. Prerequisites Before you begin, make sure you have the following: A Git repository with the current remote origin. A new URL or location where you want to set the new remote origin. Step 1: Verify the Current Remote Origin URL Open your terminal and navigate to your Git repository's root directory. Use the following command to view your current remote configuration: git remote -v This command will display the current remote origin URL, fetch URL, and push URL. Step 2: Remove the Current Remote Origin (Optional) If you wish to completely remo...

How to solve internet problem for ubuntu in virtual box?

You can access internet on virtual box by two way one is bridge network or host only. today i show you the host only option. First you need to create a Host only network in virtual box virtual box -> file -> preferences -> network -> Host-only network  Click add button Click DHCP, click Enable Server Select virtual OS, go to setting -> network Now login to your ubuntu os and do the following            sudoedit /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # NAT auto eth0 iface eth0 inet dhcp # Host only auto eth1 iface eth1 inet dhcp After VM reboot hope everything worked fine.

Deploying a React Project on an Ubuntu Server: A Step-by-Step Guide

Introduction Deploying a React project on an Ubuntu server is a crucial step to make your web application accessible to users worldwide. In this tutorial, we'll walk through the process of deploying a React project on an Ubuntu server, complete with step-by-step instructions and accompanying images to guide you along the way. Prerequisites Before you begin, ensure you have the following: An Ubuntu server (either a physical server or a virtual machine) Basic knowledge of the Linux command line Node.js and npm installed on your server Your React project's build files ready for deployment Step 1: Connect to Your Ubuntu Server Begin by accessing your Ubuntu server using SSH. Open your terminal and run the following command: ssh username@server_ip_address Replace username with your server's username and server_ip_address with your server's actual IP address. Step 2: Update ...