HADOOP-5925. EC2 scripts should exit on error.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@788699 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas White 2009-06-26 13:40:07 +00:00
parent b089f4448d
commit efc6df7a11
10 changed files with 33 additions and 16 deletions

View File

@ -465,6 +465,8 @@ Trunk (unreleased changes)
commands that do not complete within a certain amount of time. commands that do not complete within a certain amount of time.
(Sreekanth Ramakrishnan via yhemanth) (Sreekanth Ramakrishnan via yhemanth)
HADOOP-5925. EC2 scripts should exit on error. (tomwhite)
OPTIMIZATIONS OPTIMIZATIONS
HADOOP-5595. NameNode does not need to run a replicator to choose a HADOOP-5595. NameNode does not need to run a replicator to choose a

View File

@ -17,6 +17,8 @@
# Run commands on master or specified node of a running Hadoop EC2 cluster. # Run commands on master or specified node of a running Hadoop EC2 cluster.
set -o errexit
# if no args specified, show usage # if no args specified, show usage
if [ $# = 0 ]; then if [ $# = 0 ]; then
echo "Command required!" echo "Command required!"

View File

@ -18,6 +18,8 @@
# Create a Hadoop AMI. # Create a Hadoop AMI.
# Inspired by Jonathan Siegel's EC2 script (http://blogsiegel.blogspot.com/2006/08/sandboxing-amazon-ec2.html) # Inspired by Jonathan Siegel's EC2 script (http://blogsiegel.blogspot.com/2006/08/sandboxing-amazon-ec2.html)
set -o errexit
# Import variables # Import variables
bin=`dirname "$0"` bin=`dirname "$0"`
bin=`cd "$bin"; pwd` bin=`cd "$bin"; pwd`

View File

@ -15,7 +15,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Delete the groups an local files associated with a cluster. # Delete the groups and local files associated with a cluster.
set -o errexit
if [ -z $1 ]; then if [ -z $1 ]; then
echo "Cluster name required!" echo "Cluster name required!"
@ -42,17 +44,17 @@ bin=`cd "$bin"; pwd`
rm -f $MASTER_IP_PATH rm -f $MASTER_IP_PATH
rm -f $MASTER_PRIVATE_IP_PATH rm -f $MASTER_PRIVATE_IP_PATH
ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null if ec2-describe-group $CLUSTER_MASTER > /dev/null 2>&1; then
if [ $? -eq 0 ]; then if ec2-describe-group $CLUSTER > /dev/null 2>&1; then
echo "Revoking authorization between $CLUSTER_MASTER and $CLUSTER"
ec2-revoke $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID || true
ec2-revoke $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID || true
fi
echo "Deleting group $CLUSTER_MASTER" echo "Deleting group $CLUSTER_MASTER"
ec2-revoke $CLUSTER_MASTER -o $CLUSTER -u $AWS_ACCOUNT_ID ec2-delete-group $CLUSTER_MASTER
fi fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null if ec2-describe-group $CLUSTER > /dev/null 2>&1; then
if [ $? -eq 0 ]; then
echo "Deleting group $CLUSTER" echo "Deleting group $CLUSTER"
ec2-revoke $CLUSTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID ec2-delete-group $CLUSTER
fi fi
ec2-delete-group $CLUSTER_MASTER
ec2-delete-group $CLUSTER

View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -o errexit
bin=`dirname "$0"` bin=`dirname "$0"`
bin=`cd "$bin"; pwd` bin=`cd "$bin"; pwd`

View File

@ -17,6 +17,8 @@
# Launch an EC2 cluster of Hadoop instances. # Launch an EC2 cluster of Hadoop instances.
set -o errexit
# Import variables # Import variables
bin=`dirname "$0"` bin=`dirname "$0"`
bin=`cd "$bin"; pwd` bin=`cd "$bin"; pwd`

View File

@ -17,6 +17,8 @@
# Launch an EC2 Hadoop master. # Launch an EC2 Hadoop master.
set -o errexit
if [ -z $1 ]; then if [ -z $1 ]; then
echo "Cluster name required!" echo "Cluster name required!"
exit -1 exit -1
@ -46,8 +48,7 @@ if [ ! -z "$MASTER_EC2_HOST" ]; then
exit 0 exit 0
fi fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER_MASTER[[:space:]]" > /dev/null if ! ec2-describe-group $CLUSTER_MASTER > /dev/null 2>&1; then
if [ ! $? -eq 0 ]; then
echo "Creating group $CLUSTER_MASTER" echo "Creating group $CLUSTER_MASTER"
ec2-add-group $CLUSTER_MASTER -d "Group for Hadoop Master." ec2-add-group $CLUSTER_MASTER -d "Group for Hadoop Master."
ec2-authorize $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID ec2-authorize $CLUSTER_MASTER -o $CLUSTER_MASTER -u $AWS_ACCOUNT_ID
@ -61,8 +62,7 @@ if [ ! $? -eq 0 ]; then
fi fi
fi fi
ec2-describe-group | egrep "[[:space:]]$CLUSTER[[:space:]]" > /dev/null if ! ec2-describe-group $CLUSTER > /dev/null 2>&1; then
if [ ! $? -eq 0 ]; then
echo "Creating group $CLUSTER" echo "Creating group $CLUSTER"
ec2-add-group $CLUSTER -d "Group for Hadoop Slaves." ec2-add-group $CLUSTER -d "Group for Hadoop Slaves."
ec2-authorize $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID ec2-authorize $CLUSTER -o $CLUSTER -u $AWS_ACCOUNT_ID
@ -105,8 +105,7 @@ MASTER_EC2_ZONE=`ec2-describe-instances $INSTANCE | grep INSTANCE | grep running
echo $MASTER_EC2_ZONE > $MASTER_ZONE_PATH echo $MASTER_EC2_ZONE > $MASTER_ZONE_PATH
while true; do while true; do
REPLY=`ssh $SSH_OPTS "root@$MASTER_EC2_HOST" 'echo "hello"'` if ssh $SSH_OPTS "root@$MASTER_EC2_HOST" 'echo "hello"' > /dev/null 2>&1; then
if [ ! -z $REPLY ]; then
break; break;
fi fi
sleep 5 sleep 5

View File

@ -17,6 +17,8 @@
# Launch an EC2 Hadoop slaves. # Launch an EC2 Hadoop slaves.
set -o errexit
if [ -z $1 ]; then if [ -z $1 ]; then
echo "Cluster name required!" echo "Cluster name required!"
exit -1 exit -1

View File

@ -17,6 +17,8 @@
# List running clusters. # List running clusters.
set -o errexit
# Import variables # Import variables
bin=`dirname "$0"` bin=`dirname "$0"`
bin=`cd "$bin"; pwd` bin=`cd "$bin"; pwd`

View File

@ -17,6 +17,8 @@
# Terminate a cluster. # Terminate a cluster.
set -o errexit
if [ -z $1 ]; then if [ -z $1 ]; then
echo "Cluster name required!" echo "Cluster name required!"
exit -1 exit -1