How to Install Apache Cassandra on Debian 11
Choose a different version or distribution
Introduction
Before we begin talking about how to install Apache Cassandra on Debian 11, let's briefly understand – What is Apache Cassandra?
An open-source database management system called Apache Cassandra controls the information in NoSQL databases using a cluster approach. Cassandra is a project that was started by Google in July 2008, joined the Apache Incubator project in March 2009, and later became a top-level project in February 2010.
The cluster approach used by Apache Cassandra allows it to handle large amounts of data. In the cluster mode, the data is split up across a number of nodes; each node has a unique set of data, but because they are connected, they may all access each other's nodes' data as well.
In this tutorial, you will install Apache Cassandra on Debian 11. We will also address a few FAQs on how to install Apache Cassandra on Debian 11
Advantages of Apache Cassandra
- Scalability: Apache Cassandra allows seamless scaling across multiple nodes, accommodating high data volumes and traffic fluctuations.
- High Availability: With its distributed architecture, data is replicated across nodes, ensuring fault tolerance and continuous availability.
- Performance: Cassandra's peer-to-peer design and efficient write operations enable low-latency data access for both read and write workloads.
- Flexibility: Its schema-free data model supports dynamic and evolving data structures, offering flexibility for varied use cases.
- Durability: Apache Cassandra ensures data durability by writing data to multiple nodes, protecting against hardware or node failures.
Steps to Install Apache Cassandra on Debian 11
In order to install Apache Cassandra on Debian 11, we must carry out the instructions below.
Step 1: Installation of Java
The prerequisite for Apache Cassandra on Debian 11 is Java, which needs to be installed first. Using the following command, we can install Apache Cassandra on Debian 11:
sudo apt install default-jdk -y
Java has been successfully installed.
Step 2: importation of the Cassandra key
We will use the wget command to import the Cassandra key from the official Apache website after the prerequisite has been installed:
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
"OK" should appear in the output, indicating that the key was successfully imported into the Debian 11 repository.
Step 3: Addition of Cassandra repository
The following step is to add the Cassandra repository to our Debian 11 sources.list file. To do this, use the following command:
echo "deb https://debian.cassandra.apache.org 41x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
There was no error after running the command, indicating that Cassandra's repository has been added to the sources.a list of Debian 11 files.
Step 4: Updating Debian 11 repository
We will update the Debian 11 repository after the key has been imported and the Cassandra Repository has been added.
sudo apt update
The repository has been updated, and as we can see from the output, the repository has also had its apache key updated.
Step 5: Installation of Apache Cassandra
We will use the following command in the terminal to install Cassandra:
sudo apt install cassandra
It has been set up successfully.
Step 6: Verification of installation
Using the systemctl command, we will check the installation's status in order to confirm it:
sudo systemctl status cassandra
The output indicates that Cassandra has been installed and is currently operational. Cassandra launches instantly after installation by default.
Step 7: Configuration of Apache Cassandra
Cassandra's data is kept at /var/lib/cassandra
, while Apache Cassandra configuration files are available in the Cassandra directory located in /etc/cassandra
.
We can connect to any database operating on the same machine without utilizing the binding interface because Cassandra by default only supports the local host. The cqlsh
command can be used to access Cassandra from the terminal:
cqlsh
We can see "Test Cluster" in the output, which is the name of the cluster cloud and can be changed.
Renaming of Cluster Cloud
We will use the Cassandra command to change the name of the cluster from "Test Cluster" to "VegaStack Cluster", as seen below:
UPDATE system.local SET cluster_name = 'VegaStack Cluster' WHERE KEY = 'local';
Entering "exit" will close the Cassandra.
exit
Now, open cassandra.yaml in nano editor and change the name to "VegaStack" in the Cassandra configuration file.
sudo nano /etc/cassandra/cassandra.yaml
The "VegaStack Cluster" should be used as a substitute of "Test Cluster".
Use the systemctl
command to restart Cassandra:
sudo systemctl restart cassandra
Run the command to enter Apache Cassandra once more to confirm any modifications.
cqlsh
The "VegaStack Cluster" name of the cluster cloud is displayed in the output.
How to Uninstall of Apache Cassandra
The Apache Cassandra can be removed with the command below:
sudo apt purge cassandra -y
The Apache Cassandra has been successfully eliminated.
FAQs to Install Apache Cassandra on Debian 11
What are the system requirements for installing Apache Cassandra on Debian 11?
Debian 11 requires Java 8 or later, at least 4 GB of RAM, and sufficient disk space to accommodate Cassandra's data.
How do I add the Apache Cassandra repository to Debian 11?
First, import the repository's GPG key using sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key KEYID
. Then, add the repository to /etc/apt/sources.list.d/cassandra.list
.
How can I install Apache Cassandra on Debian 11 after adding the repository?
Run sudo apt update
followed by sudo apt install cassandra
to install Apache Cassandra on Debian 11.
How do I start the Apache Cassandra service on Debian 11?
Run sudo systemctl start cassandra
to start the Cassandra service.
How can I check the status of Apache Cassandra on Debian 11?
Use the command sudo systemctl status cassandra
to check the status of the Cassandra service.
How do I enable Apache Cassandra to start automatically on boot in Debian 11?
Run sudo systemctl enable cassandra
to enable automatic startup of Cassandra on Debian 11.
Where is the configuration file for Apache Cassandra located in Debian 11?
The configuration file is located at /etc/cassandra/cassandra.yaml
.
Conclusion
Apache Cassandra's popularity grew as a result of its scalability, cluster cloud, and reliability features. In this tutorial, we've covered how to install Apache Cassandra through the command line. We first imported the Cassandra key and added its most recent repository to the Debian 11 repository after installing its prerequisite, Java. Following setup, we checked the installation and talked about removing Apache Cassandra from Debian 11.
If you have any queries, please leave a comment below, and we’ll be happy to respond to them.