Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First pass at ec2 startup script.

  • Loading branch information...
commit 18435529d791c5bda5ea7c06a7de73b7c9edc521 1 parent 979c128
Jay Kreps authored
Showing with 54 additions and 0 deletions.
  1. +54 −0 test/ec2/ec2-bench.sh
View
54 test/ec2/ec2-bench.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+#if [ $# != 3 ];
+#do
+# echo "USAGE: $0 "
+#done
+
+CLUSTER_SIZE=4
+INSTANCE_SIZE=m1.large
+GROUP_NAME=vold-bench
+
+# create group, if it doesn't exist
+ec2-add-group $GROUP_NAME -d "voldemort benchmark security group."
+ec2-authorize $GROUP_NAME -P tcp -p 6666
+ec2-authorize $GROUP_NAME -P tcp -p 8081
+
+result=$(ec2-run-instances ami-2547a34c -n $CLUSTER_SIZE -g vold-bench -k gsg-keypair --instance-type $INSTANCE_SIZE --availability-zone us-east-1b)
+instance_ids=$(echo $result | grep INSTANCE | awk '{print 2}')
+
+function wait_instance_available {
+ echo "Waiting for instance $1 to start"
+ while true; do
+ echo -n "."
+ # get private dns
+ host=$(ec2-describe-instances $1 | grep running | awk '{print $5}')
+ if [ ! -z $host ]; then
+ echo $host
+ break;
+ fi
+ sleep 1
+ done
+}
+
+## Wait until all the instances are listed as available
+public_ips_file=/tmp/vold-bench-public.txt
+private_ips_file=/tmp/vold-bench-private.txt
+for instance in $instance_ids;
+do
+ wait_instance_available $instance
+ echo $(ec2-describe-instances $instance | awk '{print $3}') >> $public_ips_file
+ echo $(ec2-describe-instances $instance | awk '{print $4}') >> $public_ips_file
+done
+
+public_ips=$(ec2-describe-instances $1 | grep running | awk '{print $5}')
+
+function check_host_booted {
+ while true; do
+ REPLY=$(ssh $SSH_OPTS "root@$1" 'echo "hello"')
+ if [ ! -z $REPLY ]; then
+ break;
+ fi
+ sleep 5
+ done
+}
Please sign in to comment.
Something went wrong with that request. Please try again.