Setting up local Cassandra cluster using CCM

Cassandra Cluster Manager (CCM) is a set of scripts that helps in creating/managing local Cassandra cluster for testing and development purpose. It's a very handy tool that supports a lot of option and creates the cluster with one command, with no pain of updating the configuration files etc.

Let's see how to setup a local cluster using CCM.

Pre-requisite

Install CCM (https://github.com/pcmanus/ccm)
Java 7 recommended. If using Java 8, please use version 2.1.1 or higher else you might end up facing CASSANDRA-7028

Once CCM is installed there are few additional things to be done if using OSX like in may case. The steps are also mentioned on CCM site

$sudo ifconfig lo0 alias 127.0.0.2 up
$sudo ifconfig lo0 alias 127.0.0.3 up
$sudo ifconfig lo0 alias 127.0.0.4 up

Once done, we just need to run a command to setup the cluster

$ccm create demo-cluster -v 2.1.1 -n 3 -s

demo-cluster is the name of the cluster
-v tells version of Cassandra to be used
-n tells number of nodes in the cluster, here we have used 3 nodes

Once the cluster has been setup, we can see it using status command

bash-3.2$ jps
11011 Jps
9994 CassandraDaemon
9995 CassandraDaemon
9996 CassandraDaemon

bash-3.2$ ccm status
Cluster: 'demo'
---------------
node1: UP
node3: UP
node2: UP

This is how the cluster looks in Datastax OpCenter

OpCenter

CCM does support a lot of other features, can find more using ccm help command

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.