Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5AD67200B63 for ; Tue, 16 Aug 2016 00:01:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 59783160AA7; Mon, 15 Aug 2016 22:01:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5261B160AB9 for ; Tue, 16 Aug 2016 00:01:15 +0200 (CEST) Received: (qmail 79970 invoked by uid 500); 15 Aug 2016 22:01:14 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 79835 invoked by uid 99); 15 Aug 2016 22:01:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2016 22:01:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 46323E3611; Mon, 15 Aug 2016 22:01:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Mon, 15 Aug 2016 22:01:17 -0000 Message-Id: <190ec5bf08c34210b1dfb2660e1cf17b@git.apache.org> In-Reply-To: <3064f1ae935a47f6866cb99f25457e34@git.apache.org> References: <3064f1ae935a47f6866cb99f25457e34@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/5] accumulo git commit: ACCUMULO-4406 Addendum to Dave's fixes on log naming archived-at: Mon, 15 Aug 2016 22:01:16 -0000 ACCUMULO-4406 Addendum to Dave's fixes on log naming * Use a system property (since global) that points to Accumulo using it * Update generic_logger.properties template * Only set system property when instance for service is provided * Default to "1" when NUM_TSERVERS isn't defined (instead of erroring) * Restore original log names when single tserver is used * Avoid duplicative numbers in log file names (e.g. tserver-1_1_fqdn...) Closes #139 Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/30d065de Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/30d065de Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/30d065de Branch: refs/heads/1.8 Commit: 30d065dee97e28b47b402e2f76ad569e90bc4a11 Parents: 208680f Author: Josh Elser Authored: Mon Aug 15 17:25:15 2016 -0400 Committer: Josh Elser Committed: Mon Aug 15 17:59:39 2016 -0400 ---------------------------------------------------------------------- assemble/bin/accumulo | 15 +++++++++++---- assemble/bin/config.sh | 10 +++++++--- assemble/bin/start-daemon.sh | 6 ++++-- assemble/conf/templates/generic_logger.properties | 4 ++-- assemble/conf/templates/generic_logger.xml | 4 ++-- 5 files changed, 26 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/30d065de/assemble/bin/accumulo ---------------------------------------------------------------------- diff --git a/assemble/bin/accumulo b/assemble/bin/accumulo index 91298d1..c26e704 100755 --- a/assemble/bin/accumulo +++ b/assemble/bin/accumulo @@ -154,20 +154,27 @@ export JAVA_HOME HADOOP_PREFIX ZOOKEEPER_HOME LD_LIBRARY_PATH DYLD_LIBRARY_PATH # Strip the instance from $1 APP=$1 -INSTANCE="1" +# Avoid setting an instance unless it's necessary to ensure consistency in filenames +INSTANCE="" +# Avoid setting a pointless system property +INSTANCE_OPT="" if [[ "$1" =~ .*-.* ]]; then - APP=`echo $1 | cut -d"-" -f1` - INSTANCE=`echo $1 | cut -d"-" -f2` + APP="$(echo $1 | cut -d'-' -f1)" + # Appending the trailing underscore to make single-tserver deploys look how they did + INSTANCE="$(echo $1 | cut -d'-' -f2)_" #Rewrite the input arguments set -- "$APP" "${@:2}" + + # The extra system property we'll pass to the java cmd + INSTANCE_OPT="-Daccumulo.service.instance=${INSTANCE}" fi # # app isn't used anywhere, but it makes the process easier to spot when ps/top/snmp truncate the command line JAVA="${JAVA_HOME}/bin/java" exec "$JAVA" "-Dapp=$1" \ - "-Dinstance=$INSTANCE" \ + $INSTANCE_OPT \ $ACCUMULO_OPTS \ -classpath "${CLASSPATH}" \ -XX:OnOutOfMemoryError="${ACCUMULO_KILL_CMD:-kill -9 %p}" \ http://git-wip-us.apache.org/repos/asf/accumulo/blob/30d065de/assemble/bin/config.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/config.sh b/assemble/bin/config.sh index ae4b4ef..97a42c6 100755 --- a/assemble/bin/config.sh +++ b/assemble/bin/config.sh @@ -118,11 +118,15 @@ else export NUMA_CMD="" fi -# NUMA sanity checks -if [[ -z $NUM_TSERVERS ]]; then - echo "NUM_TSERVERS is missing in accumulo-env.sh, please check your configuration." +NUM_TSERVERS=${NUM_TSERVERS:-1} + +# Validate that NUM_TSERVERS is a positive integer +if ! [[ $NUM_TSERVERS =~ ^[0-9]+$ ]]; then + echo "NUM_TSERVERS, when defined in accumulo-env.sh, should be a positive number, is '$NUM_TSERVERS'" exit 1 fi + +# NUMA sanity checks if [[ $NUM_TSERVERS -eq 1 && -n $TSERVER_NUMA_OPTIONS ]]; then echo "TSERVER_NUMA_OPTIONS declared when NUM_TSERVERS is 1, use ACCUMULO_NUMACTL_OPTIONS instead" exit 1 http://git-wip-us.apache.org/repos/asf/accumulo/blob/30d065de/assemble/bin/start-daemon.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/start-daemon.sh b/assemble/bin/start-daemon.sh index c02970f..9b57e00 100755 --- a/assemble/bin/start-daemon.sh +++ b/assemble/bin/start-daemon.sh @@ -138,8 +138,10 @@ else fi fi - OUTFILE="${ACCUMULO_LOG_DIR}/${SERVICE}_${t}_${LOGHOST}.out" - ERRFILE="${ACCUMULO_LOG_DIR}/${SERVICE}_${t}_${LOGHOST}.err" + # We want the files to be consistently named with the log files + # server_identifier_hostname.{out,err}, e.g. tserver_2_fqdn.out + OUTFILE="${ACCUMULO_LOG_DIR}/${S}_${t}_${LOGHOST}.out" + ERRFILE="${ACCUMULO_LOG_DIR}/${S}_${t}_${LOGHOST}.err" # Rotate the .out and .err files rotate_log "$OUTFILE" ${ACCUMULO_NUM_OUT_FILES} http://git-wip-us.apache.org/repos/asf/accumulo/blob/30d065de/assemble/conf/templates/generic_logger.properties ---------------------------------------------------------------------- diff --git a/assemble/conf/templates/generic_logger.properties b/assemble/conf/templates/generic_logger.properties index d1e4a41..dbe12cf 100644 --- a/assemble/conf/templates/generic_logger.properties +++ b/assemble/conf/templates/generic_logger.properties @@ -15,7 +15,7 @@ # Write out everything at the DEBUG level to the debug log log4j.appender.A2=org.apache.log4j.RollingFileAppender -log4j.appender.A2.File=${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}_fromprops.debug.log +log4j.appender.A2.File=${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${accumulo.service.instance}${org.apache.accumulo.core.ip.localhost.hostname}_fromprops.debug.log log4j.appender.A2.MaxFileSize=1000MB log4j.appender.A2.MaxBackupIndex=10 log4j.appender.A2.Threshold=DEBUG @@ -24,7 +24,7 @@ log4j.appender.A2.layout.ConversionPattern=%d{ISO8601} [%-8c{2}] %-5p: %m%n # Write out INFO and higher to the regular log log4j.appender.A3=org.apache.log4j.RollingFileAppender -log4j.appender.A3.File=${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}_fromprops.log +log4j.appender.A3.File=${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${accumulo.service.instance}${org.apache.accumulo.core.ip.localhost.hostname}_fromprops.log log4j.appender.A3.MaxFileSize=1000MB log4j.appender.A3.MaxBackupIndex=10 log4j.appender.A3.Threshold=INFO http://git-wip-us.apache.org/repos/asf/accumulo/blob/30d065de/assemble/conf/templates/generic_logger.xml ---------------------------------------------------------------------- diff --git a/assemble/conf/templates/generic_logger.xml b/assemble/conf/templates/generic_logger.xml index 833df17..a71effe 100644 --- a/assemble/conf/templates/generic_logger.xml +++ b/assemble/conf/templates/generic_logger.xml @@ -20,7 +20,7 @@ - + @@ -31,7 +31,7 @@ - +