Cassandra in a Container on OSX

Getting Your Laptop Setup

Let’s get Cassandra running, using containers to keep the runtime environment similar to what it would be in production.  We are focusing on OSX only and will use a few tools that are freely available to make it all work.

1. Install Brew

2. Install CaskRoom

brew tap caskroom/cask

3.  Install Docker Toolbox but with brew/caskroom

brew cask install dockertoolbox

4.  Install cqlsh so you can mess with Cassandra

brew install python && pip install cql

5. We need git and npm too, so if you don’t already have them installed:

brew install git npm

6. Do a global install of av and the docker plugin

npm install -g av-shell av-docker

Launching the Container

The workflow is optimized by av-shell and the av-docker plugin that together remember multiple pieces of context so as to minimize command line arguments needed.  I invite you to compare against the docker.com’s Build your own image instructions.

1. Get the ‘cassandra-container’ code from github

git clone https://github.com/sio2boss/cassandra-containers

2. Get the domain specific shell up

cd cassandra-container && av

3. Make sure the virtual machine that runs docker server is running

up
ps

You should see column headings but no containers.

4. Now choose which container we will work with (this project has only one) with:

choose

Use the arrow keys to select cassandra-1.2

choose

5. Now build the container

build

This reads the Dockerfile which has been setup to install java and cassandra.Watch Full Movie Online Streaming Online and Download

6. Now start the container with

run

This reads the Runfile with specifics to map OSX directories to the container

7. Confirm the container is running

ps

You should see something like this:

ps

Optionally, you can shell into the last started container with just:

shell

8. In a new terminal, lets login to the running container

cqlsh --cqlversion=3.0.5 `docker-machine ip default`

We are using an updated cqlsh installed locally to connect with Cassandra 1.2.19 but nowadays a current version of Cassandra is 3.0 so we need to set a compatible ‘cqlversion’.  You should see something like this:

cql

Wrap-up

The Dockerfile must have a line that sets the user id of the ‘cassandra’ user to that of the docker server so that storage can be passed from OSX through to the container.

RUN usermod -u 1000 cassandra

This only works for Cassandra 1.2.X as 2.0 introduced hardlinks to the filesystem and that doesn’t work with Virtualbox.  Hopefully more to come on that front.


,,,,