Installing Cassandra 0.6.1 on Ubuntu 10.04

Getting Started:

OK, so for purposes of this discussion, I'll assume you have a stock Ubuntu (desktop) 10.04 install.  I’m also assuming this isn’t going to be a production install. (So I’m going to skip some of the things like isolating services & users, setting up firewall rules, SSH, log cleanup, etc).  Note: I do also make one more assumption, that you have curl installed.  If not:

sudo apt-get -y install curl

Dependencies:

First things first, get at least the JRE installed and working:

sudo apt-get -y install openjdk-6-jre

Installing Cassandra:

Now, it's time to to work:

cd ~
curl -O http://mirror.atlanticmetro.net/apache/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz
tar zxvf apache-cassandra-0.6.1-bin.tar.gz
cd apache-cassandra-0.6.1
sudo mkdir /var/log/cassandra
sudo mkdir /var/lib/cassandra
sudo chmod 777 /var/log/cassandra
sudo chmod 777 /var/lib/cassandra

Starting Cassandra:

~/apache-cassandra-0.6.1/bin/cassandra -f

Congratulations, you now have a working cassandra instance.

Using the Cassandra CLI:

To get at Cassandra (for basic data manipulation, for example):

~/apache-cassandra-0.6.1/bin/cassandra-cli -host localhost -port 9160

An example to create & retrieve data is:

set Keyspace1.Standard2['jsmith']['first'] = 'John'
set Keyspace1.Standard2['jsmith']['last'] = 'Smith'
get Keyspace1.Standard2['jsmith']

Inspecting Cassandra's internals:

Basic information about a Cassandra instance:

~/apache-cassandra-0.6.1/bin/nodetool --host localhost --port 8080 info

Statistics on column families (useful for looking across data):

~/apache-cassandra-0.6.1/bin/nodetool --host localhost --port 8080 cfstats

If you want a more graphical way to examine some of Cassandra's internals, check out jconsole.

Configuring a (very) basic cluster:

Create a second Ubuntu install, follow all of the "Installing Cassandra" steps, then:

On the first Ubuntu install, modify storage-conf.xml:

  1. Enable AutoBootstrap
  2. Set Seed IP to the public IP address of the Ubuntu install (ifconfig -a if you need it)
  3. Set ListenAddress to the public IP address of the first Ubuntu install
  4. Set ThriftAddress to the public IP address of the first Ubuntu install

On the second Ubuntu install, modify storage-conf.xml:

  1. Enable AutoBootstrap
  2. Set Seed IP to the IP address of the first Ubuntu install
  3. Set ListenAddress to the public IP address of the second Ubuntu install
  4. Set ThriftAddress to the public IP address of the second Ubuntu install

Note: Each Ubuntu install must be able to contact the other via the IP addresses mentioned.

Now start Cassandra on the first Ubuntu install, give it a moment to come up, then start Cassandra on the second Ubuntu install.

Cleanup:

If you're going to do much work, Cassandra should be set up to start at startup. Installing a rc.d script is left as an exercise to the reader.

Notes:

2010/11/30 - Recovery of content & cleanup.