[EC2] make use of elastic IPs optional, and disabled by default

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@927666 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2010-03-26 01:52:37 +00:00
parent 4f1ba234d0
commit 57a3c0395e
4 changed files with 20 additions and 13 deletions

View File

@ -53,6 +53,9 @@ S3_BUCKET=apache-hbase-images
# Enable public access web interfaces
ENABLE_WEB_PORTS=false
# Enable mapping of elastic IPs to ZK and master instances
ENABLE_ELASTIC_IPS=false
# Extra packages
# Allows you to add a private Yum repo and pull packages from it as your
# instances boot up. Format is <repo-descriptor-URL> <pkg1> ... <pkgN>

View File

@ -68,8 +68,10 @@ sed -e "s|%ZOOKEEPER_QUORUM%|$quorum|" \
"$bin"/$USER_DATA_FILE > "$bin"/$USER_DATA_FILE.master
inst=`ec2-run-instances $AMI_IMAGE $TOOL_OPTS -n 1 -g $CLUSTER_MASTER -k root -f "$bin"/$USER_DATA_FILE.master -t $type | grep INSTANCE | awk '{print $2}'`
addr=`ec2-allocate-address $TOOL_OPTS | awk '{print $2}'`
ec2-associate-address $TOOL_OPTS $addr -i $inst
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
addr=`ec2-allocate-address $TOOL_OPTS | awk '{print $2}'`
ec2-associate-address $TOOL_OPTS $addr -i $inst
fi
echo -n "Waiting for instance $inst to start"
while true; do
printf "."
@ -102,4 +104,4 @@ done
scp $SSH_OPTS $EC2_ROOT_SSH_KEY "root@$host:/root/.ssh/id_rsa"
ssh $SSH_OPTS "root@$host" "chmod 600 /root/.ssh/id_rsa"
echo "Master is $host ($addr) in zone $zone"
echo "Master is $host in zone $zone"

View File

@ -53,8 +53,10 @@ i=0
while [ $i -lt $NO_INSTANCES ] ; do
echo "Starting an AMI with ID $ZOO_AMI_IMAGE (arch $arch) in group $CLUSTER_ZOOKEEPER"
inst=`ec2-run-instances $ZOO_AMI_IMAGE $TOOL_OPTS -n 1 -g $CLUSTER_ZOOKEEPER -k root -t $type | grep INSTANCE | awk '{print $2}'`
addr=`ec2-allocate-address $TOOL_OPTS | awk '{print $2}'`
ec2-associate-address $TOOL_OPTS $addr -i $inst
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
addr=`ec2-allocate-address $TOOL_OPTS | awk '{print $2}'`
ec2-associate-address $TOOL_OPTS $addr -i $inst
fi
echo -n "Waiting for instance $inst to start: "
while true; do
printf "."
@ -66,7 +68,6 @@ while [ $i -lt $NO_INSTANCES ] ; do
sleep 1
done
host=`ec2-describe-instances $TOOL_OPTS $inst | grep INSTANCE | awk '{print $4}'`
echo "Associated elastic IP $host ($addr) with instance $INSTANCE"
peers="$peers $host"
peer_addrs="$peer_addrs $addr"
i=$(($i + 1))

View File

@ -46,13 +46,14 @@ fi
ec2-terminate-instances $TOOL_OPTS `echo "$HBASE_INSTANCES" | awk '{print $2}'`
# clean up elastic IPs
# master
ec2-release-address $TOOL_OPTS `cat $MASTER_IP_PATH`
# zookeeper quorum ensemble
for addr in `cat $ZOOKEEPER_ADDR_PATH` ; do
ec2-release-address $TOOL_OPTS $addr
done
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
# master
ec2-release-address $TOOL_OPTS `cat $MASTER_IP_PATH`
# zookeeper quorum ensemble
for addr in `cat $ZOOKEEPER_ADDR_PATH` ; do
ec2-release-address $TOOL_OPTS $addr
done
fi
# clean up state files