Apache Cassandra, commonly known as Cassandra, is a free and open-source wide-column database. It is mainly used in critical systems to handle large amounts of data with flexibility and scalability. Therefore, Cassandra is probably your best bet if you have an environment where you need to handle a large collection of data.
This tutorial will elaborate on the installation and configuration of Apache Cassandra on Linux systems.
Please note that this tutorial is tested on Ubuntu 16 and above, Debian 8 and above, Linux Mint, and related flavors.
Requirements
Before we can begin, please ensure you have:
- Access to a terminal session
- A root or sudo user
- A network connection
Step 1 – Install Apache Cassandra Dependencies (Java JDK and Python Interpreter)
Before setting up Cassandra, ensure you have the required dependencies installed and configured on your system. By default, Cassandra requires the Java JDK, and Python interpreter installed.
Start by updating your system repository index:
Next, run the command below to install the HTTPS transports package. This will allow you to access repositories on HTTPS.
Install the JDK:
Step 2 – Setup Cassandra Repository
Start by adding the Apache repository to the sources list. Execute:
Next, import the repository keys:
Ensure you have curl installed on your system.
Update the repo index:
Finally, install Cassandra with the command:
Starting the Cassandra Service
Once installed, start the service:
The command will run the Cassandra service using systemd.
We can verify by running the command:
Output:
Stopping Cassandra
To stop the Cassandra server, run:
Restarting Cassandra Service
To restart the Cassandra service, run the command:
Enable Cassandra Start after Reboot
To enable Apache Cassandra to start after reboot, use the systemd tool as shown in the command below:
Test Cassandra Shell
You can test if you can connect to your CQL shell using the command:
If Cassandra is running, the command will automatically login to the server as shown:
You can now start executing CQL commands in the shell.
Conclusion
If you followed the steps in this tutorial, you should have a running cluster of Apache Cassandra on your Linux system.