accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [6/9] git commit: ACCUMULO-3087 Attempt to expand shortname to FQDN.
Date Thu, 28 Aug 2014 01:46:06 GMT
ACCUMULO-3087 Attempt to expand shortname to FQDN.

This should make start-server.sh a bit more resilient
against thinking it needs to SSH around. Instead of having
to match exactly what `hostname` is returning, this should
prevent an (unnecessary) SSH just because hostname is returning
the short instead of full, or vice versa.


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

Branch: refs/heads/1.5.2-SNAPSHOT
Commit: f838cd9e4afa18f6854c49b089fb5e40e94b0958
Parents: 6f2fd4d
Author: Josh Elser <elserj@apache.org>
Authored: Wed Aug 27 20:46:51 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Aug 27 20:46:51 2014 -0400

----------------------------------------------------------------------
 bin/start-server.sh | 21 ++++++++++++++-------
 bin/stop-server.sh  |  2 +-
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f838cd9e/bin/start-server.sh
----------------------------------------------------------------------
diff --git a/bin/start-server.sh b/bin/start-server.sh
index f5fd33a..5fa2156 100755
--- a/bin/start-server.sh
+++ b/bin/start-server.sh
@@ -47,18 +47,25 @@ if [ ! -x $IFCONFIG ]; then
    IFCONFIG='/bin/netstat -ie'
 fi
 
-# ACCUMULO-1985 Allow monitor to bind on all interfaces
-if [ ${SERVICE} == "monitor" -a ${ACCUMULO_MONITOR_BIND_ALL} == "true" ]; then
-    ADDRESS="0.0.0.0"
-fi
-
 ip=$($IFCONFIG 2>/dev/null| grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep
-v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
 if [ $? != 0 ]
 then
    ip=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
 fi
 
-if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
+# When the hostname provided is the alias/shortname, try to use the FQDN to make
+# sure we send the right address to the Accumulo process.
+if [ "$HOST" = "`hostname -s`" ]; then
+    HOST="`hostname -f`"
+    ADDRESS="$HOST"
+fi
+
+# ACCUMULO-1985 Allow monitor to bind on all interfaces
+if [ ${SERVICE} == "monitor" -a ${ACCUMULO_MONITOR_BIND_ALL} == "true" ]; then
+    ADDRESS="0.0.0.0"
+fi
+
+if [ "$HOST" = "localhost" -o "$HOST" = "`hostname -f`" -o "$HOST" = "$ip" ]; then
    PID=$(ps -ef | egrep ${ACCUMULO_HOME}/.*/accumulo.*.jar | grep "Main $SERVICE" | grep
-v grep | awk {'print $2'} | head -1)
 else
    PID=$($SSH $HOST ps -ef | egrep ${ACCUMULO_HOME}/.*/accumulo.*.jar | grep "Main $SERVICE"
| grep -v grep | awk {'print $2'} | head -1)
@@ -66,7 +73,7 @@ fi
 
 if [ -z $PID ]; then
    echo "Starting $LONGNAME on $HOST"
-   if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
+   if [ "$HOST" = "localhost" -o "$HOST" = "`hostname -f`" -o "$HOST" = "$ip" ]; then
       ${bin}/accumulo ${SERVICE} --address ${ADDRESS} >${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.out
2>${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.err & 
       MAX_FILES_OPEN=$(ulimit -n)
    else

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f838cd9e/bin/stop-server.sh
----------------------------------------------------------------------
diff --git a/bin/stop-server.sh b/bin/stop-server.sh
index 6fbe0af..d615172 100755
--- a/bin/stop-server.sh
+++ b/bin/stop-server.sh
@@ -41,7 +41,7 @@ then
 fi
 
 # only stop if there's not one already running
-if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
+if [ "$HOST" = "localhost" -o "$HOST" = "`hostname -s`" -o "$HOST" = "`hostname -f`" -o "$HOST"
= "$ip" ]; then
    PID=$(ps -ef | grep "$ACCUMULO_HOME" | egrep ${2} | grep "Main ${3}" | grep -v grep |
grep -v ssh | grep -v stop-server.sh | awk {'print $2'} | head -1)
    if [ ! -z $PID ]; then
       echo "Stopping ${3} on $1";


Mime
View raw message