Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8F08B26BC for ; Tue, 3 May 2011 21:19:50 +0000 (UTC) Received: (qmail 23690 invoked by uid 500); 3 May 2011 21:19:50 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 23666 invoked by uid 500); 3 May 2011 21:19:50 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 23659 invoked by uid 99); 3 May 2011 21:19:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 21:19:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 21:19:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 504602388901; Tue, 3 May 2011 21:19:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1099262 - in /hadoop/common/trunk: CHANGES.txt bin/hadoop-config.sh bin/slaves.sh Date: Tue, 03 May 2011 21:19:26 -0000 To: common-commits@hadoop.apache.org From: suresh@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110503211926.504602388901@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: suresh Date: Tue May 3 21:19:25 2011 New Revision: 1099262 URL: http://svn.apache.org/viewvc?rev=1099262&view=rev Log: HADOOP-7179. Federation: Improve HDFS startup scripts. Contributed by Erik Steffl and Tanping Wang. Modified: hadoop/common/trunk/CHANGES.txt hadoop/common/trunk/bin/hadoop-config.sh hadoop/common/trunk/bin/slaves.sh Modified: hadoop/common/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1099262&r1=1099261&r2=1099262&view=diff ============================================================================== --- hadoop/common/trunk/CHANGES.txt (original) +++ hadoop/common/trunk/CHANGES.txt Tue May 3 21:19:25 2011 @@ -102,6 +102,9 @@ Trunk (unreleased changes) HADOOP-7235. Refactor the tail command to conform to new FsCommand class. (Daryn Sharp via szetszwo) + HADOOP-7179. Federation: Improve HDFS startup scripts. (Erik Steffl + and Tanping Wang via suresh) + OPTIMIZATIONS BUG FIXES Modified: hadoop/common/trunk/bin/hadoop-config.sh URL: http://svn.apache.org/viewvc/hadoop/common/trunk/bin/hadoop-config.sh?rev=1099262&r1=1099261&r2=1099262&view=diff ============================================================================== --- hadoop/common/trunk/bin/hadoop-config.sh (original) +++ hadoop/common/trunk/bin/hadoop-config.sh Tue May 3 21:19:25 2011 @@ -47,19 +47,40 @@ fi # Allow alternate conf dir location. export HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_HOME/conf}" -#check to see it is specified whether to use the slaves or the -# masters file +# User can specify hostnames or a file where the hostnames are (not both) +if [[ ( "$HADOOP_SLAVES" != '' ) && ( "$HADOOP_SLAVE_NAMES" != '' ) ]] ; then + echo \ + "Error: Please specify one variable HADOOP_SLAVES or " \ + "HADOOP_SLAVE_NAME and not both." + exit 1 +fi + +# Process command line options that specify hosts or file with host +# list if [ $# -gt 1 ] then if [ "--hosts" = "$1" ] then shift - slavesfile=$1 + export HADOOP_SLAVES="${HADOOP_CONF_DIR}/$$1" + shift + elif [ "--hostnames" = "$1" ] + then + shift + export HADOOP_SLAVE_NAMES=$1 shift - export HADOOP_SLAVES="${HADOOP_CONF_DIR}/$slavesfile" fi fi +# User can specify hostnames or a file where the hostnames are (not both) +# (same check as above but now we know it's command line options that cause +# the problem) +if [[ ( "$HADOOP_SLAVES" != '' ) && ( "$HADOOP_SLAVE_NAMES" != '' ) ]] ; then + echo \ + "Error: Please specify one of --hosts or --hostnames options and not both." + exit 1 +fi + cygwin=false case "`uname`" in CYGWIN*) cygwin=true;; Modified: hadoop/common/trunk/bin/slaves.sh URL: http://svn.apache.org/viewvc/hadoop/common/trunk/bin/slaves.sh?rev=1099262&r1=1099261&r2=1099262&view=diff ============================================================================== --- hadoop/common/trunk/bin/slaves.sh (original) +++ hadoop/common/trunk/bin/slaves.sh Tue May 3 21:19:25 2011 @@ -40,24 +40,21 @@ bin=`cd "$bin"; pwd` . "$bin"/hadoop-config.sh -# If the slaves file is specified in the command line, -# then it takes precedence over the definition in -# hadoop-env.sh. Save it here. -HOSTLIST=$HADOOP_SLAVES - if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then . "${HADOOP_CONF_DIR}/hadoop-env.sh" fi -if [ "$HOSTLIST" = "" ]; then - if [ "$HADOOP_SLAVES" = "" ]; then - export HOSTLIST="${HADOOP_CONF_DIR}/slaves" - else - export HOSTLIST="${HADOOP_SLAVES}" - fi +# Where to start the script, see hadoop-config.sh +# (it set up the variables based on command line options) +if [ "$HADOOP_SLAVE_NAMES" != '' ] ; then + SLAVE_NAMES=$HADOOP_SLAVE_NAMES +else + SLAVE_FILE=${HADOOP_SLAVES:-${HADOOP_CONF_DIR}/slaves} + SLAVE_NAMES=$(cat "$SLAVE_FILE" | sed 's/#.*$//;/^$/d') fi -for slave in `cat "$HOSTLIST"|sed "s/#.*$//;/^$/d"`; do +# start the daemons +for slave in $SLAVE_NAMES ; do ssh $HADOOP_SSH_OPTS $slave $"${@// /\\ }" \ 2>&1 | sed "s/^/$slave: /" & if [ "$HADOOP_SLAVE_SLEEP" != "" ]; then