How to install Apache Cassandra 3.11.x on CentOS 7

Apache Cassandra is a free NoSQL database management system. This system is designed to create highly scalable and reliable repositories of huge data arrays presented in the form of a hash. Here we describe how to install Apache Cassandra (its latest version 3.11.) For servers running CentOS 7

First! You need to understand that the server needs at least 4GB of memory. If it is less, then this can lead to instability in the work of Apache Cassandra 3.11.2 on CentOS 7.

Install OpenJDK JRE 8

The latest version of Java 8 is required for Apache Cassandra. To do this, you need to install the latest version of OpenJDK JRE 1.8

sudo yum install -y java-1.8.0-openjdk

Next, you can determine the installation result itself

java -version

A further conclusion would be something like this:

openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

Install Python 2.7 if it is not on your system

It is Python version 2.7 that is needed since in Python 3 (for example), you may have problems launching the Apache Cassandra cqlsh shell

If for some reason you donโ€™t have one, you can install it using the following command

sudo yum install python -y

Install the latest stable version of Apache Cassandra

To get started, create an Apache Cassandra 3.11.x YUM repo:

cat <<EOF | sudo tee -a /etc/yum.repos.d/cassandra311x.repo
name=Apache Cassandra

Then, install Apache Cassandra 3.11.2 using the above YUM repository:

sudo yum install cassandra -y
sudo systemctl daemon-reload

Verify Apache Cassandra Installation

You need to start the Apache Cassandra daemon:

sudo service cassandra start

Further, if everything is correct, you will receive the following output:

Starting cassandra (via systemctl):                         [  OK  ]

If you want Apache Cassandra to start automatically, then you need to run the following command:

sudo chkconfig cassandra on

You must use the nodetool program to show the status of Apache Cassandra on the current node:

nodetool status

The output will look like this:

Datacenter: datacenter1
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  103.65 KiB  256          100.0%            e977023b-7dd7-4e89-9ee7-aaa4c45df51c  rack1

You can use the cqlsh shell to interact with Apache Cassandra:

cqlsh localhost

The output should look something like this:

Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.

Next, type exit and press Enter to exit the cqlsh shell.

To stop Apache Cassandra, run the following command:

sudo service cassandra stop

Was this article helpful?

Related Articles

Leave A Comment?