Skip to content

Instantly share code, notes, and snippets.

@klizhentas
Created October 25, 2013 20:54
Show Gist options
  • Save klizhentas/7161673 to your computer and use it in GitHub Desktop.
Save klizhentas/7161673 to your computer and use it in GitHub Desktop.
from ubuntu:12.04
ENV DEBIAN_FRONTEND noninteractive
run apt-get -y install aptitude curl emacs wget net-tools less
# install Java 6
run wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
run chmod u+x jdk-6u45-linux-x64.bin
run ./jdk-6u45-linux-x64.bin
run mv jdk1.6.0_45 /opt
run update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 9999
# add Ubuntu and Datastax repositories
run echo "deb http://archive.ubuntu.com/ubuntu precise universe" >> /etc/apt/sources.list
run echo "deb http://debian.datastax.com/community stable main" >> /etc/apt/sources.list
run curl -L http://debian.datastax.com/debian/repo_key | apt-key add -
run apt-get update
# install Cassandra
run apt-get -y install cassandra=1.2.10
run apt-get -y install libjna-java
run apt-get -y install dsc12
run ln -sf /usr/share/java/jna.jar /usr/share/cassandra/lib/
# start Cassandra
add . /src
run chmod +x /src/start.sh
expose 9160
expose 7199
expose 9042
cmd ["/src/start.sh"]
#!/bin/bash
IP=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
if [ -z $1 ]; then
SEED_IP=$IP
else
SEED_IP=$1
fi
sed -i "s/%seed_ip%/$SEED_IP/g" /src/config/cassandra.yaml
sed -i "s/%listen_ip%/$IP/g" /src/config/cassandra.yaml
sed -i "s/%listen_ip%/$IP/g" /src/config/cassandra-env.sh
cp /src/config/* /etc/cassandra/
export MAX_HEAP_SIZE="512M"
export HEAP_NEWSIZE="256M"
cassandra
sleep 10;
if [ -z $1 ]; then
cassandra-cli -h $IP -f /src/init.cql
fi
while true; do sleep 10000; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment