You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by mw...@apache.org on 2018/09/06 19:26:36 UTC

[fluo-uno] branch master updated: Uno improvements (#193)

This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo-uno.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f87b64  Uno improvements (#193)
8f87b64 is described below

commit 8f87b64b2320a5ffc24a7a4f9d1a71dd96b7d5b4
Author: Mike Walch <mw...@apache.org>
AuthorDate: Thu Sep 6 15:26:34 2018 -0400

    Uno improvements (#193)
    
    * Give better error if user shell env doesn't match uno.conf
    * Provide better error if checksum not set for expected version
      of software
---
 bin/impl/load-env.sh        | 30 ++++++++++++++++++++++++------
 bin/impl/print-env.sh       |  3 +--
 bin/impl/setup-accumulo.sh  | 12 ++++++------
 bin/impl/setup-hadoop.sh    |  6 +++---
 bin/impl/setup-zookeeper.sh |  6 +++---
 bin/uno                     | 10 +++++++++-
 6 files changed, 46 insertions(+), 21 deletions(-)

diff --git a/bin/impl/load-env.sh b/bin/impl/load-env.sh
index df507eb..7d80223 100755
--- a/bin/impl/load-env.sh
+++ b/bin/impl/load-env.sh
@@ -51,31 +51,36 @@ else
   exit 1
 fi
 
+function env_error() {
+  echo 'Make your shell env match uno.conf by running: eval "$(./bin/uno env)"'
+  exit 1
+}
+
 # Confirm that hadoop, accumulo, and zookeeper env variables are not set
 if [[ ! "version env" =~ $1 ]]; then
   if [[ -n "$HH" && "$HH" != "$HADOOP_HOME" ]]; then
     echo "HADOOP_HOME in your shell env '$HH' needs to match your uno uno.conf '$HADOOP_HOME'"
-    exit 1
+    env_error
   fi
   if [[ -n "$HC" && "$HC" != "$HADOOP_CONF_DIR" ]]; then
     echo "HADOOP_CONF_DIR in your shell env '$HC' needs to match your uno uno.conf '$HADOOP_CONF_DIR'"
-    exit 1
+    env_error
   fi
   if [[ -n "$ZH" && "$ZH" != "$ZOOKEEPER_HOME" ]]; then
     echo "ZOOKEEPER_HOME in your shell env '$ZH' needs to match your uno uno.conf '$ZOOKEEPER_HOME'"
-    exit 1
+    env_error
   fi
   if [[ -n "$SH" && "$SH" != "$SPARK_HOME" ]]; then
     echo "SPARK_HOME in your shell env '$SH' needs to match your uno uno.conf '$SPARK_HOME'"
-    exit 1
+    env_error
   fi
   if [[ -n "$AH" && "$AH" != "$ACCUMULO_HOME" ]]; then
     echo "ACCUMULO_HOME in your shell env '$AH' needs to match your uno uno.conf '$ACCUMULO_HOME'"
-    exit 1
+    env_error
   fi
   if [[ -n "$FH" && "$FH" != "$FLUO_HOME" ]]; then
     echo "FLUO_HOME in your shell env '$FH' needs to match your uno uno.conf '$FLUO_HOME'"
-    exit 1
+    env_error
   fi
 fi
 
@@ -125,6 +130,19 @@ fi
 : "${HADOOP_LOG_DIR:?"HADOOP_LOG_DIR is not set in uno.conf"}"
 : "${ZOO_LOG_DIR:?"ZOO_LOG_DIR is not set in uno.conf"}"
 
+if [[ -z "$HADOOP_HASH" ]]; then
+  echo "HADOOP_HASH is not set. Set it for your version in 'conf/checksums' or uno.conf"
+  exit 1
+fi
+if [[ -z "$ZOOKEEPER_HASH" ]]; then
+  echo "ZOOKEEPER_HASH is not set. Set it for your version in 'conf/checksums' or uno.conf"
+  exit 1
+fi
+if [[ -z "$ACCUMULO_HASH" ]]; then
+  echo "ACCUMULO_HASH is not set. Set it for your version in 'conf/checksums' or uno.conf"
+  exit 1
+fi
+
 hash shasum 2>/dev/null || { echo >&2 "shasum must be installed & on PATH. Aborting."; exit 1; }
 hash sed 2>/dev/null || { echo >&2 "sed must be installed & on PATH. Aborting."; exit 1; }
 
diff --git a/bin/impl/print-env.sh b/bin/impl/print-env.sh
index 6cb1908..c576da4 100755
--- a/bin/impl/print-env.sh
+++ b/bin/impl/print-env.sh
@@ -15,10 +15,9 @@
 # limitations under the License.
 
 if [[ -z "$1" || "$1" == "--vars" ]]; then
+  echo "export HADOOP_HOME=\"$HADOOP_HOME\""
   if [[ $HADOOP_VERSION =~ ^2\..*$ ]]; then
     echo "export HADOOP_PREFIX=\"$HADOOP_HOME\""
-  else
-    echo "export HADOOP_HOME=\"$HADOOP_HOME\""
   fi
   echo "export HADOOP_CONF_DIR=\"$HADOOP_CONF_DIR\""
   echo "export ZOOKEEPER_HOME=\"$ZOOKEEPER_HOME\""
diff --git a/bin/impl/setup-accumulo.sh b/bin/impl/setup-accumulo.sh
index 9a49d4f..2979c55 100755
--- a/bin/impl/setup-accumulo.sh
+++ b/bin/impl/setup-accumulo.sh
@@ -16,6 +16,11 @@
 
 source "$UNO_HOME"/bin/impl/util.sh
 
+pkill -f accumulo.start
+
+# stop if any command fails
+set -e
+
 if [[ -z "$ACCUMULO_REPO" ]]; then
   verify_exist_hash "$ACCUMULO_TARBALL" "$ACCUMULO_HASH"
 fi
@@ -25,12 +30,7 @@ if [[ $1 != "--no-deps" ]]; then
   run_setup_script ZooKeeper
 fi
 
-pkill -f accumulo.start
-
-# stop if any command fails
-set -e
-
-print_to_console "Setting up Apache Accumulo at $ACCUMULO_HOME"
+print_to_console "Setting up Apache Accumulo $ACCUMULO_VERSION at $ACCUMULO_HOME"
 print_to_console "    * Accumulo Monitor: http://localhost:9995/"
 print_to_console "    * view logs at $ACCUMULO_LOG_DIR"
 
diff --git a/bin/impl/setup-hadoop.sh b/bin/impl/setup-hadoop.sh
index 622130f..8945ca9 100755
--- a/bin/impl/setup-hadoop.sh
+++ b/bin/impl/setup-hadoop.sh
@@ -16,21 +16,21 @@
 
 source "$UNO_HOME"/bin/impl/util.sh
 
-verify_exist_hash "$HADOOP_TARBALL" "$HADOOP_HASH"
-
 pkill -f hadoop.hdfs
 pkill -f hadoop.yarn
 
 # stop if any command fails
 set -e
 
+verify_exist_hash "$HADOOP_TARBALL" "$HADOOP_HASH"
+
 namenode_port=9870
 if [[ $HADOOP_VERSION =~ ^2\..*$ ]]; then
   namenode_port=50070
   export HADOOP_PREFIX=$HADOOP_HOME
 fi
 
-print_to_console "Setting up Apache Hadoop at $HADOOP_HOME"
+print_to_console "Setting up Apache Hadoop $HADOOP_VERSION at $HADOOP_HOME"
 print_to_console "    * NameNode status: http://localhost:$namenode_port/"
 print_to_console "    * ResourceManager status: http://localhost:8088/"
 print_to_console "    * view logs at $HADOOP_LOG_DIR"
diff --git a/bin/impl/setup-zookeeper.sh b/bin/impl/setup-zookeeper.sh
index c7cc6c3..80254a2 100755
--- a/bin/impl/setup-zookeeper.sh
+++ b/bin/impl/setup-zookeeper.sh
@@ -16,14 +16,14 @@
 
 source "$UNO_HOME"/bin/impl/util.sh
 
-verify_exist_hash "$ZOOKEEPER_TARBALL" "$ZOOKEEPER_HASH"
-
 pkill -f QuorumPeerMain
 
 # stop if any command fails
 set -e
 
-print_to_console "Setting up Apache ZooKeeper at $ZOOKEEPER_HOME"
+verify_exist_hash "$ZOOKEEPER_TARBALL" "$ZOOKEEPER_HASH"
+
+print_to_console "Setting up Apache ZooKeeper $ZOOKEEPER_VERSION at $ZOOKEEPER_HOME"
 print_to_console "    * view logs at $ZOO_LOG_DIR"
 
 rm -rf "$INSTALL"/zookeeper-*
diff --git a/bin/uno b/bin/uno
index 5389b14..d856b29 100755
--- a/bin/uno
+++ b/bin/uno
@@ -104,6 +104,13 @@ env)
 version)
   "$bin"/impl/version.sh "${@:2}"
   ;;
+wipe)
+  "$bin"/impl/kill.sh
+  if [[ -d "$INSTALL" ]]; then
+    echo "removing $INSTALL"
+    rm -rf "$INSTALL"
+  fi
+  ;;
 *)
   echo -e "Usage: uno <command> (<argument>)\n"
   echo -e "Possible commands:\n"
@@ -114,11 +121,12 @@ version)
   echo "                         Run 'uno setup' for list of components."
   echo "  start <component>      Start ZooKeeper, Hadoop, Accumulo, if not running."
   echo "  stop  <component>      Stop Accumulo, Hadoop, ZooKeeper, if running."
-  echo "  kill                   Kills all software"
+  echo "  kill                   Kills all processes"
   echo "  ashell                 Runs the Accumulo shell"
   echo "  env                    Prints out shell configuration for PATH and common environment variables."
   echo "                         Add '--paths' or '--vars' command to limit what is printed."
   echo "  version <dep>          Prints out configured version for dependency"
+  echo "  wipe                   Kills all processes and clears install directory"
   echo " "
   exit 1
 esac