This article is half-done without your Comment! *** Please share your thoughts via Comment ***
Now, I am going to learn and share NoSQL Apache Cassandra practical demonstration.
In the previous series of articles, I shared a basic theory about NoSQL and Apache Cassandra.
In this post, I am providing steps to install Single Node Cassandra Cluster on Ubuntu 14.04.
Step 1:
Cassandra requires Oracle Java Runtime Environment.
Install Oracle Java Virtual Machine.
Add Oracle JRE package.
1 |
sudo add-apt-repository ppa:webupd8team/java |
Step 2:
Update the database package:
1 |
sudo apt-get update |
In the second step, If you get any error like: “unable to lock directory /var/lib/apt/lists/”
Step 2.1:
Search running apt-get processes:
1 ps -A | grep apt-get
Step 2.2:
If any process is running as apt-get, kill it
123456 sudo kill -9 [process-id]--example:/*sudo kill -9 14521*/
Step 3:
Accept the license agreement and install the Oracle JRE.
1 |
sudo apt-get install oracle-java8-set-default |
Step 4:
After successfully installtion, verify JRE Version.
1 2 3 4 5 6 7 8 |
java -version --output: /* java version "1.8.0_77" Java(TM) SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) */ |
Step 5:
Install Cassandra from the official Apache Software Foundation repositories.
The latest tick-tock release is Cassandra 3.5, released on 2016-04-13.
Below commands to add repository source from www.apache.org.
In the below command, you can change the value of 35x version. e.g, for version 3.5 = 35x, for version 2.2 = 22x.
1 |
echo "deb http://www.apache.org/dist/cassandra/debian 35x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list |
1 |
echo "deb-src http://www.apache.org/dist/cassandra/debian 35x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list |
Step 6:
Require to add three public key from the Apache Software Foundation.
First key:
1 gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
1 gpg --export --armor F758CE318D77295D | sudo apt-key add -
Second key:
1 gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
1 gpg --export --armor 2B5C1B00 | sudo apt-key add -
Third key:
1 gpg --keyserver pgp.mit.edu --recv-keys 0353B12C
1 gpg --export --armor 0353B12C | sudo apt-key add -
Step 7:
Update the package.
1 |
sudo apt-get update |
Step 8:
Install Cassandra.
1 |
sudo apt-get install cassandra |
Step 9:
Check the status of Cassandra Service.
1 2 3 4 5 6 |
sudo service cassandra status --output: /* * Cassandra is running */ |
Step 10:
You can also check the status of cluster.
status UN means Up and Normal.
1 2 3 4 5 6 7 8 9 10 11 12 |
sudo nodetool status -- output /* ubuntu@ip-:~$ sudo 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 110.53 KB 256 100.0% 6e9ccab2-f9c1-40cf-8cb5-abbf95b84342 rack1 */ |
Step 11:
Now, You can connect Cassandra Query Language command line interface.
1 |
cqlsh |