hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject incubator-hawq git commit: HAWQ-1449. HAWQ start/stop cluster should be able to start/stop RPS on standby node
Date Thu, 04 May 2017 03:52:01 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 0a754883f -> 0079c2d68


HAWQ-1449. HAWQ start/stop cluster should be able to start/stop RPS on standby node


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/0079c2d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/0079c2d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/0079c2d6

Branch: refs/heads/master
Commit: 0079c2d6856766e74ffb6f31c4860a7c5de045fa
Parents: 0a75488
Author: stanlyxiang <stanly.sxiang@gmail.com>
Authored: Wed May 3 13:55:42 2017 +0800
Committer: Wen Lin <wlin@pivotal.io>
Committed: Thu May 4 11:45:18 2017 +0800

----------------------------------------------------------------------
 ranger-plugin/scripts/rps.sh |  3 ++-
 tools/bin/hawq_ctl           | 52 ++++++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0079c2d6/ranger-plugin/scripts/rps.sh
----------------------------------------------------------------------
diff --git a/ranger-plugin/scripts/rps.sh b/ranger-plugin/scripts/rps.sh
index 70aa547..5328d3d 100755
--- a/ranger-plugin/scripts/rps.sh
+++ b/ranger-plugin/scripts/rps.sh
@@ -47,7 +47,8 @@ export CATALINA_OPTS="-server -Xms${RPS_HEAP_SIZE} -Xmx${RPS_HEAP_SIZE}
 # options used to stop the RPS process
 export JAVA_OPTS="-Drps.shutdown.port=${RPS_SHUTDOWN_PORT}"
 
-RPS_URL="http://localhost:${RPS_HTTP_PORT}/rps"
+RPS_HOST=`hostname -f`
+RPS_URL="http://${RPS_HOST}:${RPS_HTTP_PORT}/rps"
 RPS_LOG="${CATALINA_BASE}/logs/catalina.out"
 
 function fail() {

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0079c2d6/tools/bin/hawq_ctl
----------------------------------------------------------------------
diff --git a/tools/bin/hawq_ctl b/tools/bin/hawq_ctl
index cd479cd..f55ec95 100755
--- a/tools/bin/hawq_ctl
+++ b/tools/bin/hawq_ctl
@@ -691,8 +691,10 @@ class HawqStart:
         logger.info("Start all the nodes in hawq cluster")
 
         if self.hawq_acl_type == 'ranger':
-            self.start_rps()
+            self.start_rps(self.master_host_name)
         if self.standby_host_name.lower() not in ('', 'none'):
+            if self.hawq_acl_type == 'ranger':
+                self.start_rps(self.standby_host_name)
             logger.info("Starting standby master '%s'" % self.standby_host_name)
             check_return_code(self.start_standby(), logger, "Standby master start failed,
exit",
                               "Standby master started successfully")
@@ -737,25 +739,28 @@ class HawqStart:
             logger.info("Segments started successfully")
         return node_init.return_flag
 
-    def _start_rps(self):
-        logger.info("Start ranger plugin service")
+    def _start_rps(self, rps_hostname):
+        logger.info("Start ranger plugin service on %s" % rps_hostname)
         cmd_str = "%s/ranger/bin/rps.sh start" % (self.GPHOME)
-        result = remote_ssh(cmd_str, self.master_host_name, self.user)
+        result = remote_ssh(cmd_str, rps_hostname, self.user)
         return result
 
-    def start_rps(self):
-        check_return_code(self._start_rps(), logger, \
-                          "Ranger plugin service start failed, exit", "Ranger plugin service
started successfully")
+    def start_rps(self, rps_hostname):
+        check_return_code(self._start_rps(rps_hostname), logger, \
+                          "Ranger plugin service start on %s failed, exit" % rps_hostname,
\
+                          "Ranger plugin service started on %s successfully" % rps_hostname)
 
     def run(self):
         if self.node_type == "master":
             if self.hawq_acl_type == 'ranger':
-                self.start_rps()
+                self.start_rps(self.master_host_name)
             check_return_code(self.start_master(), logger, \
                               "Master start failed, exit", "Master started successfully")
         elif self.node_type == "standby":
             if self.standby_host_name == '':
                 sys.exit(1)
+            if self.hawq_acl_type == 'ranger':
+                self.start_rps(self.standby_host_name)
             check_return_code(self.start_standby(), logger, "Standby master start failed,
exit",
                               "Standby master started successfully")
         elif self.node_type == "segment":
@@ -961,11 +966,10 @@ class HawqStop:
                 logger.error("Standby master %s failed" % self.stop_action)
             else:
                 logger.info("Standby master %s successfully" % self.stop_action_past)
-        if self.hawq_acl_type == 'ranger':
-            self._stop_rps()
-        if self.hawq_acl_type == 'unknown':
-            logger.warning("Try to stop RPS when hawq_acl_type is unknown")
-            self._stop_rps(check_ret = False)
+        if self.hawq_acl_type in ['ranger', 'unknown']:
+            self._stop_rps(self.master_host_name, self.hawq_acl_type)
+            if self.standby_host_name.lower() not in ('', 'none'):
+                self._stop_rps(self.standby_host_name, self.hawq_acl_type)
 
         # Execute segment stop command on each node.
         segments_return_flag = self._stopAllSegments()
@@ -1042,30 +1046,34 @@ class HawqStop:
         return total_return_flag
 
 
-    def _stop_rps(self, check_ret = True):
+    def _stop_rps(self, rps_hostname, acl_type):
         if self.hawq_reload:
             # not stop RPS when running 'hawq stop --reload'.
             return
-        logger.info("Stop Ranger plugin service")
+        check_ret = True
+        if acl_type == 'unknown':
+            logger.warning("Try to stop RPS when hawq_acl_type is unknown")
+            check_ret = False
+        logger.info("Stop ranger plugin service on %s" % rps_hostname)
         cmd_str = "%s/ranger/bin/rps.sh stop" % (self.GPHOME)
-        result = remote_ssh(cmd_str, self.master_host_name, self.user)
+        result = remote_ssh(cmd_str, rps_hostname, self.user)
         if check_ret:
             check_return_code(result, logger, \
-                          "Ranger plugin service stop failed, exit", "Ranger plugin service
stopped successfully")
+                          "Ranger plugin service stop failed on %s, exit" % rps_hostname,
\
+                          "Ranger plugin service stopped on %s successfully" % rps_hostname)
 
     def run(self):
         if self.node_type == "master":
             check_return_code(self._stop_master(), logger, \
                               "Master %s failed, exit" % self.stop_action, "Master %s successfully"
% self.stop_action_past)
-            if self.hawq_acl_type == 'ranger':
-                self._stop_rps()
-            if self.hawq_acl_type == 'unknown':
-                logger.warning("Try to stop RPS when hawq_acl_type is unknown")
-                self._stop_rps(check_ret = False)
+            if self.hawq_acl_type in ['ranger', 'unknown']:
+                self._stop_rps(self.master_host_name, self.hawq_acl_type)
         elif self.node_type == "standby":
             if self.standby_host_name.lower() not in ('', 'none'):
                 check_return_code(self._stop_standby(), logger, \
                                   "Standby master %s failed, exit" % self.stop_action, "Standby
master %s successfully" % self.stop_action_past)
+                if self.hawq_acl_type in ['ranger', 'unknown']:
+                    self._stop_rps(self.standby_host_name, self.hawq_acl_type)
         elif self.node_type == "segment":
             check_return_code(self._stop_segment(), logger, \
                               "Segment %s failed, exit" % self.stop_action, "Segment %s successfully"
% self.stop_action_past)


Mime
View raw message