Pivotal Knowledge Base

Follow

How to set up HiveServer2 High Availability (HA)

Environment

Product Version
PHD 3.0.1
HiveServer2 0.14.x
Ambari Server 2.1.2

Purpose

In previous versions of HiveServer2, a client would only be able to connect to one HiveServer2; if that one HiveServer2 failed or went down, production would be affected. 

Since Pivotal Hadoop (PHD) version 3.0.1 with Ambari version 2.1.2, multiple HiveServer2 instances can register themselves with ZooKeeper and then the client can find a HiverServer2 via ZooKeeper. When a client requests an HiveServer2 instance, ZooKeeper returns one randomly-selected registered HiveServer2. 

The High Availability (HA) feature for HiveServers is currently not documented in the PHD documentation, so this article will give an outline of the steps needed to enable HA for HiveServer2 in PHD 3.0 and will point to a Hortonworks document that gives further details.

Procedure

  1. Select "Hive" in the Ambari service list.
  2. In Ambari's "Service action" menu, select "Add hiveserver2".
  3. Confirm the HIVE Metastore allows access from the new HiveServer2 host.
  4. Start the new HiveServer2 via Ambari.
  5. Restart ALL other relevant services as requested by Ambari.
  6. Update all clients to connect to the ZooKeeper ensemble rather than directly to the one HiveServer2 node.

For more detailed instructions, please refer to the Hortonworks documentation about HiveServer2 HA.

How to check HiveServer2 has registered with ZooKeeper correctly:

When the HiveServer2 registers with ZooKeeper, a new znode is created. To confirm that the configuration is set up correctly, the znode can be checked via the ZooKeeper CLI: 

  1. Log into a node where ZooKeeper is installed.
  2. Run zkCli.sh to open a connection to ZooKeeper.
  3. In the ZooKeeper CLI, run "ls /hiveserver2":
[zk: localhost:2181(CONNECTED) 1] ls /hiveserver2
[serverUri=node2:10000;version=1.2.1.2.3.0.0-2557;sequence=0000000016, serverUri=node1:10000;version=1.2.1.2.3.0.0-2557;sequence=0000000015]
[zk: localhost:2181(CONNECTED) 2] quit
Quitting...
2016-03-01 10:56:00,543 - INFO [main:ZooKeeper@684] - Session: 0x1532d60dbea0006 closed
2016-03-01 10:56:00,543 - INFO [main-EventThread:ClientCnxn$EventThread@512] - EventThread shut down
[root@node1 /]# 

As per the output listed above, the two nodes that are running HiveServer2 (node1 and node2) are registered in ZooKeeper which confirms that the HiveServer2 servers have registered correctly in ZooKeeper.

Comments

Powered by Zendesk