We just started a project for a client that involves Cassandra.
If you've been living under a rock and don't know what Cassandra is let me tell you :)
Cassandra is a "second-generation distributed database" that was built for web scale.
Its is one of the many distributed nosql databases that appear everywhere lately like mushrooms after a heavy rain :).
What sets Cassandra apart is that it comes from a recognizable entity - Facebook.
But I digress.
This is not meant to be a Cassandra introduction, there are enough of those on the net. I Just created a new nosql section on this blog where I'm going to post various tidbits of information about cassandra (and probably others) as I learn them while working on this new project.
Here is the first one: Cassandra gem is just an installer
If you are on Mac OSX and interested in Cassandra you probably know that its just a gem installation away (almost):
gem install cassandra
First thing to note though is that this will not install Cassandra. It will install cassandra installer!
I got bitten by this when I took my laptop with me to my doughter's dancing class. You see, parents are not allowed "in the room" to not interfere with the process :), so I have 45 minutes to find myself something to do each time. I installed cassandra gem at home and intended to play with Cassandra while there.
Not so fast.
When I tried to run cassandra_helper cassandra which is supposed to start a test cassandra instance it went to connect to a github repository to download and install the actual database.
and the 2nd one: Use java preferences
When I got back and finally built Cassandra I got the following message when starting it for the first time:
~ > cassandra_helper cassandra Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends. (in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2) You need to configure your environment for Java 1.6. If you're on OS X, just export the following environment variables: JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"
First thing to note is that just typing JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" in the terminal wont help.
You need to export it:
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" PATH="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin:$PATH"
No need to export PATH as its already exported.
But there is a better and simpler way!
Start "Java Preferences" (find it in /Applications/Utilities, or just use spotlight):
Then reorder the entries in the bottom "Java Applications" section so that Java 6 will be the 1st:
Now cassandra starts right away w/o any exports:
~ > cassandra_helper cassandra Set the CASSANDRA_INCLUDE environment variable to use a non-default cassandra.in.sh and friends. (in /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2) CASSANDRA_HOME: /Users/vitaly/cassandra/server CASSANDRA_CONF: /Library/Ruby/Gems/1.8/gems/cassandra-0.5.6.2/conf Listening for transport dt_socket at address: 8888 ...