Monday, May 2, 2011

Setting up Cassandra under Ubuntu and VMWare

Nope! Not the Greek mythical figure; Apache Cassandra, the "Distributed Database". Let's see how that works...

The issue is that I'm not sure if this beast runs together with OpenJDK, the web seems to be positive about the issue, but you never know (seems to become this year's catch phrase).

As fas as I know, two disks are better than one. So, create another virtual disk under VMWare for this VM and check if it works:

sudo fdisk -l
Yep! Shows up with "Disk /dev/sdb doesn't contain a valid partition table" - we should be able to change that...

sudo fdisk /dev/sdb - then "n" (new), "p" (primary), "1" and accept all settings, exit with "w"

Check back with "sudo fdisk -l" - it's dev/sdb1 now. All as planned!

Create an ext3 file system with "sudo mkfs.ext3 /dev/sdb1" (check!)

Give it a nice name: sudo e2label /dev/sdb1 hd2

Thank you... next!

Downloaded the latest version of Cassandra from the website - I think there's also a way to use apt for that, but I'd really like to make sure I got the latest version (0.7.5).

Unpack the archive into my home folder - I'm not in the mood to deal with permissions at this stage; it's going to be difficult enough. So, here's what we have:

/bin
/conf
/interface
/javadoc
/lib

and a couple of well-know readme, license etc. files.

Check the readme: Tells you how to unpack the file (little late for that, but thanks anyway) and how to set up the logs. Let's do that!

sudo mkdir -p /var/log/cassandra
sudo chown -R `whoami` /var/log/cassandra
sudo mkdir -p /var/lib/cassandra
sudo chown -R `whoami` /var/lib/cassandra

Next dreaded issue: ports. The Cassandra Wiki is clear about that:
By default, Cassandra uses 7000 for cluster communication, 9160 for clients (Thrift), and 8080 for JMX. These are all editable in the configuration file or bin/cassandra.in.sh (for JVM options). All ports are TCP.

8080, of course! As if there's no other choice of ports; everybody and his brother listens on 8080. Just joking - I know that makes sense!

Change that in conf/cassandra-env.sh under the Cassandra install directory:

JMX_PORT="8080" changed to JMX_PORT="10036"

Now - last for this session - check if it responds to the CLI:

~/apache-cassandra-0.7.5/bin/cassandra-cli

Yep! Something happens...

[default@unknown] connect localhost/9160;

Did I mention I very much dislike a prompt like "default@unknown"?

Connected to: "Test Cluster" on localhost/9160

Enough success for one night... More later!

No comments:

Post a Comment