This tutorial is designed to help you configure Cassandra Cluster on DigitalOcean instances. I will walk you through the process of installing Cassandra on one node and show you how to configure other nodes, so we can create a cluster.

Before we start go ahead and create droplets yourself. For my configuration I have chosen Ubuntu 14.04 on a $20 a month VPS and selected London as my region.


Step 1 – Login

Once we have created our droplets it is time to start the setup process. Step 1 is to ‘Login’ for a first time and change the default password. If you chose to set an ssh key this step will not be required.


Login to instance


Usually somewhere here I will most likely hit ‘sudo apt-get update’. It is always good to keep your server up-to-date.

Step 2 – check java version

Once we update our server lets check if it has java installed. DigitalOcean installs usually come without it, but it is a good habit to check before you attempt to install.

To check if JAVA is installed we can run ‘java -version‘.


Check Java Version


As you can see there is no JAVA installed. So lets go ahead and install it.
This is what we are after :


Java Version Installed


Step 3 – Add the DataStax Community repository

OK, now that we have installed JAVA its time to add the DataStax Community repository to the source list. Simply run the command below :




Add Datastax Repository


Step 4 – Add the DataStax repository key

Now next stel is to add the DataStax repository key to your aptitude trusted keys

curl -L | sudo apt-key add -

If successful you should see something similar to the output bellow :


Add Repository Key


Step 5 – Install Cassandra Database

After we have done all these steps it is time to actually install cassandra! In this case I am going for cassandra 2.1.2; however you can pickup your own selected version.


Install Cassandra


A few further notes to keep an eye on. Obviously you will be asked for permission to install, so once you see it simply hit ‘Y


Install Cassandra Process


Below we can see the installation process has finished. You should note that Cassandra has now started.


Install Cassandra Finish


Still lets confirm that and run nodetool status‘ if everything is fine you should then see an output similar to this one :


Nodetool Status check


Step 6 – Edit hosts

Alright! Now we have installed Cassandra on one node you can go ahead and repeat steps 1 to 5 and install Cassandra on all of you other nodes.

Next step is to edit server hosts file and update an IP Address. So run

vi /etc/hosts

You should see an output similar to this one :


Change Node IP Address

Now we can change node2 node2 to actual droplet IP Address. You should have something like node2 node2.

A few notes before we continue :

  • is my droplet IP Address. you will have to type there your droplet address
  • node2 node2 – is the name I gave to my droplet; the chance is it will be a different name for you

Make sure you save all changes before you continue.


Step 7 – Change Cassandra.yaml

Now it is time to change some settings within Cassandra.yaml config file. Run the following command

vi /etc/cassandra/cassandra.yaml


There are a few settings we want to update here. By default cluster_name is set to Test Cluster. However we want to edit it and give it a name. In this case I will name it “MyClusterName“, but I would advise you to give it a name which will make sense to you and your team. Also notice that num_tokens is set to 256 and this is how we want it to be!


Configure Cassandra Cluster

There are two more options you want to change here :

  • seeds – this IP Address must be the same across all nodes; a good practise is not to use all node IP Addresses, so in our case I will put my node0 IP Address;
  • listen_address: – make sure you delete the default IP address and leave it blank; This will work because we have already changed ‘hosts’ file on our server


Step 8 – Restart

Once we have changed the configuration file it is time to restart cassandra service. It is good to run a few more commands just to cleanup history created on initial install.

sudo service cassandra stop
sudo rm -rf /var/lib/cassandra/data/system/*
sudo rm -rf /var/lib/cassandra/*



Restart Cassandra


Step 9 – Check Ring status

OK we are nearly there! All that is left is to run ‘nodetool status‘ again. Now you should see your newly added node to the cluster! You should be aware that it may take something like a minute or two before it all runs fine. Do not panic if you see some JAVA errors. Give it a few seconds and run it again.





This pretty much sums up this quick ‘how to configure Cassandra cluster’ style tutorial.

Here is a list of reference links I used to put this tutorial together :