Pages

Friday, September 28, 2012

How to Install Cassandra and Configure Cassandra on your windows?


Install Cassandra and Configure Cassandra on your windows Step by Step

First we must download Cassandra from the Apache Cassandra Source

Now unzip the file and put it into a drive where you want to store your Cassandra.you can change the folder name cause deafult name is "apache-cassandra-0.5.1".


Its to long to remember easily.So i moved and changed unzip folder name to "E:\cassandra". 

Now we have our Cassandra in a spacific drive. Lets go install and configure Cassandra database on windows XP / Windows 7.

Before moving to CASSANDRA Installation,

We must be installed and value of the environment variable “JAVA_HOME” must be set to its JRE Directory. Please follow the below steps to Complete CASSANDRA Installation & Configurations 

If you already setup JAVA_HOME Variable on your system, Please skip Step 1.

Step 1 : To Step up JAVA_HOME Variable on your System, Please visit this Setting JAVA_HOME Environment Variable

Step 2 : Create three New Folders anyware(inside the E:\cassandra/new folder or out of the E:\cassandra) your  in your directory structure with names commitlog, data, saved cache

Step 3: Go to Cassandraa extracted archive and navigate to folder named “conf”
Step 4: Open the file named “cassandra.yaml” in your favorite text editor.
Step 5: In the “Cassandra.yaml” Set the values of

“data_file_directories” to the path of newly created “data” folder.
“commitlog_directory” to the path of newly created “commitlog” folder.
“saved_caches_directory” to the path of newly created “saved cache” folder.

So my values in “cassandra.yaml” look like this:

# directories where Cassandra should store data on disk.
data_file_directories:
    - E:\cassandra\storage\data
# commit log
commitlog_directory: E:\cassandra\storage\commitlog
# saved caches
saved_caches_directory: E:\cassandra\storage\savedcaches

Step 6: Add new environment variable “CASSANDRA_HOME” and set its value to the path of your Cassandra folder (Follow the Step 1)

Step 7: Open cmd and navigate to the bin in your “Cassandra” folder and type cassandra -f as like below

E:\cassandra\bin>cassandra -f

Starting Cassandra Server
INFO 20:55:02,639 Logging initialized
INFO 20:55:02,668 Heap size: 1070399488/1070399488
INFO 20:55:02,670 JNA not found. Native methods will be disabled.
INFO 20:55:02,690 Loading settings from file:/C:/cassandra/conf/cassandra.yaml
INFO 20:55:02,893 DiskAccessMode 'auto' determined to be standard, indexAccessMode is standard
INFO 20:55:03,144 Global memtable threshold is enabled at 340MB
INFO 20:55:03,146 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,161 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,166 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,171 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,177 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,183 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,326 Opening C:\cassandra\storage\data\system\Schema-g-3
INFO 20:55:03,362 Opening C:\cassandra\storage\data\system\Schema-g-2
INFO 20:55:03,367 Opening C:\cassandra\storage\data\system\Schema-g-1
INFO 20:55:03,393 Opening C:\cassandra\storage\data\system\Migrations-g-3
INFO 20:55:03,399 Opening C:\cassandra\storage\data\system\Migrations-g-2
INFO 20:55:03,404 Opening C:\cassandra\storage\data\system\Migrations-g-1
INFO 20:55:03,423 Opening C:\cassandra\storage\data\system\LocationInfo-g-7
INFO 20:55:03,427 Opening C:\cassandra\storage\data\system\LocationInfo-g-5
INFO 20:55:03,431 Opening C:\cassandra\storage\data\system\LocationInfo-g-6
INFO 20:55:03,518 Loading schema version 177dc9d0-a283-11e0-0000-242d50cf1fdf
INFO 20:55:03,949 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,953 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,957 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,961 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,965 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,970 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,973 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:03,976 Removing compacted SSTable files (see http://wiki.apache.org/cassandra/MemtableSSTable)
INFO 20:55:04,008 Creating new commitlog segment C:\cassandra\storage\commitlog\CommitLog-1309377304008.log
INFO 20:55:04,027 Replaying C:\cassandra\storage\commitlog\CommitLog-1309373839356.log
INFO 20:55:04,087 Finished reading C:\cassandra\storage\commitlog\CommitLog-1309373839356.log
INFO 20:55:04,090 Log replay complete, 0 replayed mutations
INFO 20:55:04,101 Cassandra version: 0.8.1
INFO 20:55:04,102 Thrift API version: 19.10.0
INFO 20:55:04,102 Loading persisted ring state
INFO 20:55:04,103 Starting up server gossip
INFO 20:55:04,128 Enqueuing flush of Memtable-LocationInfo@4239289(29/36 serialized/live bytes, 1 ops)
INFO 20:55:04,129 Writing Memtable-LocationInfo@4239289(29/36 serialized/live bytes, 1 ops)
INFO 20:55:04,181 Completed flushing C:\cassandra\storage\data\system\LocationInfo-g-8-Data.db (80 bytes)
INFO 20:55:04,213 Starting Messaging Service on port 7000
INFO 20:55:04,221 Compacting Major: [SSTableReader(path='C:\cassandra\storage\data\system\LocationInfo-g-6-Data.db'), SSTableReader(path='C:\cassandra\storage\data\system\LocationInfo-g-5-Data.db'), SSTableReader(path='C:\cassandra\storage\data\system\LocationInfo-g-8-Data.db'), SSTableReader(path='C:\cassandra\storage\data\system\LocationInfo-g-7-Data.db')]
INFO 20:55:04,291 Using saved token 52141074183849440117505924565797785791
INFO 20:55:04,293 Enqueuing flush of Memtable-LocationInfo@24223536(53/66 serialized/live bytes, 2 ops)
INFO 20:55:04,294 Writing Memtable-LocationInfo@24223536(53/66 serialized/live bytes, 2 ops)
INFO 20:55:04,294 Major@9300338(system, LocationInfo, 467/770) now compacting at 16777 bytes/ms.
INFO 20:55:04,341 Completed flushing C:\cassandra\storage\data\system\LocationInfo-g-10-Data.db (163 bytes)
INFO 20:55:04,350 Compacted to C:\cassandra\storage\data\system\LocationInfo-tmp-g-9-Data.db.  770 to 447 (~58% of original) bytes for 3 keys.  Time: 128ms.
INFO 20:55:04,354 Will not load MX4J, mx4j-tools.jar is not in the classpath
INFO 20:55:04,427 Binding thrift service to localhost/127.0.0.1:9160
INFO 20:55:04,433 Using TFastFramedTransport with a max frame size of 15728640 bytes.
INFO 20:55:04,439 Listening for thrift clients...
 
Step 8: Now your cassandra server have started to work on your localhost with portno 9160. You will see the line 4 issue

INFO 20:55:02,670 JNA not found. Native methods will be disabled.

This issue can resolve by download / Installation JAVA JNA

Step 9: Now lets Connect with Cassandra by following cmnds on your new command probmt
a. E:\cassandra\bin

b. Enter cassandra-cli.bat
c. your output will be 
Starting Cassandra Client
Welcome to the Cassandra CLI.

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

d. Then Connect with Cluster by using below cmnds
connect localhost/9160;
output will be 
Connected to: "Test Cluster" on localhost/9160
[default@unknown]

Step 10: Congratulations, you have successfully finished Cassandra Installation and Configuration. Now you can play with create a Cassandra Data model. 

My upcoming article will talk about Create / Managing keyspaces, Columnfamily, Columns as well as More Concepts on Cassandra. as well as you may get idea about to connecting Drupal with Cassandra db.

Related Posts

overview of Cassandra and Datamodel
Setting JAVA_HOME Environment Variable

2 comments:

  1. To seek for a job of Web Developer in a software organization of high repute, where I can utilize my knowledge of Java, C++, Tiles, XHTML, Struts, HTML CM Synergy, JSP, Apache Web server, Microsoft and employ my experience in handling web pages; monitoring software, hardware and networking problems.

    apache jobs

    ReplyDelete
  2. how to install JAVA JNA on windows.....pls help

    #########################
    ## stuconceo@gmail.com ##
    #########################

    ReplyDelete