timyuer commented on code in PR #3702:
URL: https://github.com/apache/ambari/pull/3702#discussion_r1247514610
##########
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/HBASE/package/scripts/hbase_regionserver.py:
##########
@@ -51,6 +55,57 @@ def configure(self, env):
def decommission(self, env):
print "Decommission not yet implemented!"
+ def graceful_stop(self, env, upgrade_type=None):
+ import params
+
+ # Mark Draining ZNode
+ params.hbase_drain_only = False
+ params.hbase_excluded_hosts = params.hostname
+ env.set_params(params)
+ hbase_decommission(env)
+
+ # Stop RegionServer
+ hbase_service('regionserver', action='stop')
+
+ # Remove from Draining ZNode to make host useable on restarting
regionserver
+ params.hbase_drain_only = True
+ env.set_params(params)
+ hbase_decommission(env)
+
+ def graceful_start(self, env, upgrade_type=None):
+ import params
+ env.set_params(params)
+
+ #Start RegionServer
+ hbase_service('regionserver', action='start')
+
+ # Load Regions back
+ kinit_cmd = params.kinit_cmd_master
+ host = params.hostname
+
+ regionmover_cmd = format(
+ "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\"
{hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config}
org.jruby.Main {region_mover} -m 24 load {host}")
+
+ try:
+ Execute(regionmover_cmd,
+ user=params.hbase_user,
+ logoutput=True
+ )
+ except Exception as e:
+ Logger.info("HBase 1: region_mover failed while loading regions back to
source RS." + str(e))
+ # Execute HBase 2 scripts if HBase 1 scripts fail.
+ # If the Exception is genuine, it will fail here because HBase 1 scripts
work only for HBase 1
+ # and HBase 2 scripts work only for HBase 2 cluster.
+ try:
+ regionmover_cmd = format(
+ "{kinit_cmd} HBASE_SERVER_JAAS_OPTS=\"{master_security_config}\"
{hbase_cmd} --config {hbase_conf_dir} {hbase_decommission_auth_config}
org.jruby.Main {region_mover} -m 24 -o load -r {host}")
+ Execute(regionmover_cmd,
+ user=params.hbase_user,
+ logoutput=True
+ )
Review Comment:
@virajjasani Thank you for your work.
Why don't we use HBase 2 scripts directly because HBase 1 scripts will fail
in the current stack (BIGTOP-3.2.0)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]