First, you need Java 7 JDK, not to be confused with JRE. Cassandra won’t run without it. So run a java -version command before you proceed.
I used brew to install and maintain it for me 😉
brew install cassandra
After the installation, run
brew info cassandra
This will print out the following instructions on the screen:
To reload cassandra after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
There is probably a bug in the brew recipe for OS X Mavericks, as homebrew.mxcl.cassandra.plist was not copied to the target directory for me. It stayed in the brew install source directory, ~/usr/local/Cellar/cassandra/2.0.3, so I copied it over to ~/Library/LaunchAgents/ .
Now, take a look at homebrew.mxcl.cassandra.plist. The file reads:
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
As you can see, launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist will start cassandra using the command /usr/local/opt/cassandra/bin/cassandra and it will keep it live, which means you can’t kill the process by pid. it will just spring back to life again and again. To stop cassandra, use the unload option.
Now, start Cassandra. But, you haven’t got a client to verify the server is working, have you? CQL, the Cassandra Query Language client is not installed by Homebrew as part of the server install, unlike datastax distribution.
To install CQL with Homebrew, do:
brew install python
pip install cql
now add the cqlsh script directory to your PATH. I add mine to .bashrc:
Finally, run cqlsh
Connected to Test Cluster at localhost:9160.
[cqlsh 4.1.0 | Cassandra 2.0.3 | CQL spec 3.1.1 | Thrift protocol 19.38.0]
Use HELP for help.