How to Configure HiveMetastore HA and Load Balancing for HiveServer2
Assumtions: You have already Installed and Configured Hive Metastore and Hive Server2
- Select Hive Services -> configuration
- Select Scope -> Hive Metastore Server and category -> Advanced.
- Locate the Hive Metastore Delegation Token Store property. or search for it by typing its name in the search box.
- select org.apache.hadoop.hive.thrift.DBTokenStore click save changes

Now go to Yarn – Resource Pools section
- Click on instance tab and add role instance.
- Click the text field under hive metastore server.
- Click on Select Hosts for Hive Metastore Server.

- Click Finish. You should now see new hosts added as the Hive Metastore Server.
- Re-start the stale configurations
Test HA set up for Hive Meta Store:
SSH to any Gateway. Connect to Hiveserver2 using Beeline.

Now from CM, select first Hive Metastore Server and stop the connection.


Now stop second hive Metastore server. This command should fail which is normal.


Confiure Load balancing for HiverServer2:
Add couple of You should now see new hosts added as HiveServer2.
- Go to the Hive service.
- Click the Configuration tab -> Scope > HiveServer2 and Category -> Advanced
- Locate the HiveServer2 advanced Snippet property or search for it by typing its name in the Search box.

Now connect HiveServer2 through Zookeeper.
beeline -u "jdbc:hive2://dn1:2181,dn2:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2"
