Installation of NoSQL Database Cassandra - Advance Database

The main goal of this tutorial is to simplify installation of NoSQL Database Cassanndra on Ubuntu with correct and accurate commands, so that you learn more with NoSQL Cassandra Database.

Note: The following commands are run and tested on Ubuntu 16.04, JRE/JDk 7 and Cassandra 2.2.12 version

Download Cassandra Database Stable Release : http://www.eu.apache.org/dist/cassandra/2.2.12/apache-cassandra-2.2.12-bin.tar.gz [ 29MB ]

After downloading Cassandra [apache-cassandra-2.2.12]
  1.  Copy it to the home folder and Extract it.
  2.  Then rename the folder [in my case apache-cassandra-2.2.12] to cassandra
#Open TERMINAL and execute the following commands for Installation of Cassandra Database

#Update the System
sudo apt-get update

#Install JDK/JRE
sudo apt-get install openjdk-7-jre-headless
sudo apt-get install openjdk-7-jdk

#IF YOU ARE GETTING PROBLEM TO INSTALL JRE/JDK 7 then use following commands(Optional)
sudo apt-get install -f
sudo add-apt-repository ppa:openjdk-r/ppa  
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless
sudo apt-get install openjdk-7-jdk

#To check java version 
java -version

#Make directories
mkdir ~/cassandra/lib/data
mkdir ~/cassandra/lib/commitlog
mkdir ~/cassandra/lib/saved_caches
mkdir ~/cassandra/log

#Now check the user name of your  computer and remember it.
whoami

#Now open cassandra.yaml file 
gedit ~/cassandra/conf/cassandra.yaml

#After opening cassandra.yaml file add the following code at the end of the file

data_file_directories:
- /home/YOUR_USER_NAME/cassandra/lib/data
commitlog_directory: /home/YOUR_USER_NAME/cassandra/lib/commitlog
saved_caches_directory: /home/YOUR_USER_NAME/cassandra/lib/saved_caches

#Make sure you change YOUR_USER_NAME with your USERNAME
#Save and exit the file

#Now open logback.xml
gedit ~/cassandra/conf/logback.xml

#And replace/change the 
#LINE 35 (${cassandra.logdir}/system.log)
#in logback.xml file with the below line
/home/YOUR_USER_NAME/cassandra/log/system.log

#Make sure you change YOUR_USER_NAME with your USERNAME
#save and exit file

#Done now start Cassandra Daemons 
~/cassandra/bin/cassandra -f

# The cassandra daemon should start in the foreground 
#(don’t press ctrl + c; as it’ll terminate the daemon)

# open a new terminal
~/cassandra/bin/cqlsh

# It’ll have output like this
cqlsh>

Comments