Getting Started with CCM (Cassandra Cluster Manager)

Want the full cluster experience without all the hassle? CCM (Cassandra Cluster Manager) is a great tool for you to quickly create and manage a cluster on your local machine. As it connects to localhost only, it is not intended for production clusters,  but it’s great for configuration development and test clusters. A great way to practice your new Cassandra skills. Have a look at this blog post for a little more indepth info on CCM. If you want to get your cluster up and running now, let’s continue.

 

 

Requirements

In order to install/use CCM, you’re going to need: I would recommend Git, and Homebrew (on MacOSX)

 

 

Installation

When you are ready, clone the git repo

 

go into the newly created ccm directory and install ccm

 

create a test cluster and choose a version of Cassandra to run on your nodes. If you don’t already have it, the program will compile it.

 

This is now the default cluster. The following commands assume that we are operating within the context of that cluster.

 

Lets populate our cluster with 3 nodes

 

 

Note: If you’re running on Mac OSX, create a new interface for every node besides the first, for example if you populated your cluster with 3 nodes, create interfaces for 127.0.0.2 and 127.0.0.3 like so:

 

 

Or you could do up a bash script (like with this issue) to take care of the problem. Take care of this before you start up your cluster.

Now let’s get the ball rolling:

 

 

If you ran into trouble at this point, check the troubleshooting section. If all is quiet, we can check on how things went. Three nodes should start, with ip addresses 127.0.0.[1, 2, 3].

 

 

Try it out

This command will give you a list of all the commands that ccm supports

 

This command is how you would stop the cluster

 

 

 

You could have also only stopped a specific node:

 

 

This command will give you the list of clusters you have created, as well as the current default cluster, marked by a an asterisk(*). Any commands run are within the context of the current default cluster.

 

 

 

This command will show   you configuration information for a particular node

 

 

 

This command will remove the selected cluster

 

 

This command is essentially like running the nodetool command from the selected node.

 

 

Port 7000 is being used for the internal cluster communication and ports 7100, 7200 and 7300 for JMX. To bootstrap a new node into the cluster, we use ccm add  then start our new node

 

Troubleshooting

  • If you have trouble at the installation step, you made need to do a ‘sudo’

 

 

  • You may have had issue trying to start up your cluster, an exception such that an address cannot be assigned to a node

 

A three node cluster in CCM will have the address 127.0.0.1, 127.0.0.2, and 127.0.0.3 respectively.Port 9042 is the CQL native transport port. We may need to initialize more loopback interfaces. It might be useful to use a bash script like in this issue to deal with the problem.

 

  • You may have had issue trying to start up your cluster, an exception such that an address is already in use

 

 

You either have an instance of Cassandra running on your locate machine, or have failed to stop you default cluster running in CCM before attempting to start a new one (ccm stop). Figure out the PID and kill the process.

 

 

Then attempt ccm start again