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>
This commit is contained in:
parent
298454e8a7
commit
df06294915
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue