Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to fetch active HBase Master node via zkCli command ?

avatar
Guru

Hi,

I want to get the current active HBaseMaster from Zookeeper under znode /hbase-secure/master via zkCli.sh commandline call.

The output is almost fine, but the nodename is somehow screwed up, so that I cannot use it for comparisons later on =>

#>/usr/hdp/current/zookeeper-client/bin/zkCli.sh -server 01876.something.corp,01874.something.corp,02878.something.corp get /hbase-secure/master
Connecting to 01876.something.corp,01874.something.corp,02878.something.corp
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
WATCHER::
WatchedEvent state:SaslAuthenticated type:None path:null
�master:16000��O�;��PBUF
'
2878.something.corp�}�����*�}
cZxid = 0x6a00019c8a
ctime = Fri Jun 17 14:59:21 CEST 2016
mZxid = 0x6a00019c8a
mtime = Fri Jun 17 14:59:21 CEST 2016
pZxid = 0x6a00019c8a
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x1555727df0a001c
dataLength = 75
numChildren = 0

Any hint how to get the correct nodename of the current active HBase Master via commandline ?!?!

Thanks, Gerd

=============

HDP 2.3.4.7, HBase HA , kerberized

1 ACCEPTED SOLUTION

avatar
Guru

In newer versions of the HBase, you can use

	status 'detailed'

which will print the active master, backup masters as well as regionservers.

View solution in original post

5 REPLIES 5

avatar
Super Guru

Hi Gerd,

You found the right ZNode used for having one and only one active HBase master at one time. The reason it's "screwed" up is that you're actually seeing a serialized data structure. The contents of that znode is a serialized instance of the org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.Master protocol buffer class.

I'm not seeing anything in the HBase shell yet which would be helpful.

avatar
Guru

Many thanks for the xplanation @Josh Elser

I'll use status 'detailed' + some grep'ing around as mentioned by @Enis

avatar
Super Guru

Actually, looks like we might bundle a script you can call for this:

/usr/hdp/current/hbase-client/bin/hbase-jruby /usr/hdp/current/hbase-client/bin/get-active-master.rb

Not sure what the availability of this script is across older versions of HDP.

avatar
Guru

In newer versions of the HBase, you can use

	status 'detailed'

which will print the active master, backup masters as well as regionservers.

avatar
Guru

Hi @Enis,

thanks for this hint. I'll use that in a way like

echo "status 'detailed'" >hbase.command
echo "exit" >> hbase.command
hbase shell -n hbase.command
=> and then further process the output with bash builtins

Thanks, Gerd