HBASE-14523 rolling-restart.sh --graceful will start regionserver process on 
master node


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

Branch: refs/heads/hbase-12439
Commit: 1c900e17218c2e9e3586cef78f90e3583f9ac746
Parents: 001eb06
Author: tedyu <yuzhih...@gmail.com>
Authored: Fri Nov 27 15:37:25 2015 -0800
Committer: tedyu <yuzhih...@gmail.com>
Committed: Fri Nov 27 15:37:25 2015 -0800

----------------------------------------------------------------------
 bin/rolling-restart.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1c900e17/bin/rolling-restart.sh
----------------------------------------------------------------------
diff --git a/bin/rolling-restart.sh b/bin/rolling-restart.sh
index b3ac67f..fb43967 100755
--- a/bin/rolling-restart.sh
+++ b/bin/rolling-restart.sh
@@ -158,6 +158,8 @@ else
 
   if [ $RR_GRACEFUL -eq 1 ]; then
     # gracefully restart all online regionservers
+    masterport=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool 
hbase.master.port`
+    if [ "$masterport" == "null" ]; then masterport="16000"; fi
     zkrs=`$bin/hbase org.apache.hadoop.hbase.util.HBaseConfTool 
zookeeper.znode.rs`
     if [ "$zkrs" == "null" ]; then zkrs="rs"; fi
     zkrs="$zparent/$zkrs"
@@ -166,9 +168,15 @@ else
     do
         rs_parts=(${rs//,/ })
         hostname=${rs_parts[0]}
-        echo "Gracefully restarting: $hostname"
-        "$bin"/graceful_stop.sh --config "${HBASE_CONF_DIR}" --restart 
--reload --debug --maxthreads "${RR_MAXTHREADS}" "$hostname"
-        sleep 1
+        port=${rs_parts[1]}
+        if [ "$port" -eq "$masterport" ]; then
+          echo "Skipping regionserver on master machine $hostname:$port"
+          continue
+        else
+          echo "Gracefully restarting: $hostname"
+          "$bin"/graceful_stop.sh --config "${HBASE_CONF_DIR}" --restart 
--reload --debug --maxthreads "${RR_MAXTHREADS}" "$hostname"
+          sleep 1
+        fi
     done
   fi
 fi

Reply via email to