You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2017/06/20 06:09:03 UTC
[4/6] hbase git commit: HBASE-17988 get-active-master.rb and
draining_servers.rb no longer work
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 <bu...@apache.org>
Signed-off-by: Mike Drob <md...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/df062949
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/df062949
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/df062949
Branch: refs/heads/master
Commit: df06294915ee70b66e9dd0592b99083ca50fb56d
Parents: 298454e
Author: Chinmay Kulkarni <ch...@gmail.com>
Authored: Thu Jun 8 16:25:00 2017 -0700
Committer: Sean Busbey <bu...@apache.org>
Committed: Tue Jun 20 01:06:47 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/df062949/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/df062949/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
-