Skip to content

Instantly share code, notes, and snippets.

@withattribution
Forked from Micka33/install.md
Last active August 10, 2018 13:44
Show Gist options
  • Select an option

  • Save withattribution/ea192e98e34293cf5f15439f60dbbfbc to your computer and use it in GitHub Desktop.

Select an option

Save withattribution/ea192e98e34293cf5f15439f60dbbfbc to your computer and use it in GitHub Desktop.
cassandra on mac OSX

Installing Cassandra on Mac OS X

TLDR; use CCM instead

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install Python

Mac OS X has a copy of Python preinstalled, but this makes sure you get the newest version.

brew install python

Install cql

To use cqlsh, the Cassandra query language shell, you need to install cql:

pip install cql
pip install cassandra-driver

Install Cassandra

This installs Apache Cassandra:

brew install cassandra

Starting Cassandra

Command to start cassandra

brew services run cassandra

Command to start cassandra on start up (not necessarily desired)

brew services start cassandra

To restart or stop

brew services restart/stop cassandra

This will likely launch an annoying popup window which is solved by downloading and installing legacy java cmd line tools

https://support.apple.com/kb/dl1572?locale=en_US

Cassandra file locations

Properties: /usr/local/etc/cassandra
Logs: /usr/local/var/log/cassandra
Data: /usr/local/var/lib/cassandra/data

Finally cqlsh should connect to cassandra:

$> cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

If like me cqlsh did not start and instead errors out with error 61...

Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(61, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

It's likely to be a java related error so check out the installed java version

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

The simplest fix for me was to update to: JDK 8u172

A few notes to self:

Don't bother with oracle website just use homebrew

brew tap caskroom/versions
brew search java
brew cask install java8

set $JAVA_HOME in ~/.zshrc or if using bash ~/.profile etc etc

JAVA_HOME=/Library/Java/Home

trouble shoot just starting cassandra by checking the version

cassandra -v

Even though cassandra 3.11.2 is supposed to work with java 9.0+, it did not work for me and any version of Java8 worked fine after the correct osx specific JAVA_HOME was set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment