Configuring Multi node Cassandra Cluster on Windows

Cassandra is a distributed open source (Apache Licensed) stable DBMS which is widely used by many big organizations like Google. I like Cassandra because it fits my organizational needs and has a very flexible storage structure.

Configuring a single node for testing purpose is very easy and a good tutorial is available at http://wiki.apache.org.cassandra/GettingStarted. In said tutorial you’ll find Linux-style paths but there’s no need to worry. You can specify Windows-style paths as well. It works fine so and really easy to understand so I am not going to discuss those basics here again. However I would suggest you to first go through the above link and test a single node on your machine then move on.

In this tutorial I am going to make a cluster of two nodes for simplicity. One node is hosted on Machine-A (having IP address 192.168.0.2) and other on Machine-B (having IP address 192.168.0.4). However following these steps you may add as many nodes as you want.

The game of making cluster revolves all around Cassandra.yaml configuration file which you may find under Cassandra Installation directory\conf\Cassandra.yaml.

Let’s start from Machine-A. Open Cassandra.yaml file and start editing. You need to edit cluster_name, listen_address, rpc_address and seeds values as following:


cluster_name: ‘MyCluster’

listen_address: 192.168.0.2 # IP of Machine-A

rpc_address: 192.168.0.2

seeds: 192.168.0.2

Start this node using cassandra –f command. Hopefully it will start successfully.

Now come to Machine-B. Open Cassandra.yaml and make sure that cluster_name is same as of cluster_name on Machine-A. Write IP address of Machine-B in listen_address and rpc_address while write IP address of Machine-A against seeds i.e. your configuration file will have following lines.


cluster_name: ‘MyCluster’

listen_address: 192.168.0.4 # IP of Machine-B

rpc_address: 192.168.0.4

seeds: 192.168.0.2           # IP of Machine-A.

Start this node and it should also start successfully. Once started open command prompt, navigate to Cassandra bin directory and write the following command to test that you’ve two nodes in your cluster:


nodetool – host 192.168.0.2 –p  7199 ring

The above said link states that you should set initial_token value in Cassandra.yaml. But its optional and setting this value falls in advance configuration so we’re not going to discuss it here.

There’s a good open source administration tool for Cassandra clusters: http://www.datastax.com/products/opscenter. You may find it usefull.

For further reading or troubleshooting you can visit http://wiki.apache.org/cassandra/.

Best of luck with Cassandra!

 

About these ads
  1. #1 by Abhijit on June 27, 2013 - 3:32 pm

    i followed all the above mentioned steps..and after setting up configuration in machine-B
    i am using below command:

    nodetool – host –p 7199 ring
    and it gives
    Unrecognized command: ?
    What solution do you have for this..

    • #2 by Mian Zeshan Farooqi on May 26, 2014 - 12:34 pm

      Please make sure that you’ve navigated to Cassandra/bin directory before using this command. It is also mentioned in the above text:

      “…navigate to Cassandra bin directory and write the following command…”

      Other possible solution can be to add Cassandra/bin directory in PATH of your system.

      Let me know if the problem still persists.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: