Cassandra – Installation

Before Installation of Cassandra , we need to go through some prerequisites. Below are the steps provided to install Cassandra on Linux environments.

Prerequisites

Ensure that you have latest version of Java

 

  • Java 1.8
  • Python 2.7

 

1. Check the version of JDK in your linux system

$ java -version

2. If Java software is already existing then it should show like below

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

>> If you dont have the above, then go to Oracle Java SE Downloads, accept the license agreement, and download the installer for your distribution.

>> Download the rpm package for linux and give the below command.

$ sudo rpm -ivh jdk-8uversion-linux-x64.rpm

>> Once after the installation you need to set the path for JAVA home location.

$ export JAVA_HOME=/usr/java/
$ export PATH=$JAVA_HOME/bin:$PATH

3. Verify the Java installation again

$ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

4. Create a User called Cassandra

# useradd cassandra
# passwd cassandra

5. Create home directory for cassandra

# mkdir /cassandra
# chmod -R 775 /cassandra

6. You need to set the path for Cassandra home location

$ export CASSANDRA _HOME=/cassandra
$ export PATH=$CASSANDRA_HOME/bin:$PATH

 

Installation Procedure

1. Download Apache Cassandra 3.0 from http://cassandra.apache.org/download/

$ wget http://www.apache.org/dyn/closer.lua/cassandra/3.0.13/apache-cassandra-3.0.13-bin.tar.gz

2. Use the following command to untar:

$ tar zxvf apache-cassandra-3.0.13-bin.tar.gz

3. Move all the contents from apache-cassandra-3.0.13 to /cassandra

$ mv apache-cassandra-3.0.13/*  /cassandra

4. To configure Cassandra, go to the conf directory:

$ cd /cassandra/conf

5. Single-node cluster installations only.

a. Start Cassandra:

$ cd /cassandra/
$ bin/cassandra

NOTE: use -f to start Cassandra in the foreground

b. Verify Cassandra is running:

$ 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.12 KB   256   100%   c068f249-1f64-45a8-bedf-1828d55f5165 rack1