Configuring Cassandra multinode on Ubuntu 10.10

Many many thanks to David Strauss for guiding me through configuring Casssandra and I thought I should share this knowledge.

Installation of Cassandra

Let’s start with a clean Ubuntu 10.10 64bits installation. Before we can install Cassandra, make sure you have all the latest updates.

sudo apt-get update
sudo apt-get upgrade

Now you need to open /etc/apt/sources.list

sudo nano /etc/apt/sources.list

Add the following two lines:

deb http://www.apache.org/dist/cassandra/debian unstable main
deb-src http://www.apache.org/dist/cassandra/debian unstable main

Now, rerun apt-get update:
Let’s start with a clean Ubuntu 10.10 64bits installation. Before we can install Cassandra, make sure you have all the latest updates.

sudo apt-get update
sudo apt-get upgrade

Now you need to open /etc/apt/sources.list

sudo nano /etc/apt/sources.list

Add the following two lines:

sudo apt-get update

You will get an error message, because we haven’t registered the PGP key yet. So let’s add the PGP key:

gpg --keyserver wwwkeys.pgp.net --recv-keys F758CE318D77295D
sudo apt-key add ~/.gnupg/pubring.gpg
sudo apt-get update

Now we are ready to install Cassandra:

sudo apt-get install cassandra

Configuration Cassandra Box 1

By default, Cassandra is configured as a single-node installation. First, stop Cassandra:

sudo /etc/init.d/cassandra stop

Follow the next steps to create a multinode configuration for Box 1:

sudo nano /etc/cassandra/cassandra.yaml
  1. We need to change the name of cluster. The current name is ‘Test Cluster’. Search for the string cluster_name and give a name to your cluster.
  2. Next, search for the string  listen_address and change it from localhost to the ip address of this machine.
  3. Search for the string rpc_address and change it from localhost to 0.0.0.0

We need to delete the cache and logfiles because we changed the name of the cluster.

sudo rm -rf /var/lib/cassandra/*

Finally, let’s restart Cassandra on Box 1:

sudo /etc/init.d/cassandra start

Configuration Cassandra Box 2

Start with repeating the same steps for Box 1. Then you need to take two more steps when you are editing cassandra.yaml:

  1. Search for the string auto_bootstrap and change the value from false to true.
  2. Search for the string seeds and replace localhost with the ip address of Box 1.

Finally, let’s restart Cassandra on Box 2:

sudo /etc/init.d/cassandra start

Inspect the logfile of Cassandra on Box 1 and you should see that Box 2 has arrived. You can also issue this command:

nodetool -host 127.0.0.1 ring
This entry was posted in nosql and tagged , . Bookmark the permalink.

2 Responses to Configuring Cassandra multinode on Ubuntu 10.10

Leave a Reply to joe Cancel reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>