AdSenseHeader

Step By Step Guide to install Cassandra and Cqlsh on Windows


  Today I started to play with Cassandra by installing it in my windows machine. When I am installing Cassandra in windows I faced some issues. So I thought to share this information.


Step1: Download Cassandra from http://cassandra.apache.org/download/. The current latest version                 is  2.0.1. It is a tar.gz file. Download and extract it in some location in your computer.
              For example you can extract D:\cassandra ..

             If you are using  cassandra 2.0.1 you must use the java1.7.If you are using cassandra                    earlier versions java1.6 is enough

Step 2: You should set the path of JAVA in SystemVariables.
              For Example Java_Home=C:\Program Files (x86)\Java\jre1.7.0
             And also set the Cassandra_Home=D:\cassandra;
           

Step 3:  Go to your cassandra conf folder.For example D:--->cassandra-->conf
             Change the cassandra.yaml file like fallows
               1) In the line of  #commitlog content into changed your extracting cassandra path.For                               Example as fallows
                 # commit log
                     commitlog_directory: d:/cassandra/commitlog 
and create a directory cassandra                                      named as commitlog..
             2) In the line of data_file_directories changed like fallows
                           data_file_directories:
                                    - d:/cassandra/data
                       and create a directory(folder) named as data...

Step 4:  You can start cassandra server by calling cassandra.bat available with in the                                         bin  directory.When server starts its shows like fallows
           
             



 Step 5: Now to interact with Cassandra database you need the cqlsh interactive command tool.              Here is the small twist. There is none in the cassandra download package. So there                    is a work around we should do before adding records to the database.

Step 5: Download python from the below location http://www.python.org/download/releases/. Be careful here. Though the python latest version is 3.x, there is problem with installing thrift library with the latest version of Python. So download and install 2.7 version of Python.

Step 6: Next install the PYTHON in your system.And set the path of Python in path variable.

Step 7: Now you can go to cassandra bin folder then run CQLSH.Now you connect to cassandra and create the keyspace and tables.

  • CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; 
  • Use mykeyspace.
  • create table sample(id int primary key,name text ,desg text);





      









2 comments:

  1. can u tell how to start cassandra server

    ReplyDelete
  2. This is good information. It helped me to setup the tar.gz of cassandra and cqlsh. I dont know why thrift installation instruction is not provided in apache getting started wiki page.

    ReplyDelete

 
Top