hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [5/6] hbase git commit: HBASE-17988 get-active-master.rb and draining_servers.rb no longer work
Date Tue, 20 Jun 2017 06:27:48 GMT
HBASE-17988 get-active-master.rb and draining_servers.rb no longer work

Modified jruby scripts to pick up drainingZNode and masterAddressZNode
correctly, from within znodePaths in ZooKeeperWatcher. Modified
get-active-master.rb to retrieve server name using MasterAddressTracker
instead of ZKUtil.

Tested on a standalone HBase deployment to check that the scripts work
as expected.

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Mike Drob <mdrob@apache.org>


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

Branch: refs/heads/branch-2
Commit: 6012bcdd1db4796d16210a16c98702421efce13e
Parents: 8b0ae5d
Author: Chinmay Kulkarni <chinmayskulkarni@gmail.com>
Authored: Thu Jun 8 16:25:00 2017 -0700
Committer: Sean Busbey <busbey@apache.org>
Committed: Tue Jun 20 01:11:14 2017 -0500

----------------------------------------------------------------------
 bin/draining_servers.rb  |  6 +++---
 bin/get-active-master.rb | 10 ++--------
 2 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6012bcdd/bin/draining_servers.rb
----------------------------------------------------------------------
diff --git a/bin/draining_servers.rb b/bin/draining_servers.rb
index 8a615a8..8e1b250 100644
--- a/bin/draining_servers.rb
+++ b/bin/draining_servers.rb
@@ -89,7 +89,7 @@ def addServers(options, hostOrServers)
   servers = getServerNames(hostOrServers, config)
   
   zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers",
nil)
-  parentZnode = zkw.drainingZNode
+  parentZnode = zkw.znodePaths.drainingZNode
   
   begin
     for server in servers
@@ -106,7 +106,7 @@ def removeServers(options, hostOrServers)
   servers = getServerNames(hostOrServers, config)
   
   zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers",
nil)
-  parentZnode = zkw.drainingZNode
+  parentZnode = zkw.znodePaths.drainingZNode
   
   begin
     for server in servers
@@ -123,7 +123,7 @@ def listServers(options)
   config = HBaseConfiguration.create()
   
   zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(config, "draining_servers",
nil)
-  parentZnode = zkw.drainingZNode
+  parentZnode = zkw.znodePaths.drainingZNode
 
   servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)
   servers.each {|server| puts server}

http://git-wip-us.apache.org/repos/asf/hbase/blob/6012bcdd/bin/get-active-master.rb
----------------------------------------------------------------------
diff --git a/bin/get-active-master.rb b/bin/get-active-master.rb
index bd303b3..4479425 100644
--- a/bin/get-active-master.rb
+++ b/bin/get-active-master.rb
@@ -20,8 +20,8 @@
 include Java 
 java_import org.apache.hadoop.hbase.HBaseConfiguration
 java_import org.apache.hadoop.hbase.ServerName
-java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
 java_import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher
+java_import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker
 
 # disable debug/info logging on this script for clarity
 log_level = org.apache.log4j.Level::ERROR
@@ -32,13 +32,7 @@ config = HBaseConfiguration.create
 
 zk = ZooKeeperWatcher.new(config, 'get-active-master', nil)
 begin
-  master_address = ZKUtil.getData(zk, zk.masterAddressZNode)
-  if master_address
-    puts ServerName.parseFrom(master_address).getHostname()
-  else
-    puts 'Master not running'
-  end
+  puts MasterAddressTracker.getMasterAddress(zk).getHostname()
 ensure
   zk.close()
 end
-


Mime
View raw message