Repository: accumulo Updated Branches: refs/heads/master 30fad5a63 -> e6145486d
ACCUMULO-3469 separate env setup needed for start and stop scripts Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/e6145486 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/e6145486 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/e6145486 Branch: refs/heads/master Commit: e6145486dd27cc6cf6b484caf9efe675e152a455 Parents: 30fad5a Author: Billie Rinaldi <bil...@apache.org> Authored: Mon Jan 12 10:13:54 2015 -0800 Committer: Billie Rinaldi <bil...@apache.org> Committed: Thu Jan 29 06:04:16 2015 -0800 ---------------------------------------------------------------------- assemble/bin/accumulo | 8 ----- assemble/bin/config-server.sh | 72 ++++++++++++++++++++++++++++++++++++++ assemble/bin/config.sh | 44 ----------------------- assemble/bin/start-all.sh | 1 + assemble/bin/start-here.sh | 1 + assemble/bin/start-server.sh | 1 + assemble/bin/stop-all.sh | 1 + 7 files changed, 76 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/accumulo ---------------------------------------------------------------------- diff --git a/assemble/bin/accumulo b/assemble/bin/accumulo index e21e2fc..64b2f99 100755 --- a/assemble/bin/accumulo +++ b/assemble/bin/accumulo @@ -127,14 +127,6 @@ if [ -z "${ZOOKEEPER_HOME}" -o ! -d "${ZOOKEEPER_HOME}" ]; then echo "ZOOKEEPER_HOME is not set or is not a directory. Please make sure it's set globally or in conf/accumulo-env.sh" exit 1 fi -if [ -z "${ACCUMULO_LOG_DIR}" ]; then - echo "ACCUMULO_LOG_DIR is not set. Please make sure it's set globally or in conf/accumulo-env.sh" - exit 1 -fi - -if [ ! -d "${ACCUMULO_LOG_DIR}" ]; then - mkdir -p "$ACCUMULO_LOG_DIR" -fi # This is default for hadoop 2.x; # for another distribution, specify (DY)LD_LIBRARY_PATH http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/config-server.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/config-server.sh b/assemble/bin/config-server.sh new file mode 100755 index 0000000..eb3fd55 --- /dev/null +++ b/assemble/bin/config-server.sh @@ -0,0 +1,72 @@ +#! /usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# 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. +# 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 presense of local role files (masters, slaves, gc, tracers) +# +# Values always set by script. +# SSH Default ssh parameters used to start daemons +# + +unset MASTER1 +if [[ -f "$ACCUMULO_CONF_DIR/masters" ]]; then + MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1) +fi + +if [[ -z "${MONITOR}" ]] ; then + MONITOR=$MASTER1 + if [[ -f "$ACCUMULO_CONF_DIR/monitor" ]]; then + 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" && -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 + +if [[ ! -f "$ACCUMULO_CONF_DIR/gc" && -z "${ACCUMULO_VERIFY_ONLY}" ]]; then + if [[ -z "${MASTER1}" ]] ; then + echo "Could not infer a GC role. You need to either set up \"${ACCUMULO_CONF_DIR}/gc\" or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty." + exit 1 + else + echo "$MASTER1" > "$ACCUMULO_CONF_DIR/gc" + fi +fi + +SSH='ssh -qnf -o ConnectTimeout=2' + +# ACCUMULO-1985 provide a way to use the scripts and still bind to all network interfaces +export ACCUMULO_MONITOR_BIND_ALL=${ACCUMULO_MONITOR_BIND_ALL:-"false"} http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/config.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/config.sh b/assemble/bin/config.sh index 36cebb0..d9bf8d4 100755 --- a/assemble/bin/config.sh +++ b/assemble/bin/config.sh @@ -26,16 +26,11 @@ # ACCUMULO_LOG_DIR Directory for Accumulo daemon logs # ACCUMULO_VERSION Accumulo version name # HADOOP_PREFIX Prefix to the home dir for hadoop. -# 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 # MALLOC_ARENA_MAX To work around a memory management bug (see ACCUMULO-847) # HADOOP_HOME Home dir for hadoop. TODO fix this. # @@ -109,51 +104,12 @@ then fi export HADOOP_PREFIX -unset MASTER1 -if [[ -f "$ACCUMULO_CONF_DIR/masters" ]]; then - MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1) -fi - -if [[ -z "${MONITOR}" ]] ; then - MONITOR=$MASTER1 - if [[ -f "$ACCUMULO_CONF_DIR/monitor" ]]; then - 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" && -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 - -if [[ ! -f "$ACCUMULO_CONF_DIR/gc" && -z "${ACCUMULO_VERIFY_ONLY}" ]]; then - if [[ -z "${MASTER1}" ]] ; then - echo "Could not infer a GC role. You need to either set up \"${ACCUMULO_CONF_DIR}/gc\" or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty." - exit 1 - else - echo "$MASTER1" > "$ACCUMULO_CONF_DIR/gc" - fi -fi - -SSH='ssh -qnf -o ConnectTimeout=2' - export HADOOP_HOME=$HADOOP_PREFIX export HADOOP_HOME_WARN_SUPPRESS=true # See HADOOP-7154 and ACCUMULO-847 export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-1} -# ACCUMULO-1985 provide a way to use the scripts and still bind to all network interfaces -export ACCUMULO_MONITOR_BIND_ALL=${ACCUMULO_MONITOR_BIND_ALL:-"false"} - # Check for jaas.conf configuration if [[ -z ${ACCUMULO_JAAS_CONF} ]]; then if [[ -f ${ACCUMULO_CONF_DIR}/jaas.conf ]]; then http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/start-all.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/start-all.sh b/assemble/bin/start-all.sh index b69bc0e..a4596db 100755 --- a/assemble/bin/start-all.sh +++ b/assemble/bin/start-all.sh @@ -26,6 +26,7 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Stop: Resolve Script Directory . "$bin"/config.sh +. "$bin"/config-server.sh unset DISPLAY if [ ! -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/start-here.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/start-here.sh b/assemble/bin/start-here.sh index 7d70e97..76bcc96 100755 --- a/assemble/bin/start-here.sh +++ b/assemble/bin/start-here.sh @@ -30,6 +30,7 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # Stop: Resolve Script Directory . "$bin"/config.sh +. "$bin"/config-server.sh IFCONFIG=/sbin/ifconfig [[ ! -x $IFCONFIG ]] && IFCONFIG='/bin/netstat -ie' http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/start-server.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/start-server.sh b/assemble/bin/start-server.sh index 43b5d8c..1ed73de 100755 --- a/assemble/bin/start-server.sh +++ b/assemble/bin/start-server.sh @@ -27,6 +27,7 @@ script=$( basename "$SOURCE" ) # Stop: Resolve Script Directory . "$bin"/config.sh +. "$bin"/config-server.sh HOST="$1" host "$1" >/dev/null 2>/dev/null http://git-wip-us.apache.org/repos/asf/accumulo/blob/e6145486/assemble/bin/stop-all.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/stop-all.sh b/assemble/bin/stop-all.sh index 0af0ee1..2825ef6 100755 --- a/assemble/bin/stop-all.sh +++ b/assemble/bin/stop-all.sh @@ -27,6 +27,7 @@ bin=$( cd -P "$( dirname "$SOURCE" )" && pwd ) # Stop: Resolve Script Directory . "$bin"/config.sh +. "$bin"/config-server.sh echo "Stopping accumulo services..." ${bin}/accumulo admin "$@" stopAll