How to Install Apache Cassandra on CentOS 8

Apache Cassandra is a very popular NoSQL database created by Facebook Inc. but later owned by Apache Foundation. It was designed and built for the ease of scalability and management of large databases. Apache Cassandra is a must-go database Management System for you if your concern is high availability and scalability. This post will take you to a step-by-step guide on installing and configuring Apache Cassandra on CentOS 8 Operating system.

Installation of Apache Cassandra on CentOS 8

Apache Cassandra can be installed by downloading the RPM package through the official repository of Apache Cassandra.

But, before getting started with the installation and configuration of Apache Cassandra on CentOS 8, we need to have OpenJDK 8 installed on the CentOS 8 system.  You can verify the installed version of Java, either it is installed or not on your system, by typing the command given below:

$ java -version

If it is not installed on your system, you can install it using the procedure given below or pre-installed on your system; you can skip the installation part of OpenJDK on CentOS 8.

Install Open JDK on CentOS 8

OpenJDK is available in CentOS 8’s official repository and can easily be installed.

First of all, update the system’s package repository cache:

$ sudo dnf makecache

After updating your CentOS 8’s system repository cache, update it:

$ sudo dnf upgrade


After upgrading the system’s existing packages, you can move forward to installing OpenJDK 8 on CentOS 8 for Apache Cassandra. To install OpenJDK from CentOS 8 official repository, type the command given below in the terminal:

$ sudo dnf install java-1.8.0-openjdk-devel


Type “y” and hit “Enter”.


After installing OpenJDK, verify by typing the command given below:

$ java -version


You can witness that the installed version of OpenJDK is 1.8.0. Let’s move ahead.

Install Apache Cassandra

To install Apache Cassandra, we have to add the repository of Apache Cassandra to the system.

To add Apache Cassandra repository to the CentOS 8 system. Create a “/etc/yum.repos.d/cassandra.repo” file by typing the command:

$ sudo nano /etc/yum.repos.d/cassandra.repo

In the newly created Cassandra repository file, paste the content given below in that file.

[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


After adding the above content, save the file and exit using the keyboard shortcut keys (CTRL+S) and (CTRL+X).

Now, install the Apache Cassandra by typing the command given below:

$ sudo dnf install cassandra -y

Apache Cassandra is installed on CentOS 8. Now, Apache Cassandra’s service won’t automatically start. You first have to enable it by typing the command given below:

$ sudo systemctl enable cassandra

Then, start the service by typing the following command:

$ sudo systemctl start cassandra

Now, in order to verify, check the status of the Apache Cassandra service by typing the command given below:

$ sudo systemctl status cassandra

At this stage, Apache Cassandra is successfully installed and running perfectly fine on the CentOS 8 machine. Let’s configure it and log in to its CQL shell.

How to configure Apache Cassandra on CentOS 8

Apache Cassandra has its own CQL (Cassandra Query Language), just like SQL. To login to Cassandra’s command-line utility, known as CQL shell or “cqlsh”, we have to install an appropriate python interpreter first. To install Python 2 and access the CQL shell on CentOS 8, type the command given below:

$ sudo dnf install python2

Type “y” and press “Enter”.

Once Python2 is installed, log in to the CQL shell using the command line utility of Cassandra by typing the following command in CentOS 8 terminal:

$ cqlsh

You can witness in the screenshot; we have successfully logged in to the CQL shell.

This is how simply we can configure the Apache Cassandra on CentOS 8 and start using it.

Conclusion

Apache Cassandra Database is used by many big names in the industry like Facebook, Instagram, Netflix, and Reddit. This post contains a clear understanding and profound guide on how to install and configure Apache Cassandra on CentOS 8.



from Linux Hint https://ift.tt/2N0pC2r

Post a Comment

0 Comments