HBASE 1961 HBase EC2 scripts; pass private key and cert path on command line to all tools in common variable

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@881183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2009-11-17 08:00:24 +00:00
parent 8dd763874c
commit 4b9ae3c5a2
11 changed files with 74 additions and 72 deletions

View File

@ -41,7 +41,7 @@ bin=`cd "$bin"; pwd`
. "$bin"/hbase-ec2-env.sh
if [[ "$CLUSTER" = "i-*" ]]; then
HOST=`ec2-describe-instances $CLUSTER | grep running | awk '{print $4}'`
HOST=`ec2-describe-instances $TOOL_OPTS $CLUSTER | grep running | awk '{print $4}'`
[ -z $HOST ] && echo "Instance still pending or no longer running: $CLUSTER" && exit 1
else
[ ! -f $MASTER_IP_PATH ] && echo "Wrong group name, or cluster not launched! $CLUSTER" && exit 1

View File

@ -29,20 +29,20 @@ bin=`cd "$bin"; pwd`
echo "INSTANCE_TYPE is $INSTANCE_TYPE."
echo "ARCH is $ARCH."
AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep hbase | grep $HBASE_VERSION | grep $ARCH | grep available | awk '{print $2}'`
AMI_IMAGE=`ec2-describe-images $TOOL_OPTS -a | grep $S3_BUCKET | grep hbase | grep $HBASE_VERSION | grep $ARCH | grep available | awk '{print $2}'`
[ ! -z $AMI_IMAGE ] && echo "AMI already registered, use: ec2-deregister $AMI_IMAGE" && exit 1
echo "Starting a AMI with ID $BASE_AMI_IMAGE."
OUTPUT=`ec2-run-instances $BASE_AMI_IMAGE -k $KEY_NAME -t $INSTANCE_TYPE`
OUTPUT=`ec2-run-instances $BASE_AMI_IMAGE $TOOL_OPTS -k $KEY_NAME -t $INSTANCE_TYPE`
BOOTING_INSTANCE=`echo $OUTPUT | awk '{print $6}'`
echo "Instance is $BOOTING_INSTANCE."
echo "Polling server status (ec2-describe-instances $BOOTING_INSTANCE)"
echo "Polling server status"
while true; do
printf "."
HOSTNAME=`ec2-describe-instances $BOOTING_INSTANCE | grep running | awk '{print $4}'`
HOSTNAME=`ec2-describe-instances $TOOL_OPTS $BOOTING_INSTANCE | grep running | awk '{print $4}'`
if [ ! -z $HOSTNAME ]; then
break;
fi
@ -72,6 +72,6 @@ scp $SSH_OPTS $EC2_CERT "root@$HOSTNAME:/mnt"
ssh $SSH_OPTS "root@$HOSTNAME" "sh -c \"INSTANCE_TYPE=$INSTANCE_TYPE /mnt/create-hbase-image-remote\""
# Register image
ec2-register $S3_BUCKET/hbase-$HBASE_VERSION-$ARCH.manifest.xml
ec2-register $TOOL_OPTS $S3_BUCKET/hbase-$HBASE_VERSION-$ARCH.manifest.xml
echo "Terminate with: ec2-terminate-instances $BOOTING_INSTANCE"

View File

@ -24,8 +24,13 @@ fi
CLUSTER=$1
# Import variables
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
. "$bin"/hbase-ec2-env.sh
# Finding HBase clusters
CLUSTERS=`ec2-describe-instances | \
CLUSTERS=`ec2-describe-instances $TOOL_OPTS | \
awk '"RESERVATION" == $1 && $4 ~ /-master$/, "INSTANCE" == $1' | tr '\n' '\t' | \
grep "$CLUSTER" | grep running | cut -f4 | rev | cut -d'-' -f2- | rev`
@ -34,11 +39,6 @@ if [ -n "$CLUSTERS" ]; then
exit 0
fi
# Import variables
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
. "$bin"/hbase-ec2-env.sh
"$bin"/revoke-hbase-cluster-secgroups $CLUSTER
rm -f $MASTER_IP_PATH

View File

@ -45,6 +45,9 @@ PRIVATE_KEY_PATH=`echo "$EC2_KEYDIR"/"id_rsa_$KEY_NAME"`
# SSH options used when connecting to EC2 instances.
SSH_OPTS=`echo -q -i "$PRIVATE_KEY_PATH" -o StrictHostKeyChecking=no -o ServerAliveInterval=30`
# Global tool options
TOOL_OPTS=`echo -K "$EC2_PRIVATE_KEY" -C "$EC2_CERT"`
# The version of HBase to use.
HBASE_VERSION=0.20.1
@ -55,8 +58,7 @@ HADOOP_VERSION=$HBASE_VERSION
# The default value is for public images, so can be left if you are using running a public image.
# Change this value only if you are creating your own (private) AMI
# so you can store it in a bucket you own.
#S3_BUCKET=hbase-images
S3_BUCKET=iridiant-bundles
S3_BUCKET=hbase-images
# Enable public access web interfaces
# XXX -- Generally, you do not want to do this

View File

@ -31,56 +31,56 @@ bin=`cd "$bin"; pwd`
echo "Creating/checking security groups"
ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
if [ ! $? -eq 0 ]; then
echo "Creating group $CLUSTER_MASTER"
ec2-add-group $CLUSTER_MASTER -d "Group for HBase Master."
ec2-authorize $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER_MASTER -p 22 # ssh
ec2-add-group $TOOL_OPTS $CLUSTER_MASTER -d "Group for HBase Master."
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -p 22 # ssh
if [ $ENABLE_WEB_PORTS = "true" ]; then
ec2-authorize $CLUSTER_MASTER -p 50070 # NameNode web interface
ec2-authorize $CLUSTER_MASTER -p 50075 # DataNode web interface
ec2-authorize $CLUSTER_MASTER -p 60010 # HBase master web interface
ec2-authorize $CLUSTER_MASTER -p 60030 # HBase region server web interface
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -p 50070 # NameNode web interface
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -p 50075 # DataNode web interface
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -p 60010 # HBase master web interface
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -p 60030 # HBase region server web interface
fi
else
echo "Security group $CLUSTER_MASTER exists, ok"
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
if [ ! $? -eq 0 ]; then
echo "Creating group $CLUSTER"
ec2-add-group $CLUSTER -d "Group for HBase Slaves."
ec2-authorize $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER -p 22 # ssh
ec2-add-group $TOOL_OPTS $CLUSTER -d "Group for HBase Slaves."
ec2-authorize $TOOL_OPTS $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER -p 22 # ssh
if [ $ENABLE_WEB_PORTS = "true" ]; then
ec2-authorize $CLUSTER -p 50070 # NameNode web interface
ec2-authorize $CLUSTER -p 50075 # DataNode web interface
ec2-authorize $CLUSTER -p 60010 # HBase master web interface
ec2-authorize $CLUSTER -p 60030 # HBase region server web interface
ec2-authorize $TOOL_OPTS $CLUSTER -p 50070 # NameNode web interface
ec2-authorize $TOOL_OPTS $CLUSTER -p 50075 # DataNode web interface
ec2-authorize $TOOL_OPTS $CLUSTER -p 60010 # HBase master web interface
ec2-authorize $TOOL_OPTS $CLUSTER -p 60030 # HBase region server web interface
fi
ec2-authorize $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
else
echo "Security group $CLUSTER exists, ok"
fi
# Set up zookeeper group
ec2-describe-group | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
if [ ! $? -eq 0 ]; then
echo "Creating group $CLUSTER_ZOOKEEPER"
ec2-add-group $CLUSTER_ZOOKEEPER -d "Group for HBase Zookeeper quorum."
ec2-authorize $CLUSTER_ZOOKEEPER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER_ZOOKEEPER -p 22 # ssh
ec2-add-group $TOOL_OPTS $CLUSTER_ZOOKEEPER -d "Group for HBase Zookeeper quorum."
ec2-authorize $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_ZOOKEEPER -p 22 # ssh
ec2-authorize $CLUSTER_MASTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER_ZOOKEEPER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $CLUSTER_ZOOKEEPER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-authorize $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER -u $AWS_ACCOUNT_ID
else
echo "Security group $CLUSTER_ZOOKEEPER exists, ok"
fi

View File

@ -35,19 +35,19 @@ if [ -z $AWS_ACCOUNT_ID ]; then
fi
echo "Testing for existing master in group: $CLUSTER"
MASTER_EC2_HOST=`ec2-describe-instances | awk '"RESERVATION" == $1 && "'$CLUSTER_MASTER'" == $4, "RESERVATION" == $1 && "'$CLUSTER_MASTER'" != $4'`
MASTER_EC2_HOST=`ec2-describe-instances $TOOL_OPTS | awk '"RESERVATION" == $1 && "'$CLUSTER_MASTER'" == $4, "RESERVATION" == $1 && "'$CLUSTER_MASTER'" != $4'`
MASTER_EC2_HOST=`echo "$MASTER_EC2_HOST" | awk '"INSTANCE" == $1 && "running" == $6 {print $4}'`
if [ ! -z "$MASTER_EC2_HOST" ]; then
echo "Master already running on: $MASTER_EC2_HOST"
MASTER_HOST=`ec2-describe-instances $INSTANCE | grep INSTANCE | grep running | grep $MASTER_EC2_HOST | awk '{print $5}'`
MASTER_HOST=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep INSTANCE | grep running | grep $MASTER_EC2_HOST | awk '{print $5}'`
echo $MASTER_HOST > $MASTER_PRIVATE_IP_PATH
echo $MASTER_EC2_HOST > $MASTER_IP_PATH
exit 0
fi
# Finding HBase image
[ -z "$AMI_IMAGE" ] && AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $HBASE_VERSION | grep $ARCH | grep available | awk '{print $2}'`
[ -z "$AMI_IMAGE" ] && AMI_IMAGE=`ec2-describe-images $TOOL_OPTS -a | grep $S3_BUCKET | grep $HBASE_VERSION | grep $ARCH | grep available | awk '{print $2}'`
# Start a master
echo "Starting master with AMI $AMI_IMAGE (arch $ARCH)"
@ -55,12 +55,12 @@ echo "Starting master with AMI $AMI_IMAGE (arch $ARCH)"
ZOOKEEPER_QUORUM=`cat $ZOOKEEPER_QUORUM_PATH`
sed -e "s|%ZOOKEEPER_QUORUM%|$ZOOKEEPER_QUORUM|" \
"$bin"/$USER_DATA_FILE > "$bin"/$USER_DATA_FILE.master
INSTANCE=`ec2-run-instances $AMI_IMAGE -n 1 -g $CLUSTER_MASTER -k $KEY_NAME -f "$bin"/$USER_DATA_FILE.master -t $INSTANCE_TYPE | grep INSTANCE | awk '{print $2}'`
INSTANCE=`ec2-run-instances $AMI_IMAGE $TOOL_OPTS -n 1 -g $CLUSTER_MASTER -k $KEY_NAME -f "$bin"/$USER_DATA_FILE.master -t $INSTANCE_TYPE | grep INSTANCE | awk '{print $2}'`
echo -n "Waiting for instance $INSTANCE to start"
while true; do
printf "."
# get private dns
MASTER_HOST=`ec2-describe-instances $INSTANCE | grep running | awk '{print $5}'`
MASTER_HOST=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep running | awk '{print $5}'`
if [ ! -z $MASTER_HOST ]; then
echo " Started as $MASTER_HOST"
break;
@ -69,10 +69,10 @@ while true; do
done
rm -f "$bin"/$USER_DATA_FILE.master
MASTER_EC2_HOST=`ec2-describe-instances $INSTANCE | grep INSTANCE | grep running | grep $MASTER_HOST | awk '{print $4}'`
MASTER_EC2_HOST=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep INSTANCE | grep running | grep $MASTER_HOST | awk '{print $4}'`
echo $MASTER_HOST > $MASTER_PRIVATE_IP_PATH
echo $MASTER_EC2_HOST > $MASTER_IP_PATH
MASTER_EC2_ZONE=`ec2-describe-instances $INSTANCE | grep INSTANCE | grep running | grep $MASTER_HOST | awk '{print $11}'`
MASTER_EC2_ZONE=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep INSTANCE | grep running | grep $MASTER_HOST | awk '{print $11}'`
echo $MASTER_EC2_ZONE > $MASTER_ZONE_PATH
while true; do

View File

@ -41,7 +41,7 @@ if [ ! -f $MASTER_IP_PATH ]; then
exit 1
fi
[ -z "$AMI_IMAGE" ] && AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep $HBASE_VERSION | grep $ARCH |grep available | awk '{print $2}'`
[ -z "$AMI_IMAGE" ] && AMI_IMAGE=`ec2-describe-images $TOOL_OPTS -a | grep $S3_BUCKET | grep $HBASE_VERSION | grep $ARCH |grep available | awk '{print $2}'`
MASTER_HOST=`cat $MASTER_PRIVATE_IP_PATH`
MASTER_ZONE=`cat $MASTER_ZONE_PATH`
@ -54,6 +54,6 @@ sed -e "s|%MASTER_HOST%|$MASTER_HOST|" \
# Start slaves
echo "Starting $NO_INSTANCES AMI(s) with ID $AMI_IMAGE (arch $ARCH) in group $CLUSTER in zone $MASTER_ZONE"
ec2-run-instances $AMI_IMAGE -n "$NO_INSTANCES" -g "$CLUSTER" -k "$KEY_NAME" -f "$bin"/$USER_DATA_FILE.slave -t "$INSTANCE_TYPE" -z "$MASTER_ZONE" | grep INSTANCE | awk '{print $2}'
ec2-run-instances $AMI_IMAGE $TOOL_OPTS -n "$NO_INSTANCES" -g "$CLUSTER" -k "$KEY_NAME" -f "$bin"/$USER_DATA_FILE.slave -t "$INSTANCE_TYPE" -z "$MASTER_ZONE" | grep INSTANCE | awk '{print $2}'
rm "$bin"/$USER_DATA_FILE.slave

View File

@ -41,7 +41,7 @@ arch=$ZOO_ARCH
[ -z "$arch" ] && arch=$ARCH
# Finding HBase image
[ -z "$ZOO_AMI_IMAGE" ] && ZOO_AMI_IMAGE=`ec2-describe-images -a | grep $S3_BUCKET | grep hbase | grep $HBASE_VERSION | grep $arch |grep available | awk '{print $2}'`
[ -z "$ZOO_AMI_IMAGE" ] && ZOO_AMI_IMAGE=`ec2-describe-images $TOOL_OPTS -a | grep $S3_BUCKET | grep hbase | grep $HBASE_VERSION | grep $arch |grep available | awk '{print $2}'`
# Start Zookeeper instances
@ -51,12 +51,12 @@ peers=""
public_names=""
for inst in `seq 1 $NO_INSTANCES` ; do
echo "Starting an AMI with ID $ZOO_AMI_IMAGE (arch $arch) in group $CLUSTER_ZOOKEEPER"
INSTANCE=`ec2-run-instances $ZOO_AMI_IMAGE -n 1 -g $CLUSTER_ZOOKEEPER -k ${KEY_NAME} -t $type | grep INSTANCE | awk '{print $2}'`
INSTANCE=`ec2-run-instances $ZOO_AMI_IMAGE $TOOL_OPTS -n 1 -g $CLUSTER_ZOOKEEPER -k ${KEY_NAME} -t $type | grep INSTANCE | awk '{print $2}'`
echo -n "Waiting for instance $INSTANCE to start: "
while true; do
printf "."
# get private dns
priv=`ec2-describe-instances $INSTANCE | grep running | awk '{print $5}'`
priv=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep running | awk '{print $5}'`
if [ ! -z $priv ]; then
echo " Started ZooKeeper instance $INSTANCE as ${priv}"
break
@ -64,7 +64,7 @@ for inst in `seq 1 $NO_INSTANCES` ; do
sleep 1
done
peers="$peers $priv"
public=`ec2-describe-instances $INSTANCE | grep running | awk '{print $4}'`
public=`ec2-describe-instances $TOOL_OPTS $INSTANCE | grep running | awk '{print $4}'`
echo " Public DNS name is $public."
public_names="$public_names $public"
done

View File

@ -23,7 +23,7 @@ bin=`cd "$bin"; pwd`
. "$bin"/hbase-ec2-env.sh
# Finding HBase clusters
CLUSTERS=`ec2-describe-instances | awk '"RESERVATION" == $1 && $4 ~ /-master$/, "INSTANCE" == $1' | tr '\n' '\t' | grep running | cut -f4 | rev | cut -d'-' -f2- | rev`
CLUSTERS=`ec2-describe-instances $TOOL_OPTS | awk '"RESERVATION" == $1 && $4 ~ /-master$/, "INSTANCE" == $1' | tr '\n' '\t' | grep running | cut -f4 | rev | cut -d'-' -f2- | rev`
[ -z "$CLUSTERS" ] && echo "No running clusters." && exit 0

View File

@ -31,38 +31,38 @@ bin=`cd "$bin"; pwd`
echo "Revoking security groups"
ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-revoke $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-revoke $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-revoke $CLUSTER_ZOOKEEPER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER_MASTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER_ZOOKEEPER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $CLUSTER_ZOOKEEPER -o $CLUSTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_MASTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER -o $CLUSTER_ZOOKEEPER -u $AWS_ACCOUNT_ID
ec2-revoke $TOOL_OPTS $CLUSTER_ZOOKEEPER -o $CLUSTER -u $AWS_ACCOUNT_ID
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-delete-group $CLUSTER_MASTER
ec2-delete-group $TOOL_OPTS $CLUSTER_MASTER
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER_ZOOKEEPER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-delete-group $CLUSTER_ZOOKEEPER
ec2-delete-group $TOOL_OPTS $CLUSTER_ZOOKEEPER
fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
ec2-describe-group $TOOL_OPTS | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null
if [ $? -eq 0 ]; then
ec2-delete-group $CLUSTER
ec2-delete-group $TOOL_OPTS $CLUSTER
fi

View File

@ -30,7 +30,7 @@ bin=`cd "$bin"; pwd`
. "$bin"/hbase-ec2-env.sh
# Finding HBase image
HBASE_INSTANCES=`ec2-describe-instances | awk '"RESERVATION" == $1 && ("'$CLUSTER'" == $4 || "'$CLUSTER_MASTER'" == $4 || "'$CLUSTER_ZOOKEEPER'" == $4), "RESERVATION" == $1 && ("'$CLUSTER'" != $4 && "'$CLUSTER_MASTER'" != $4 && "'$CLUSTER_ZOOKEEPER'" != $4)'`
HBASE_INSTANCES=`ec2-describe-instances $TOOL_OPTS | awk '"RESERVATION" == $1 && ("'$CLUSTER'" == $4 || "'$CLUSTER_MASTER'" == $4 || "'$CLUSTER_ZOOKEEPER'" == $4), "RESERVATION" == $1 && ("'$CLUSTER'" != $4 && "'$CLUSTER_MASTER'" != $4 && "'$CLUSTER_ZOOKEEPER'" != $4)'`
HBASE_INSTANCES=`echo "$HBASE_INSTANCES" | grep INSTANCE | grep running`
[ -z "$HBASE_INSTANCES" ] && echo "No running instances in cluster $CLUSTER." && exit 0
@ -43,4 +43,4 @@ if [ "$answer" != "yes" ]; then
exit 1
fi
ec2-terminate-instances `echo "$HBASE_INSTANCES" | awk '{print $2}'`
ec2-terminate-instances $TOOL_OPTS `echo "$HBASE_INSTANCES" | awk '{print $2}'`