You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/12/04 20:58:32 UTC

[1/2] git commit: ACCUMULO-1785 adds ACCUMULO_VERIFY_ONLY mode to bin/config.sh.

Updated Branches:
  refs/heads/1.5.1-SNAPSHOT 0817cdc73 -> db1cc477c


ACCUMULO-1785 adds ACCUMULO_VERIFY_ONLY mode to bin/config.sh.

* When set, won't write to local filesystem
 - skips mkdir for ACCUMULO_LOG_DIR
 - skips standalone mode checks
 - skips writing to missing tracers file
* Other behavior changes
 - if GC was set, we won't overwrite it
 - if MONITOR was set, we won't overwrite it

Signed-off-by: Keith Turner <kt...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a7d981b3
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a7d981b3
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a7d981b3

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: a7d981b3759f16c094f7932a3cdc67e76813d85f
Parents: a3a8895
Author: Sean Busbey <bu...@clouderagovt.com>
Authored: Thu Oct 17 16:03:49 2013 -0500
Committer: Keith Turner <kt...@apache.org>
Committed: Wed Dec 4 14:17:59 2013 -0500

----------------------------------------------------------------------
 bin/config.sh | 131 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 80 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a7d981b3/bin/config.sh
----------------------------------------------------------------------
diff --git a/bin/config.sh b/bin/config.sh
index 08a8bbd..0165a2d 100755
--- a/bin/config.sh
+++ b/bin/config.sh
@@ -17,35 +17,48 @@
 
 # Guarantees that Accumulo and its environment variables are set.
 #
+# Parameters checked by script
+#  ACCUMULO_VERIFY_ONLY set to skip actions that would alter the local filesystem
+#
 # Values set by script that can be user provided.  If not provided script attempts to infer.
 #  ACCUMULO_CONF_DIR  Location where accumulo-env.sh, accumulo-site.xml and friends will be read from
 #  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.
-# 
+#  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
 
-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
-done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
-this="$bin/$script"
+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
+  done
+  bin=`dirname "$this"`
+  script=`basename "$this"`
+  bin=`cd "$bin"; pwd`
+  this="$bin/$script"
 
-ACCUMULO_HOME=`dirname "$this"`/..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+  ACCUMULO_HOME=`dirname "$this"`/..
+  export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+fi
 
 ACCUMULO_CONF_DIR="${ACCUMULO_CONF_DIR:-$ACCUMULO_HOME/conf}"
 export ACCUMULO_CONF_DIR
@@ -64,7 +77,9 @@ if [ -z ${ACCUMULO_LOG_DIR} ]; then
         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
 
@@ -90,43 +105,57 @@ then
 fi
 export HADOOP_PREFIX
 
-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
+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`
-MONITOR=$MASTER1
-if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then
-    MONITOR=`grep -v '^#' "$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`
+  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
+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'
 
 # See HADOOP-7154 and ACCUMULO-847


[2/2] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Posted by kt...@apache.org.
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/1.5.1-SNAPSHOT
Commit: db1cc477cea907500df3fc196547ba66f661260a
Parents: 0817cdc a7d981b
Author: Keith Turner <kt...@apache.org>
Authored: Wed Dec 4 14:50:55 2013 -0500
Committer: Keith Turner <kt...@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'