
Apache Cassandra is an open-source NoSQL database system designed to handle a large amount of data. It supports clusters spanning multiple data centers and high availability with no single point of failure. It offers a lot of features including, Highly Scalable, Distributed, Replication Support, Fault-tolerant, MapReduce support, Query language, and many more. If you are looking for scalability and high availability without compromising performance then Apache Cassandra is the best choice for you.
In this tutorial, we will show you how to install Apache Cassandra on CentOS 8.
Table of Contents
Prerequisites
- A CentOS 8 VPS (we’ll be using our SSD 2 VPS plan)
- Access to the root user account (or access to an admin account with root privileges)
Step 1: Log in to the Server & Update the Server OS Packages
First, log in to your CentOS 8 server via SSH as the root user:
You will need to replace ‘IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.
Before starting, you have to make sure that all CentOS packages installed on the server are up to date. You can do this by running the following commands:
Step 2: Install Java
Apache Cassandra requires Java 8 to be installed in your system. You can install it by running the following command:
After installing Java 8, verify the installed version of Java with the following command:
You should see the following output:
Step 3: Install Apache Cassandra
By default, Apache Cassandra is not available in the CentOS 8 default repo. So you will need to create a repo for that. You can create it with the following command:
Add the following lines:
[cassandra]
name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/311x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS
Save and close the file then install the Apache Cassandra with the following command:
Step 4: Create a Systemd Service File For Apache Cassandra
Next, you will need to create a systemd service file to manage the Cassandra service. You can create it with the following command:
Add the following lines:
Save and close the file then reload the systemd daemon with the following command:
Next, start the Cassandra service and enable it to start at system reboot:
Next, verify the Apache Cassandra with the following command:
If everything is fine, you should get the following output:
Step 5: Connect to Cassandra with CQL
Cassandra Query Language (CQL) is a query language for the Apache Cassandra database. It is used for communicating with the Apache Cassandra database. You can use the cqlsh utility to interact with Cassandra through CQL. But, cqlsh requires Python 2 to be installed in your system. You can install it with the following command:
Next, run the following command to access the CQL:
Once connected, you should get the following output:
Step 6: Rename Cassandra Cluster Name
By default, the Cassandra cluster is set to “Test Cluster”. You can change it through the cqlsh:
First, connect to the CQL using the following command:
Next, change the cluster name with the following command:
Next, exit from the CQL with the following command:
Next, open the Cassandra default configuration file and change the cluster name:
Change the following line:
Save and close the file then flush the system cache and restart the Cassandra service to apply the changes:
Congratulations! you have successfully installed Apache Cassandra on CentOS 8.
Follow this guide for installing Apache Cassandra on Ubuntu 20.04
Of course, you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
yes you are right…In today’s digital age, there is a ton of data that is stored and passed through the world wide web. All this data comes forth from different devices like – computers, tablets, smartphones, etc. Handling this sheer amount of data from various sources is a huge undertaking. With Big Data becoming a staple for business models, data management can be an issue that needs to be addressed