Cassandra is a useful NoSQL database management system with praise for its high availability. Let’s demonstrate how to install Cassandra 2.1 on Mac OS X.
Step 1) Install the Oracle Java Development Kit (JDK)
On Macs, you can easily download the corresponding dmg file and install.
After installing, check that you have installed the JDK.
Step 2) Install Cassandra
Make a directory for your Cassandra package and change directory into it.
mkdir -p ~/opt/packages && cd $_
Download the latest Cassandra tar file into the directory you just made.
At the time of writing, 2.1.6 is the most stable release.
Extract the file.
tar -xvf apache-cassandra-2.1.6-bin.tar.gz
Set a symbolic link from the newly extracted folder to a conveniently named cassandra folder in your packages directory.
ln -s ~/opt/packages/apache-cassandra-2.1.6 ~/opt/cassandra
Step 3) Cassandra directory configurations
We’ll use some convenient Cassandra configurations to store logs, data, and cached files.
mkdir -p ~/opt/cassandra/data/data
mkdir -p ~/opt/cassandra/data/commitlog
mkdir -p ~/opt/cassandra/data/saved_caches
mkdir -p ~/opt/cassandra/logs
We will edit the
~/opt/cassandra/conf/cassandra.yaml file to accommodate the folders that we just created. Configure the following settings. Erase the # on each.
4) Add Cassandra to PATH
Open the bash profile.
Add Cassandra to PATH, so you can call cassandra from anywhere.
if [ -d "$HOME/opt" ]; then
Load the bash profile.
5) Run Cassandra
Start Cassandra. Cassandra should run with a long log record.
CTRL-C to close Cassandra, but let’s not do that right now. Instead, open a new terminal. You can log into the Cassandra shell in the new terminal as long as Cassandra is running.
You can run commands within the Cassandra shell, which looks like:
[cqlsh 5.0.1 | Cassandra 2.1.6 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
Cassandra is successfully installed and usable!