From 0ea4ea7d0cfd1e8246b9b6938a3fe35f7b326429 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 17 Apr 2016 12:21:53 -0500 Subject: [PATCH] [cass] Make sure to enable start_rpc * also note in titan-gremlin that 1.x of ES is needed * provide docker compose snippet Part of #68 --- cassandra/Dockerfile | 4 ++-- cassandra/cassandra.in.sh | 15 ++++++--------- titan-gremlin/README.md | 26 ++++++++++++++++++++++---- titan-gremlin/start-gremlin.sh | 4 +++- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/cassandra/Dockerfile b/cassandra/Dockerfile index 8ecbc0e3..10707052 100755 --- a/cassandra/Dockerfile +++ b/cassandra/Dockerfile @@ -1,11 +1,11 @@ -FROM itzg/ubuntu-openjdk-7 +FROM java:openjdk-8u72-jdk MAINTAINER itzg ENV CASSANDRA_VERSION 2.2.5 RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz -RUN tar -C /opt -zxvf /tmp/apache-cassandra.tgz && \ +RUN tar -C /opt -zxf /tmp/apache-cassandra.tgz && \ rm /tmp/apache-cassandra.tgz diff --git a/cassandra/cassandra.in.sh b/cassandra/cassandra.in.sh index a2237a85..a04c7690 100755 --- a/cassandra/cassandra.in.sh +++ b/cassandra/cassandra.in.sh @@ -1,19 +1,17 @@ #!/bin/bash -sed -i -e 's/log4j.rootLogger=.*/log4j.rootLogger=INFO,stdout/' $CASSANDRA_HOME/conf/log4j-server.properties - cassYml=$CASSANDRA_HOME/conf/cassandra.yaml privateAddr=$(hostname -i) seeds=${SEEDS:-${PUBLISH_AS:-$privateAddr}} -sed -i -e "s/- seeds:.*/- seeds: \"$seeds\"/" $cassYml - -sed -i -e "s/listen_address:.*/listen_address: $privateAddr/" $cassYml -sed -i -e "s/rpc_address:.*/rpc_address: $privateAddr/" $cassYml - -sed -i -e "s#- /var/lib/cassandra/data#- $CASSANDRA_DATA#" $cassYml +sed -i -e "s/- seeds:.*/- seeds: \"$seeds\"/" \ + -e "s/listen_address:.*/listen_address: $privateAddr/" \ + -e "s/rpc_address:.*/rpc_address: $privateAddr/" \ + -e "s/start_rpc:.*/start_rpc: true/" \ + -e "s#- /var/lib/cassandra/data#- $CASSANDRA_DATA#" \ + $cassYml if [ -n "$PUBLISH_AS" ]; then sed -i -e "s/\(\s*#\)\?\s*broadcast_address:.*/broadcast_address: $PUBLISH_AS/" $cassYml @@ -24,4 +22,3 @@ cp -rn $CASSANDRA_HOME/conf/* $CASSANDRA_CONF # source the original . $CASSANDRA_HOME/bin/orig.cassandra.in.sh - diff --git a/titan-gremlin/README.md b/titan-gremlin/README.md index 8dd4f5fb..62934819 100644 --- a/titan-gremlin/README.md +++ b/titan-gremlin/README.md @@ -17,11 +17,11 @@ the next time you (re)start your container. # Connecting to Cassandra and Elasticsearch Containers -First start containers for Cassandra and Elasticsearch, where the `--name` you choose -can be arbitrary or left off to use a generated name. +First start containers for Cassandra and Elasticsearch (pre-2.x), +where the `--name` you choose can be arbitrary or left off to use a generated name. - docker run -d --name gremlin-cass itzg/cassandra - docker run -d --name gremlin-es itzg/elasticsearch + docker run -d --name gremlin-cass itzg/cassandra + docker run -d --name gremlin-es itzg/elasticsearch:1.x Now start Gremlin with networking links to those containers with the aliases @@ -43,3 +43,21 @@ and with that you can follow the ==>age=10000 gremlin> saturn.in('father').in('father').name ==>hercules + +# Running and Connecting with Docker Compose + +Create the following Compose content as the file `docker-compose.yml` and in +that directory invoke `docker-compose run titan` to run the Gremlin shell +with the supporting Elasticsearch and Cassandra containers. + +``` +titan: + image: itzg/titan-gremlin + links: + - cass + - es +cass: + image: itzg/cassandra +es: + image: itzg/elasticsearch:1.x +``` diff --git a/titan-gremlin/start-gremlin.sh b/titan-gremlin/start-gremlin.sh index 0d5d3221..3b1da906 100755 --- a/titan-gremlin/start-gremlin.sh +++ b/titan-gremlin/start-gremlin.sh @@ -48,7 +48,7 @@ END index.search.hostname=$esAddr END fi - + fi if [ -n "$shortcut" ]; then @@ -59,4 +59,6 @@ END args="$args /tmp/init.groovy" fi +# Allow a little extra time for Cassandra to be ready +sleep 1 exec $TITAN_HOME/bin/gremlin.sh $args