How to check on HBase Master Status?


There is no direct way to find the status. There are two ways I found that would clearly indicate the status:

  1. Web UI - Comes with the installation.

  2. Zookeeper cli

As mentioned in the previous post, “The HBase master publishes its location to clients via Zookeeper. This is done to support multimaster operation (failover).”

Its important to note that any change sto HBase Master will take place within the timeout mentioned in zookeeper.session.timeout.

If you’re like us and would like to create scripts to check on the status of the HBase Master then Zookeeper commands is the best way to find the HBase Master and the status. Here are some useful commands:

Connect to Zookeeper through HBase:

  • hbase zkcli -server ${ZKHOST}:${ZKPORT}
    ZKHost: Zookeeper Host
    ZKPORT: Zookeeper Port. Default is 2181.

Find Master Node controlling zookeeper:

  • Once connected to Zookeeper using above command then you can run the following to get the Master Node which is controlling Zookeeper at this time:

    get /hbase/master

    Sample output:

    [zk: localhost:2181(CONNECTED) 0] get /hbase/master
    �18182@nodedb2.hbdomainnodedb2.hbdomain,60000,1361996502780
    cZxid = 0xa0000000a
    ctime = Wed Feb 27 12:21:22 PST 2013
    mZxid = 0xa0000000a<br />
    mtime = Wed Feb 27 12:21:22 PST 2013
    pZxid = 0xa0000000a
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x23d1d50b3980001
    dataLength = 65
    numChildren = 0


    If none of the master nodes are available then you get the following error:

    [zk: localhost:2181(CONNECTED) 1] get /hbase/master
    Node does not exist: /hbase/master


Find backup Master Nodes waiting to take control:

  • Once connected to Zookeeper through HBase then you can run the following command to return the list of Backup Master Nodes:

    ls /hbase/backup-masters

    Sample Output:

    [zk: localhost:2181(CONNECTED) 7] ls /hbase/backup-masters
    [db-hb1.hbdomain,60000,1362010238030]

    If backup Master Nodes are not available or down:

    [zk: localhost:2181(CONNECTED) 8] ls /hbase/backup-masters
    []

  1. No comments yet.
(will not be published)
*