Cassandra cluster on local machine with CCM


CCM (Cassandra Cluster Manager) is the tool for creating a cassandra cluster on local machine without any difficulty, But CCM is only use for the test cluster for local machine it will not use for production purpose.

So we start with install the CCM on our local machine with following instruction.

$ git clone https://github.com/pcmanus/ccm.git
$ cd ccm && ./setup.py install

Now its time to jump into the CCM, So first we create a cluster with the CCM.

$ ccm create test -v 2.1.8

In above command with the help of -v flag we define cassandra version here its 2.1.8

Now we will define number of node for the above test cluster as below

$ ccm populate -n 4
$ ccm status

Here -n is use for number of node here its 4.
After populating ccm cluster when you see status of the cluster you will see all nodes are down so we should up it with the following command, below command will start cluster and up all the nodes in the cluster.

$ ccm start

With the help of CCM we can also run any command over the specific node as below

$ ccm <NODE_NAME> <COMMAND>

for example

$ccm node1 showlog

Above command show all the logs of node1 in test cluster.We can also see the token distribution on cluster with ring command

$ccm node1 ring

We can simply add and delete node from the cluster as follows

$ccm node1 remove
$ccm add node5 -i 127.0.0.5

CCM have lot of command for  cluster and node specific command so get all list of
command simply run

$ccm --help 

At last we simply run cassandra shell (cqlsh) on cluster as below

$ccm node2 cqlsh

After you will open cqlsh on cluster you will see the log that connect to test cluster at 127.0.0.2:9042.

Screenshot from 2016-02-29 16:56:05

So now all cqlsh command will be run on cassandra cluster. So explore CCM command more and play with your cluster.

About sandeep

I m working as an software consultant in Knoldus Software LLP . I m working on scala, play, spark,hive, hdfs, hadoop and many big data technologies.
This entry was posted in Scala. Bookmark the permalink.

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