I needed to get Apache Cassandra running locally on my Windows 7 box for development purposes. This post will cover what I did to get it running.

Prepare the Run Time Environment

Cassandra was developed in Java. This means that my environment needs to have a functional Java run time environment. According to the Cassandra documentation at the time of installation, it requires the most stable version of Java 1.6. I figured since I am a developer and our current project may need some Java development in the near future then I may as well have an up to date Java development environment. So I surfed my way to Oracle’s web site and got the latest and greatest Java Development Kit (Java Platform (JDK) 7). After downloading and running the installer. I was ready to get Cassandra installed.

Running Cassandra Locally

I then realized that I didn’t have a was to extract the contents on this current box. So the next step was to get a utility that was capable of extracting from a g-zipped tar ball. There are plenty of utilities that do this and I just grabbed 7-Zip since its free and works.

Now back to business. The next step was to extract the Cassandra binary files. I extracted them to c:\dev\cassandra\apache-cassandra-0.8.2 using the 7-zip utility. NOTE: Make sure there are no spaces in the path as this may cause problems later.

Now for everything to work correctly, you need to update the JAVA_HOME and CASSANDRA_HOME system variables. In my case, I needed to create them. To this, I did the following:

Click the Start Menu

Right click Computer

Click Properties (this opens the Control Panel in the System and Security > System view)

Click Advanced system settings on the left side (this opens the System Properties dialog in the Advanced tab)

We are almost ready. Before running Cassandra, the storage configuration must be modified to make sure that any UNIX style paths are replaced with their corresponding Windows style paths. This is done by opening up the cassandra.yaml file in your favorite text editor and looking for those paths. My file was located in C:\dev\cassandra\apache-cassandra-0.8.2\conf\cassandra.yaml. I had to make the following changes:

On line 72, I changed /var/lib/cassandra/data to C:\dev\cassandra\apache-cassandra-0.8.2\data

On line 75, I changed /var/lib/cassandra/commitlog to C:\dev\cassandra\apache-cassandra-0.8.2\commitlog

On line 78, I changed /var/lib/cassandra/saved_caches to C:\dev\cassandra\apache-cassandra-0.8.2\saved_caches

At this point you should be able to start up and run Cassandra. This can be done via the command prompt like this:
cd \dev\cassandra\apache-cassandra-0.8.2\bin
cassandra.bat

You can also start the client from the command prompt like this:
cd \dev\cassandra\apache-cassandra-0.8.2\bin
cassandra-cli.bat
connect localhost/9160;

What’s next? Now you can do your development tasks and use your local Cassandra instance as needed. I will probably use Topshelf or something similar to get Cassandra running as a service so I don’t have to start it up manually every time I need it. Another option for this is to use RunAsAService.