How to Install Apache Cassandra on Debian 11
Introduction
Apache Cassandra is an open-source NoSQL distributed database engine. NoSQL database engines store data as key-value pairs, and Apache Cassandra comes with Cassandra Query Language (CQL) for retrieving the data. It can handle large amounts of data while ensuring availability and consistency. It supports single-node replication and multi-location replication for redundancy, no single point of failure, and disaster recovery. It runs several nodes within a cluster, where each single node can receive and process a complete request without communication to the master node.
This article explains how to install Apache Cassandra on Debian 11.0 server.
Prerequisites
Perform the following steps first:
- Deploy a Vultr Debian 11.0 Server.
- Connect to the server with SSH.
- Update the server.
- Create a non-root user with sudo access.
1. Install Java
For Apache Casandra to run, you need Java installed in your server. Install Java.
$ sudo apt install openjdk-11-jdk -y
Check the Java version installed.
$ java -version
2. Configure Apache Cassandra Repository
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 https://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list'
3. Install Apache Cassandra
Update the system.
$ sudo apt update
Install Apache Cassandra.
$ sudo apt install cassandra -y
Enable Apache Cassandra to start on system boot.
$ sudo systemctl enable cassandra
Check the status of the Apache Cassandra service.
$ sudo systemctl status cassandra
Check the status of your cluster. You might need to wait for a couple of seconds for all nodes in the cluster to finish starting up.
$ sudo nodetool status
4. Configure Apache Cassandra
Log in with the cqlsh
command-line tool to interact with Cassandra cluster.
$ cqlsh
When finished, exit the prompt.
EXIT;
Conclusion
You have installed Apache Cassandra on Debian 11.0 server. You can check the official documentation to learn more about using and managing the database server.