Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT Conflicts: bin/config.sh
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/db1cc477 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/db1cc477 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/db1cc477 Branch: refs/heads/master Commit: db1cc477cea907500df3fc196547ba66f661260a Parents: 0817cdc a7d981b Author: Keith Turner <ktur...@apache.org> Authored: Wed Dec 4 14:50:55 2013 -0500 Committer: Keith Turner <ktur...@apache.org> Committed: Wed Dec 4 14:50:55 2013 -0500 ---------------------------------------------------------------------- bin/config.sh | 67 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/db1cc477/bin/config.sh ---------------------------------------------------------------------- diff --cc bin/config.sh index d43f4af,0165a2d..3140119 --- a/bin/config.sh +++ b/bin/config.sh @@@ -22,27 -25,40 +25,37 @@@ # ACCUMULO_HOME Home directory for Accumulo # ACCUMULO_LOG_DIR Directory for Accumulo daemon logs # ACCUMULO_VERSION Accumulo version name -# HADOOP_HOME Home dir for hadoop. +# HADOOP_PREFIX Prefix to the home dir for hadoop. - # + # MONITOR Machine to run monitor daemon on. Used by start-here.sh script + # # Values always set by script. # MALLOC_ARENA_MAX To work around a memory management bug (see ACCUMULO-847) - # MONITOR Machine to run monitor daemon on. Used by start-here.sh script + # + # Iff ACCUMULO_VERIFY_ONLY is not set, this script will + # * Check for standalone mode (lack of masters and slaves files) + # - Do appropriate set up + # * Ensure the existence of ACCUMULO_LOG_DIR on the current host + # * Ensure the presense of local role files (masters, slaves, gc, tracers) + # + # Values always set by script. # SSH Default ssh parameters used to start daemons +# HADOOP_HOME Home dir for hadoop. TODO fix this. - # Start: Resolve Script Directory - SOURCE="${BASH_SOURCE[0]}" - while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located - done - bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - script=$( basename "$SOURCE" ) - # Stop: Resolve Script Directory + if [ -z "${ACCUMULO_HOME}" ] ; then - this="$0" - while [ -h "$this" ]; do - ls=`ls -ld "$this"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '.*/.*' > /dev/null; then - this="$link" - else - this=`dirname "$this"`/"$link" - fi ++ # Start: Resolve Script Directory ++ SOURCE="${BASH_SOURCE[0]}" ++ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink ++ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" ++ SOURCE="$(readlink "$SOURCE")" ++ [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located + done - bin=`dirname "$this"` - script=`basename "$this"` - bin=`cd "$bin"; pwd` - this="$bin/$script" ++ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" ++ script=$( basename "$SOURCE" ) ++ # Stop: Resolve Script Directory - ACCUMULO_HOME=$( cd -P ${bin}/.. && pwd ) - export ACCUMULO_HOME - ACCUMULO_HOME=`dirname "$this"`/.. - export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd` ++ ACCUMULO_HOME=$( cd -P ${bin}/.. && pwd ) ++ export ACCUMULO_HOME + fi ACCUMULO_CONF_DIR="${ACCUMULO_CONF_DIR:-$ACCUMULO_HOME/conf}" export ACCUMULO_CONF_DIR @@@ -68,10 -74,12 +81,12 @@@ elif [ -z "$ACCUMULO_TEST" ] ; the fi if [ -z ${ACCUMULO_LOG_DIR} ]; then - ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs + ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs fi - mkdir -p $ACCUMULO_LOG_DIR 2>/dev/null + if [ -z "${ACCUMULO_VERIFY_ONLY}" ] ; then + mkdir -p $ACCUMULO_LOG_DIR 2>/dev/null + fi export ACCUMULO_LOG_DIR @@@ -93,13 -105,55 +108,25 @@@ the fi export HADOOP_PREFIX -if [ -z "${ACCUMULO_VERIFY_ONLY}" ] ; then - if [ ! -f "$ACCUMULO_CONF_DIR/masters" -o ! -f "$ACCUMULO_CONF_DIR/slaves" ] - then - if [ ! -f "$ACCUMULO_CONF_DIR/masters" -a ! -f "$ACCUMULO_CONF_DIR/slaves" ] - then - echo "STANDALONE: Missing both conf/masters and conf/slaves files" - echo "STANDALONE: Assuming single-node (localhost only) instance" - echo "STANDALONE: echo "`hostname`" > $ACCUMULO_CONF_DIR/masters" - echo `hostname` > "$ACCUMULO_CONF_DIR/masters" - echo "STANDALONE: echo "`hostname`" > $ACCUMULO_CONF_DIR/slaves" - echo `hostname` > "$ACCUMULO_CONF_DIR/slaves" - fgrep -s logger.dir.walog "$ACCUMULO_CONF_DIR/accumulo-site.xml" > /dev/null - WALOG_CONFIGURED=$? - if [ $WALOG_CONFIGURED -ne 0 -a ! -e "$ACCUMULO_HOME/walogs" ] - then - echo "STANDALONE: Creating default local write-ahead log directory" - mkdir "$ACCUMULO_HOME/walogs" - echo "STANDALONE: mkdir \"$ACCUMULO_HOME/walogs\"" - fi - if [ ! -e "$ACCUMULO_CONF_DIR/accumulo-metrics.xml" ] - then - echo "STANDALONE: Creating default metrics configuration" - cp "$ACCUMULO_CONF_DIR/accumulo-metrics.xml.example" "$ACCUMULO_CONF_DIR/accumulo-metrics.xml" - fi - else - echo "You are missing either $ACCUMULO_CONF_DIR/masters or $ACCUMULO_CONF_DIR/slaves" - echo "Please configure them both for a multi-node instance, or delete them both for a single-node (localhost only) instance" - exit 1 - fi - fi -fi -MASTER1=`grep -v '^#' "$ACCUMULO_CONF_DIR/masters" | head -1` +MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1) - MONITOR=$MASTER1 - if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then - MONITOR=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/monitor" | head -1) + if [ -z "${MONITOR}" ] ; then + MONITOR=$MASTER1 + if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then - MONITOR=`grep -v '^#' "$ACCUMULO_CONF_DIR/monitor" | head -1` ++ MONITOR=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/monitor" | head -1) + fi + if [ -z "${MONITOR}" ] ; then + echo "Could not infer a Monitor role. You need to either define the MONITOR env variable, define \"${ACCUMULO_CONF_DIR}/monitor\", or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty." + exit 1 + fi fi - if [ ! -f "$ACCUMULO_CONF_DIR/tracers" ]; then - echo "$MASTER1" > "$ACCUMULO_CONF_DIR/tracers" + if [ ! -f "$ACCUMULO_CONF_DIR/tracers" -a -z "${ACCUMULO_VERIFY_ONLY}" ]; then + if [ -z "${MASTER1}" ] ; then + echo "Could not find a master node to use as a default for the tracer role. Either set up \"${ACCUMULO_CONF_DIR}/tracers\" or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty." + exit 1 + else + echo "$MASTER1" > "$ACCUMULO_CONF_DIR/tracers" + fi ++ fi SSH='ssh -qnf -o ConnectTimeout=2'