[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:
parent
4f1ba234d0
commit
57a3c0395e
|
@ -53,6 +53,9 @@ S3_BUCKET=apache-hbase-images
|
||||||
# Enable public access web interfaces
|
# Enable public access web interfaces
|
||||||
ENABLE_WEB_PORTS=false
|
ENABLE_WEB_PORTS=false
|
||||||
|
|
||||||
|
# Enable mapping of elastic IPs to ZK and master instances
|
||||||
|
ENABLE_ELASTIC_IPS=false
|
||||||
|
|
||||||
# Extra packages
|
# Extra packages
|
||||||
# Allows you to add a private Yum repo and pull packages from it as your
|
# 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>
|
# instances boot up. Format is <repo-descriptor-URL> <pkg1> ... <pkgN>
|
||||||
|
|
|
@ -68,8 +68,10 @@ sed -e "s|%ZOOKEEPER_QUORUM%|$quorum|" \
|
||||||
"$bin"/$USER_DATA_FILE > "$bin"/$USER_DATA_FILE.master
|
"$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}'`
|
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}'`
|
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
|
||||||
ec2-associate-address $TOOL_OPTS $addr -i $inst
|
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"
|
echo -n "Waiting for instance $inst to start"
|
||||||
while true; do
|
while true; do
|
||||||
printf "."
|
printf "."
|
||||||
|
@ -102,4 +104,4 @@ done
|
||||||
scp $SSH_OPTS $EC2_ROOT_SSH_KEY "root@$host:/root/.ssh/id_rsa"
|
scp $SSH_OPTS $EC2_ROOT_SSH_KEY "root@$host:/root/.ssh/id_rsa"
|
||||||
ssh $SSH_OPTS "root@$host" "chmod 600 /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"
|
||||||
|
|
|
@ -53,8 +53,10 @@ i=0
|
||||||
while [ $i -lt $NO_INSTANCES ] ; do
|
while [ $i -lt $NO_INSTANCES ] ; do
|
||||||
echo "Starting an AMI with ID $ZOO_AMI_IMAGE (arch $arch) in group $CLUSTER_ZOOKEEPER"
|
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}'`
|
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}'`
|
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
|
||||||
ec2-associate-address $TOOL_OPTS $addr -i $inst
|
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: "
|
echo -n "Waiting for instance $inst to start: "
|
||||||
while true; do
|
while true; do
|
||||||
printf "."
|
printf "."
|
||||||
|
@ -66,7 +68,6 @@ while [ $i -lt $NO_INSTANCES ] ; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
host=`ec2-describe-instances $TOOL_OPTS $inst | grep INSTANCE | awk '{print $4}'`
|
host=`ec2-describe-instances $TOOL_OPTS $inst | grep INSTANCE | awk '{print $4}'`
|
||||||
echo "Associated elastic IP $host ($addr) with instance $INSTANCE"
|
|
||||||
peers="$peers $host"
|
peers="$peers $host"
|
||||||
peer_addrs="$peer_addrs $addr"
|
peer_addrs="$peer_addrs $addr"
|
||||||
i=$(($i + 1))
|
i=$(($i + 1))
|
||||||
|
|
|
@ -46,13 +46,14 @@ fi
|
||||||
ec2-terminate-instances $TOOL_OPTS `echo "$HBASE_INSTANCES" | awk '{print $2}'`
|
ec2-terminate-instances $TOOL_OPTS `echo "$HBASE_INSTANCES" | awk '{print $2}'`
|
||||||
|
|
||||||
# clean up elastic IPs
|
# clean up elastic IPs
|
||||||
|
if [ "$ENABLE_ELASTIC_IPS" = "true" ] ; then
|
||||||
# master
|
# master
|
||||||
ec2-release-address $TOOL_OPTS `cat $MASTER_IP_PATH`
|
ec2-release-address $TOOL_OPTS `cat $MASTER_IP_PATH`
|
||||||
# zookeeper quorum ensemble
|
# zookeeper quorum ensemble
|
||||||
for addr in `cat $ZOOKEEPER_ADDR_PATH` ; do
|
for addr in `cat $ZOOKEEPER_ADDR_PATH` ; do
|
||||||
ec2-release-address $TOOL_OPTS $addr
|
ec2-release-address $TOOL_OPTS $addr
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# clean up state files
|
# clean up state files
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue