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. The HMS client, such as HiveServer or Spark, selects an instance from the list in the hive.metastore.uris property according to the hive.metastore.uri.selection property. The default value is RANDOM: the client picks an HMS instance at random, and if that instance is down, it picks another instance from the list at random. If you set hive.metastore.uri.selection to SEQUENTIAL, the client picks the first valid instance in the list and uses the next instance as the designated replacement.

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 cluster secured by Kerberos, search for Hive Delegation Token Store, which specifies storage for the Kerberos token as described below.
    • If you have an unsecured cluster, skip the next step.
  3. Select org.apache.hadoop.hive.thrift.DBTokenStore, and save the change.
    Storage for the Kerberos delegation token is defined by the hive.cluster.delegation.token.store.class property. The available choices are Zookeeper, the Metastore, and memory. Cloudera recommends using the database by setting the org.apache.hadoop.hive.thrift.DBTokenStore property.
  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. Click Continue until you exit the wizard.
  8. Start the Metastore role on the host from the Actions menu.
    The hive.metastore.uris property is updated automatically.
  9. To check or change the hive.metastore.uri.selection property, go to Clusters > Hive on Tez > Configuration in Cloudera Manager, and search for 'Hive Service Advanced Configuration Snippet (Safety Valve) for hive-site.xml'.
    The default value of the hive.metastore.uri.selection property is RANDOM.
  10. Add the hive.metastore.uri.selection property and set its value to SEQUENTIAL or RANDOM.