Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# No sudo, as init scripts run as root
EC2_AVAIL_ZONE=`curl -s`
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
REGION_PREFIX="`echo ${EC2_REGION: : -2}`"
BIND_IP=`curl -s`
echo "Bucket name for fetching configuration is $BUCKET_NAME"
echo "Current region is $REGION"
# First we need Java8 (Cassandra is not yet well tested with Java 9)
yum -y update
yum -y remove java
yum -y install java-1.8.0-openjdk
# Install cassandra
cat <<EOT >> /etc/yum.repos.d/cassandra.repo
name=Apache Cassandra
yum -y install cassandra
#TODO configure cassandra, e.g. memory in /etc/cassandra/conf/jvm.options
# Copy configuration from S3
aws s3 cp s3://$BUCKET_NAME/cassandra.yaml.template /etc/cassandra/conf/cassandra.yaml
python /tmp/install/ $STACK_NAME
service cassandra start
chkconfig cassandra on
while ! echo exit | nc $BIND_IP 9042; do sleep 10; done
cqlsh -e "CREATE KEYSPACE IF NOT EXISTS logsentinel WITH REPLICATION = { 'class': 'NetworkTopologyStrategy', '$REGION_PREFIX': 3 } AND DURABLE_WRITES = true;" $BIND_IP 9042
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.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.