Skip to content

Instantly share code, notes, and snippets.

@simbo1905
Last active March 15, 2017 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simbo1905/79e3f8213f8e94c1270a4c5c8fb2d4b2 to your computer and use it in GitHub Desktop.
Save simbo1905/79e3f8213f8e94c1270a4c5c8fb2d4b2 to your computer and use it in GitHub Desktop.
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