Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
docked cassandra cluster

Adapted from https://github.com/zmarcantel/docker-cassandra to install CQLSH the Python based Cassandra CLI

Documented at https://simbo1905.wordpress.com/2017/02/24/cassandra-for-shared-media-libraries/

start three nodes

docker run -d --name "cass0" zmarcantel/cassandra
docker run -d --name cass1 --link cass0:cass0 zmarcantel/cassandra
docker run -d --name cass2 --link cass0:cass0 --link cass1:cass1 zmarcantel/cassandra

capture the image names and extract their IPs

export CASSDOCK_ID=`docker ps | grep cassandra | awk '{print $1}' | xargs`
docker inspect $CASSDOCK_ID | grep IPAddress | sed 's/"IPAddress": "/ /g' | sed 's/",//g' | sed 's/ //g' | grep -v null | sort -u

open bash as root on one node and install then run the python cassandra query tool

docker exec -it `docker ps | grep cassandra | awk '{print $1}' | head -1` bash
apt-get update
apt-get install python-setuptools python-dev build-essential
easy_install pip
pip install --upgrade virtualenv
# this next command appeared to hang but eventually completes
pip install cqlsh
# if you see ProtocolError on the following try downgrading cqlsh with: uninstall cqlsh && pip install cqlsh==4.0.1
cqlsh 127.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.