Friday, January 11, 2013

Apache Cassandra : Starting with Command Line Interface



Starting with Apache Cassandra Command Line Interface

Command Line Interface (CLI) can be used to interact with Apache Cassandra server and execute the some execution that be done by using Client code.
Now, I’ll walk you thru some basic operations with Apache Cassandra Command Line Interface (CLI).

Step 1: Start the Apache Cassandra Server by running <Cassandra_home>\bin\Cassandra.bat file.
 

Step 2: Start the Command Line Interface from <Cassandra_home>\bin\cassandra-cli.bat
file.


Step 3: Connect you Cassandra CLI with Cassandra Server.
Command: connect localhost/9160;


Step 4: Displaying existing Keyspaces.
Command : show keyspaces;
Description: It will display all the existing keyspaces in the connected Cassandra server.


Step 5: Creating new keyspace;
Command : Create keyspace <keyspacename>;
Ex: create keyspace MuraliKeySpace;

Step 6: Use existing keyspace;
Command : use <keyspacename>;
Ex: use MuraliKeySpace;
Once you connected to any keyspace, the default@unknown will be changed to
default@<KeySpaceName>. Now, it is changed to default@MuraliKeySpace.

Step 7: Creating column family.
Command: create column family <ColumnFamilyName>;
Ex: create column family users;


Saturday, January 5, 2013

Apache Cassandra on Windows 7

How to install Apache Cassandra on Windows 7 Systems

First download the Apache Cassandra from the following url.
    

      Make sure that you’ve JAVA installed in your machine. If not , please install it.


      Extract the tar.gz using 7-zip or any other application.


   Once it is extracted as apache-cassandra-1.2.0-bin.tar, extract it again using 7-zip.


   Extraction in progress….


   Once the extraction is completed, you will see the following folders.



   Now go to bin directory and execute the cassandra.bat file using command prompt. Always run the command window with Run As administrator mode.You’ll get the below screen if everything worked fine. Before running cassandra.bat, make sure you’ve JAVA_HOME variable is created.



    Open another command window. Execute the cassandra-cli.bat file. This is a Command Line Interface to interact with Cassandra. Once it is connected successfully with Cassandra server, you’ll get the below screen.



     To verify the connection, just execute describe cluster; command.


    Type exit; to come out from Cassandra cli console.

Friday, January 4, 2013

Apache Cassandra




What is Apache Cassandra?
               Apache Cassandra is an open source distributed database system is designed to store and manage huge amount of data across servers. It is highly scalable and consistent. Cassandra is a scalable NoSQL database. It can maintain structured, semi-structured and un-structured data with no single point of failure.
             
              Originally Cassandra created for Facebook. Cassandra consists of distributed system techniques from Amazon Dynamo and the data model from Google’s BigTable. Cassandra was open source in Feb 2008 by Facebook. Cassandra first started as an incubation project at Apache in January of 2009.  

Below are some of the basic concepts in Apache Cassandra:

Cluster: The machines in a logical Cassandra instance
Keyspace: A container for ColumnFamilies. In simple words, it is very similar to RDBMS database.
ColumnFamilies: Container for columns.
Column: It is a triplet which contains name, value and a timestamp.
SuperColumns: Can be thought as columns that themselves have subcolumns.

Cassandra download link: Cassandra is java based open source application. You can download Cassandra from the following location.

Cassandra Source code: You can download Cassandra source code from the following location.