You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2020/03/27 21:04:35 UTC
[accumulo] branch master updated: Support multiple tservers / node
in helper scripts (#1568)
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push:
new f27ade9 Support multiple tservers / node in helper scripts (#1568)
f27ade9 is described below
commit f27ade9abf6d907cee77a4b2c7ce81563782eef3
Author: Arvind Shyamsundar <ar...@apache.org>
AuthorDate: Fri Mar 27 14:04:27 2020 -0700
Support multiple tservers / node in helper scripts (#1568)
Enhances accumulo-cluster to start multiple TServers / node if
NUM_TSERVERS is exported (outside of accumulo-env.sh). Corresponding
changes in accumulo.properties (tserver.port.search and
replication.receipt.service.port) are still needed.
Address code review comments
* Inline trivial functions within accumulo-cluster
* Use numeric comparison correctly and double equals consistently
* Efficiently pass ACCUMULO_SERVICE_INSTANCE to SSH connections
* Adds accumulo.metrics.service.instance to accumulo-env.sh to ensure
that metrics for different TServers are correctly identified
---
assemble/bin/accumulo-cluster | 35 +++++++++++++++++++++--------------
assemble/bin/accumulo-service | 6 +++---
assemble/conf/accumulo-env.sh | 1 +
3 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/assemble/bin/accumulo-cluster b/assemble/bin/accumulo-cluster
index 0538996..b40d853 100755
--- a/assemble/bin/accumulo-cluster
+++ b/assemble/bin/accumulo-cluster
@@ -100,15 +100,29 @@ function get_ip() {
echo "$ip_addr"
}
-function start_service() {
+function control_service() {
host="$1"
service="$2"
+ control_cmd="$3"
- if [[ $host == "localhost" || $host == $(hostname -f) || $host == $(hostname -s) || $host == $(get_ip) ]]; then
- "${bin}/accumulo-service" "$service" start
- else
- $SSH "$host" "bash -c '${bin}/accumulo-service \"$service\" start'"
- fi
+ local last_instance_id; last_instance_id=1
+ [[ "$service" == "tserver" ]] && last_instance_id=${NUM_TSERVERS:-1}
+
+ for (( inst_id=1; inst_id<=last_instance_id; inst_id++ ))
+ do
+ ACCUMULO_SERVICE_INSTANCE=""
+ [[ "$service" == "tserver" && ${NUM_TSERVERS:-1} -gt 1 ]] && ACCUMULO_SERVICE_INSTANCE=${inst_id}
+
+ if [[ $host == localhost || $host == "$(hostname -s)" || $host == "$(hostname -f)" || $host == $(get_ip) ]] ; then
+ ACCUMULO_SERVICE_INSTANCE="${ACCUMULO_SERVICE_INSTANCE}" "${bin}/accumulo-service" "$service" "$control_cmd"
+ else
+ $SSH "$host" "bash -c 'ACCUMULO_SERVICE_INSTANCE=${ACCUMULO_SERVICE_INSTANCE} ${bin}/accumulo-service \"$service\" \"$control_cmd\"'"
+ fi
+ done
+}
+
+function start_service() {
+ control_service "$@" start
}
function start_tservers() {
@@ -188,14 +202,7 @@ function start_here() {
}
function end_service() {
- host="$1"
- service="$2"
- end_cmd="$3"
- if [[ $host == localhost || $host = "$(hostname -s)" || $host = "$(hostname -f)" || $host = $(get_ip) ]] ; then
- "${bin}/accumulo-service" "$service" "$end_cmd"
- else
- $SSH "$host" "bash -c '${bin}/accumulo-service \"$service\" \"$end_cmd\"'"
- fi
+ control_service "$@"
}
function stop_service() {
diff --git a/assemble/bin/accumulo-service b/assemble/bin/accumulo-service
index 47562b4..95696b8 100755
--- a/assemble/bin/accumulo-service
+++ b/assemble/bin/accumulo-service
@@ -71,8 +71,8 @@ function start_service() {
"${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
fi
- outfile="${ACCUMULO_LOG_DIR}/${service}_${host}.out"
- errfile="${ACCUMULO_LOG_DIR}/${service}_${host}.err"
+ outfile="${ACCUMULO_LOG_DIR}/${service}${ACCUMULO_SERVICE_INSTANCE}_${host}.out"
+ errfile="${ACCUMULO_LOG_DIR}/${service}${ACCUMULO_SERVICE_INSTANCE}_${host}.err"
rotate_log "$outfile"
rotate_log "$errfile"
@@ -137,7 +137,7 @@ function main() {
host=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
fi
service="$1"
- pid_file="${ACCUMULO_PID_DIR}/accumulo-${service}.pid"
+ pid_file="${ACCUMULO_PID_DIR}/accumulo-${service}${ACCUMULO_SERVICE_INSTANCE}.pid"
case "$service" in
gc|master|monitor|tserver|tracer)
if [[ -z $2 ]]; then
diff --git a/assemble/conf/accumulo-env.sh b/assemble/conf/accumulo-env.sh
index 61e764f..d55269c 100644
--- a/assemble/conf/accumulo-env.sh
+++ b/assemble/conf/accumulo-env.sh
@@ -89,6 +89,7 @@ esac
JAVA_OPTS=("${JAVA_OPTS[@]}"
"-Daccumulo.log.dir=${ACCUMULO_LOG_DIR}"
"-Daccumulo.application=${cmd}${ACCUMULO_SERVICE_INSTANCE}_$(hostname)"
+ "-Daccumulo.metrics.service.instance=${ACCUMULO_SERVICE_INSTANCE}"
"-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
)