How to install Apache Cassandra on CentOS7

How To Install Apache Cassandra On CentOS 7

Apache Cassandra is open-source NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Each Cassandra node in the cluster will have a similar job. Data is circulated over the bunch which implies every node holds various information. Cassandra underpins replication and multi-datacenter replication for excess, failover, and catastrophe recuperation. In this article, we will show you how to install Apache Cassandra on CentOS 7.

Cassandra was developed at Facebook to power the Facebook inbox search feature, and then Facebook released Cassandra as an open-source project on Google code in July 2008. The article will be divided into several section, namely :

  1. Prerequisite
  2. Add Repository
  3. Install Apache Cassandra
  4. Verify Cassandra Installation

1. Prerequisite

Before installing Apache Cassandra on our CentOS 7, we have to prepare the environment first. It requires a user with sudo privileges, sufficient space and the last update of CentOS repository. Apache Cassandra requires Java to be installed on the server, ensure that our system has had Java installed. If not installed yet, we can either install Oracle Java or OpenJDK. For Java installation, already discussed in the previous article.

We can verify our system by submitting command below:

[ramans@localhost ~]$ sudo yum update
[ramans@localhost ~]$ java -version
 openjdk version "1.8.0_232"
 OpenJDK Runtime Environment (build 1.8.0_232-b09)
 OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
Java version

Our system has already Java installed, so we don’t have to install it again .

2. Enabling Cassandra Repository

To get the right Apache Cassandra source, we must get it from the original source, we will go to the Apache Cassandra repository from its own source at https://www.apache.org/dist/cassandra/3.11.5/. Cassandra repository has to be added to our CentOS 7 repos, create the file /etc/yum.repos.d/cassandra311x.repo with following entries :

[ramans@localhost yum.repos.d]$ sudo vi /etc/yum.repos.d/cassandra311x.repo
[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
How To Install Apache Cassandra On CentOS 7|enabling repository
Setting Cassandra Repository

3. Installing Apache Cassandra

The next step is installing Cassandra based on this repostitories. Installing MongoDB by submiting command line below :

[ramans@localhost yum.repos.d]$ sudo yum -y install cassandra

4. Verifying Apache Cassandra

Apache Cassandra was installed successfuly, than we have to reload the system by submitting command below :

[ramans@localhost yum.repos.d]$ systemctl daemon-reload

Starting the Cassandra daemon by submitting command :

 [ramans@localhost yum.repos.d]$ sudo systemctl start cassandra
 [ramans@localhost yum.repos.d]$ sudo systemctl enable cassandra

Next, use the nodetool command to show the status of Apache Cassandra on current node:

[ramans@localhost yum.repos.d]$ nodetool status
 Datacenter: datacenter1
 Status=Up/Down
 |/ State=Normal/Leaving/Joining/Moving
 --  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
 UN  127.0.0.1  103.68 KiB  256          100.0%            b18deb67-9502-4ab6-9243-25029a782d20  rack1

Finally, we can use and try the Cassandra. Entering Cassandra dasboard by submitting command :

[ramans@localhost yum.repos.d]$ cqlsh
 Connected to Test Cluster at 127.0.0.1:9042.
 [cqlsh 5.0.1 | Cassandra 3.11.5 | CQL spec 3.4.4 | Native protocol v4]
 Use HELP for help.

So far, we have successfuly installed the Apache Cassandra on CentOS 7. Goodluck and have a nice day !

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *