Configuring HMS for high availability

To provide failover to a secondary Hive metastore if your primary instance goes down, you need to know how to add a Metastore role in Cloudera Manager and configure a property.

Multiple HMS instances run in active/active mode. Load balancing is done at the Hive client side (like HiveServer or Spark) as the HMS client picks an HMS instance randomly. By default, the hive.metastore.uri.selection property is set to RANDOM. If that HMS instance is down, then the client randomly picks another instance from the list of HMS instances specified through the hive.metastore.uris property.

Minimum Required Role: Configurator (also provided by Cluster Administrator, Full Administrator)
  1. In Cloudera Manager, click Clusters > Hive > Configuration.
  2. Take one of the following actions:
    • If you have a secure cluster, search for Hive Delegation Token Store.
    • If you have a non-secure cluster, skip the next step.
  3. Select org.apache.hadoop.hive.thrift.DBTokenStore, and save the change.
  4. Click Instances > Actions > Add Role Instances
  5. In Assign Roles, in Metastore Server, click Select Hosts.
  6. In Hosts Selected, scroll and select the host that you want to serve as the backup Metastore, and click OK.
  7. Continue through the wizard, setting any optional parameters you want.
  8. Start the Metastore role on the host from the Actions menu.
    The hive.metastore.uris property is updated automatically. To verify, go to /etc/hive/config directory in your cluster node and look for the updated property in the hive-site.xml file.
  9. Optional: To change the hive.metastore.uri.selection from RANDOM (default) to SEQUENTIAL, go to Clusters > Hive > Configurations in Cloudera Manager, and search for 'Hive Service Advanced Configuration Snippet (Safety Valve) for hive-site.xml'.
  10. Add the property and value (SEQUENTIAL or RANDOM).