HBASE-21629 draining_servers.rb is broken
This commit is contained in:
parent
97fd647de2
commit
59f77de723
|
@ -27,6 +27,7 @@ java_import org.apache.hadoop.hbase.HBaseConfiguration
|
|||
java_import org.apache.hadoop.hbase.client.ConnectionFactory
|
||||
java_import org.apache.hadoop.hbase.client.HBaseAdmin
|
||||
java_import org.apache.hadoop.hbase.zookeeper.ZKUtil
|
||||
java_import org.apache.hadoop.hbase.zookeeper.ZNodePaths
|
||||
java_import org.slf4j.LoggerFactory
|
||||
|
||||
# Name of this script
|
||||
|
@ -86,11 +87,11 @@ def addServers(_options, hostOrServers)
|
|||
servers = getServerNames(hostOrServers, config)
|
||||
|
||||
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
|
||||
parentZnode = zkw.znodePaths.drainingZNode
|
||||
|
||||
begin
|
||||
parentZnode = zkw.getZNodePaths.drainingZNode
|
||||
for server in servers
|
||||
node = ZKUtil.joinZNode(parentZnode, server)
|
||||
node = ZNodePaths.joinZNode(parentZnode, server)
|
||||
ZKUtil.createAndFailSilent(zkw, node)
|
||||
end
|
||||
ensure
|
||||
|
@ -103,11 +104,11 @@ def removeServers(_options, hostOrServers)
|
|||
servers = getServerNames(hostOrServers, config)
|
||||
|
||||
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
|
||||
parentZnode = zkw.znodePaths.drainingZNode
|
||||
|
||||
begin
|
||||
parentZnode = zkw.getZNodePaths.drainingZNode
|
||||
for server in servers
|
||||
node = ZKUtil.joinZNode(parentZnode, server)
|
||||
node = ZNodePaths.joinZNode(parentZnode, server)
|
||||
ZKUtil.deleteNodeFailSilent(zkw, node)
|
||||
end
|
||||
ensure
|
||||
|
@ -120,10 +121,14 @@ def listServers(_options)
|
|||
config = HBaseConfiguration.create
|
||||
|
||||
zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil)
|
||||
parentZnode = zkw.znodePaths.drainingZNode
|
||||
|
||||
servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)
|
||||
servers.each { |server| puts server }
|
||||
begin
|
||||
parentZnode = zkw.getZNodePaths.drainingZNode
|
||||
servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode)
|
||||
servers.each { |server| puts server }
|
||||
ensure
|
||||
zkw.close
|
||||
end
|
||||
end
|
||||
|
||||
hostOrServers = ARGV[1..ARGV.size]
|
||||
|
|
Loading…
Reference in New Issue