Working with Apache Cassandra and DataStax OpsCenter on Mac OS X

By Robin Schumacher | January 31, 2012

If you use Mac OS X as your platform for development work, then you may be interested to know how easy it is to use Apache Cassandra on the Mac. The following shows you how to download and setup Cassandra, its utilities, and also use DataStax OpsCenter, which is a browser-based, visual management and monitoring tool for Cassandra.

Download the Software

DataStax makes available the DataStax Community Edition, which contains the latest community version of Apache Cassandra, along with the Cassandra Query Language (CQL) utility, and a free edition of DataStax OpsCenter. To get Datastax Community Edition, go to the DataStax downloads page and select the tar downloads of both the DataStax Community Server and OpsCenter.

You can also use the curl command on Mac to directly download the files to your machine. For example, to download the DataStax Community Server, you could enter the following at terminal prompt:

curl -O http://downloads.datastax.com/community/dsc.tar.gz

Validate Prerequisites

The only prerequisites you’ll need for your Mac are likely installed – Java and Python (minimum 2.7):

dsc osx

Installing Cassandra and Database Utilities

The nice thing about the DataStax Community Edition server is that it bundles the database software and all the utilities you’ll need to start work. All you need to do is unzip the tar file (e.g. tar –xzf [filename]) in the directory of your choice and start the database via the cassandra script that’s found in the bin subdirectory of the main Cassandra directory:

dsc osx

With Cassandra started, you can now invoke one of the interface utilities to create objects and insert data. The CQL (Cassandra Query Language) utility is the primary interface used to interact in an ad-hoc manner with Cassandra:

dsc osx

You can also use the CLI (Command Line Interface) utility, which prior to CQL being introduced, was the primary interface into Cassandra:

dsc osx

The nodetool utility can be used to check the status of Cassandra and run other management tasks:

dsc osx

Installing and using DataStax OpsCenter

Installing DataStax OpsCenter on Mac involves working through the following steps in a terminal window:

  1. Untar the package (tar –xzf) in the directory you want to use for OpsCenter.
  2. Change directories to the OpsCenter home bin directory, and run the ./setup.py script.
  3. You can now start the primary OpsCenter process in the background by entering the command ./opscenter & from the bin directory.
  4. Now you need to get the agent configured to monitor the Cassandra instance you likely already have running on your Mac. Change to the agent/bin directory and run the setup script passing the localhost IP (usually 127.0.0.1) twice: ./setup 127.0.0.1 127.0.0.1.
  5. Start the agent from the agent/bin directory: ./opscenter-agent.
  6. Open either a Firefox, Chrome, or Safari web browser and enter the following in the address bar: http://127.0.0.1:8888/opscenter/index.html.
dsc osx dsc osx

 

Conclusion

That’s it – you’ve now got Cassandra and DataStax OpsCenter installed and running on your Mac. For other software such as various application drivers and client libraries, visit the DataStax downloads page.

Powered by Rackspace
Apache, Apache Cassandra, Cassandra, Apache Hadoop, Hadoop and the eye logo are trademarks of the Apache Software Foundation.