Monday 7 December 2015

Cassandra Installations on Windows Machine

Cassandra Installations on Windows Machine

 Prior to installations set up Java in windows and set environment paths as well

Step 1)
Download Cassandra tar file in your windows machine of any location
Click below link to download tar file
If u want new version of Cassandra click on the latest version or else check the version in Cassandra archives (check this section of above URL -> Previous and Archived Cassandra Server Releases)
Click on the tar file. It will download into your windows machine















Step 2)
Go to Download tar file location and extract files using (WinZip or 7zip)
Copy the extracted file into your any drive. In my Case I am placing it in ‘D :/< location>’
Location means your Cassandra extracted file

Step 3)
Set up Cassandra home path in environment variables (see the below screen shot to set path in environment variables)
 


















CASSANDRA_HOME=D :\< location of Cassandra>

Step 4) 
We have to modify 2 configurations in Conf/Cassandra.yaml file in the Cassandra
Go to Cassandra.yaml file and search for this line ( Commitlog_Directory and data_file_directories)
CommitLogDirectory: /var/lib/cassandra/commitlog
               And change the line into
              CommitLogDirectory:  D :/< location of Cassandra/commitlog
              Create commit log folder in the specified location (As mentioned above)
                           data_file_directories : /var/lib/Cassandra/Data
              and change the line to
              data_file_directories:  D :/< location of Cassandra/data
Create data folder in the specified location (As mentioned above)
See Screenshot below for better understanding





Step 5)
Once the above 4 steps are done as mentioned above
Go to command prompt in windows -> then switch to Cassandra folder location -> run the Cassandra instance by entering Cassandra.bat command
Then enter
Cassandra-cli.bat in another terminal to interact with Cassandra
See Screenshot for better understanding
























So once everything is working fine it means that installations done properly

Thursday 3 December 2015

Cassandra Introduction

Cassandra:
 Apache Cassandra is column oriented No SQL Data base for processing large amount of data that is spawned across multiple clusters and nodes.  Cassandra process unstructured data and data is going to store in terms of key-values pairs. It has some unique features comparing to other data models.
 Features                                                                                                                                                       
·         High available service
·         No single point of failure
·         Linear scale performance
·         Easy data distribution across multiple data centers

Some of differences in key features:  RDBMS Vs Cassandra
Feature
RDBMS
Cassandra
Type of Data
Only deals with structured data
Deals with Unstructured data
Schema
Fixed schema
Flexible schema can be designed according to data
Relationships
Through joins and foreign keys between tables
In this it will represent through collections
Data Storage
In terms of tables by rows and columns
In terms of Nested key-value pairs
Data model
Database-> tables
Keyspaces->column families
Row Representation
Row is nothing but individual record present in table
Row represents replication
Column Representation
Series of relations
It represents storage

The top 5 most common use cases are: 
1. Internet of Things
Cassandra is a perfect fit for scaling time-series data from users, devices, and sensors.

2. Personalization
Use Cassandra to ingest and analyze for custom, fast, low cost, scalable user experiences.
3. Messaging
Cassandra’s original Facebook use case; storing, managing, and analyzing messages requires sophisticated systems and massive scale.
4. Fraud detection
Staying a step ahead of fraud has become best solved at the database level. Apache Cassandra lets you analyze patterns quickly, accurately, and effectively.
5. Playlist
Product catalogs; movie ratings; you name it. Storing a collection of user selected items has massive performance and availability demands. 


Next Article we are going to see how we work with Key  spaces in Cassandra

Cassandra Operations Part 1( Working with Key spaces )

Cassandra operations:
In this article we are going to create, alter and delete key spaces in Cassandra.  Key spaces are like data bases in Cassandra. In side of Key spaces we can able to create tables and we can load data into tables further
We are going to learn the following concepts from this article




For this first we will go to cqlsh mode and to connect with local Cassandra cluster as shown in below

Go to Cassandra installed location and to bin location and type. /cqlsh
Observe the below screen shot for better understanding



Creation of Key space

 Before going to create first we will check what the key spaces that present in Cassandra.  For this we can use DESC command to get the list of key spaces present in Cassandra.


From the above screen shot we can observe these steps
1)      This step will give the key spaces present in the Cassandra. If we observe there are 5 key spaces present as of now
2)      Creation of Key Space Sample_Cassandra   as shown in step 2 with options Replication.
In this replication we have to mention the class name and replication factor
3)      Checking either Sample_Cassandra created or not using DESC command once again



Altering Key space:

We can alter the already existing key space with this Command Alter.
In this current example we are Altering the Sample_Cassandra that we created in the above step           

If we observe the above screen shot we are altering schema with replication factor value as ‘3 ‘
So we can check the modified schema by seeing key space information as mention below
Just as similar to SQL command in Cassandra also supports same query language.

So to see the keyspace information we can see like executing command as below
Query: Select * from system.shema_keyspaces;
From the below screen shot we can able to find out the Schema details of key spaces present in the Cassandra.

In the above screen shot we can check the keyspaces schemas present in the Cassandra. Total it returned 6 rows each represents one key space.

Dropping Key space:

We can drop key space present in Cassandra using Drop command

From the above screen shot we will observe the following
1)      Dropping Keyspace Sample_Cassandra
2)      Checking either schema dropped or not using DESC command



Next article we will see Table operations in Cassandra