The HBase master is responsible for orchestrating various admin operations in an HBase cluster. Operations such as creating a table, adding a column family, or taking a snapshot, require coordination across multiple nodes in the cluster. The HBase master handles this coordination.
Before we describe the HBase master, we need to understand the role of the META region:
- META is a special region in an HBase cluster. It is the region that keeps the state of all the other regions in the cluster. Specifically, it tracks what the regions are, what the associated key ranges are, the RegionServers they've been assigned to, and other information. The META region is hosted on one of the RegionServers in the cluster. It's the master that is responsible for keeping the META region up to date to reflect the current state of the cluster. As regions get split, merged, and moved around, the master updates its internal state as well as the META region.
- The master is responsible for ensuring that the cluster is balanced, and that each node in the cluster is pulling its weight equally. The master periodically looks at the current distribution of regions, and if it is unbalanced, generates a plan of how to move regions around to get to an optimal distribution.
The assignment manager, which is a component within the master, is responsible for taking that plan and executing it. It handles coordination with RegionServers to close and open regions and to update META once the ownership transfer is complete.
When an HBase node dies, Zookeeper detects the lack of a heartbeat and lets the master know. The master coordinates the ownership transfer of regions hosted on the dead node to another live node in the cluster (the exact mechanics of this are covered later).
The HBase master is on the critical path for admin operations. For data operations, such as read and write requests, the HBase master is on the critical path only for new client connections. Once an HBase client has an already established connection with the cluster, the loss of the HBase master doesn't interrupt the client traffic flow.
HBase allows for multiple instances of the master to be brought up in an active-standby configuration. Once the active instance stops sending its heartbeat to Zookeeper, one of the backup instances takes over and becomes the active master.