In this blog post, we’ll look into the process of installing the Cassandra database in a Linux environment.
Environment details are as follows :
Cassandra Version:3.11.3.5117
1. Before starting the Cassandra Installation we have to make sure that Java is installed in our machine.
[root@localhost ~]# java -version
java version “1.8.0_241”
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
[root@localhost ~]#
2.Download the software from Datastax website using the below link :
https://downloads.datastax.com/#ddac
https://downloads.datastax.com/#enterprise
3. Create one “Cassandra” user at the OS level to manage Cassandra Binaries :
[root@localhost ~]# useradd cassandra
as if we try to install Cassandra using root user, in that case, we will get below error :
[root@localhost bin]# ./cassandra
Running Cassandra as root user or group is not recommended – please start Cassandra using a different system user.
If you really want to force running Cassandra as root, use -R command line option.
[root@localhost bin]#
4.Copy Cassandra software tar file to a Linux server and extract this zip file :
Login to user Cassandra and extract software files.
[root@localhost ~]# su – cassandra
[cassandra@localhost ~]$ ls -ltr
-rw-rw-r–. 1 cassandra cassandra 50529803 Jan 29 2020 ddac-5.1.17-bin.tar.gz
[cassandra@localhost ~]$ tar -xvf ddac-5.1.17-bin.tar.gz
5. In order to perform Single node cluster installation, we need to execute the “Cassandra” binary which is located under the “bin” directory.
[cassandra@localhost ~]$ ll
total 49352
drwxr-xr-x. 9 cassandra cassandra 4096 Sep 30 16:49 ddac-5.1.17
-rw-rw-r–. 1 cassandra cassandra 50529803 Jan 29 2020 ddac-5.1.17-bin.tar.gz
[cassandra@localhost ~]$ cd ddac-5.1.17
[cassandra@localhost ddac-5.1.17]$ ll
total 564
drwxr-xr-x. 2 cassandra cassandra 4096 Sep 30 16:44 bin
-rw-r–r–. 1 cassandra cassandra 4832 Sep 30 16:44 CASSANDRA-14092.txt
-rw-r–r–. 1 cassandra cassandra 17653 Sep 30 16:44 CHANGES-DSE.txt
-rw-r–r–. 1 cassandra cassandra 364468 Sep 30 16:44 CHANGES.txt
drwxr-xr-x. 2 cassandra cassandra 4096 Sep 30 16:44 conf
drwxr-xr-x. 2 cassandra cassandra 4096 Sep 30 16:44 interface
drwxr-xr-x. 3 cassandra cassandra 4096 Sep 30 16:44 lib
drwxrwxr-x. 2 cassandra cassandra 4096 Sep 30 16:49 licenses
-rw-r–r–. 1 cassandra cassandra 26187 Sep 30 16:44 LICENSE.txt
-rw-r–r–. 1 cassandra cassandra 120798 Sep 30 16:44 NEWS.txt
-rw-r–r–. 1 cassandra cassandra 2811 Sep 30 16:44 NOTICE.txt
drwxr-xr-x. 3 cassandra cassandra 4096 Sep 30 16:44 pylib
drwxr-xr-x. 4 cassandra cassandra 4096 Sep 3
[cassandra@localhost ddac-5.1.17]$ cd bin/
[cassandra@localhost bin]$ ./cassandra
Upon executing above command it creates a “Data” directory under the installation directory location and creates following directories.
[cassandra@localhost ddac-5.1.17]$ cd data/
[cassandra@localhost data]$ ll
total 16
drwxrwxr-x. 2 cassandra cassandra 4096 Jan 29 02:33 commitlog
drwxrwxr-x. 7 cassandra cassandra 4096 Jan 29 02:34 data
drwxrwxr-x. 2 cassandra cassandra 4096 Jan 29 02:33 hints
drwxrwxr-x. 2 cassandra cassandra 4096 Jan 29 02:33 saved_caches
[cassandra@localhost data]$
In case if we want to change the location of the above directories in that case before executing “./Cassandra” binary file we can change the following parameters into the cassandra.yaml configuration file.
When the directory locations are excluded or commented out in the cassandra.yaml, Cassandra uses the default locations:
data_file_directories
: installation_location/data/datacommitlog_directory
: installation_location/data/commitlogsaved_caches_directory
: installation_location/data/saved_cacheshints_directory
: installation_location/data/hintscdc_raw_directory
installation_location/data/cdc_raw
6.Once the setup is ready we can verify the status of Cassandra database using below command:
[cassandra@localhost ddac-5.1.17]$ cd bin/
[cassandra@localhost bin]$ pwd
/home/cassandra/ddac-5.1.17/bin
[cassandra@localhost bin]$ ./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.48 KiB 256 100.0% 581e9b09-c55f-4c4b-9525-d5f9a570f2bd rack1
[cassandra@localhost bin]$
We can refer below link in order to understand more about “./nodetool status” command:
===========================
https://docs.datastax.com/en/dse/6.0/dse-admin/datastax_enterprise/tools/nodetool/toolsStatus.html
===========================
Happy Learning 🙂