This section provides information on the use cases and failover scenarios for high availability (HA) in the Hive metastore.
Use Cases
The metastore HA solution is designed to handle metastore service failures. When a deployed metastore service fails, it can remain unavailable for a considerable time until the service is started again. To avoid such outages, deploy the metastore service in HA mode.
Deployment Scenarios
We recommend deploying the metastore service on multiple servers concurrently.
Each Hive metastore client reads the configuration setting in the hive.metastore.uris
property to
get a list of metastore servers with which it can attempt to communicate:
<property> <name>hive.metastore.uris</name> <value>thrift://$Hive_Metastore_Server_Host_Machine_FQDN</value> <description>A comma separated list of metastore uris on which metastore service is running</description> </property>
These metastore servers store their state in a MySQL HA cluster. See the MySQL documentation for information about configuring a MySQL HA cluster.
In the case of a secure cluster, each of the metastore servers will additionally need to have the
following configuration property in its hive-site.xml
file:
<property> <name>hive.cluster.delegation.token.store.class</name> <value>org.apache.hadoop.hive.thrift.DBTokenStore</value> </property>
Failover Scenario
A Hive metastore client always uses the first URI to connect with the metastore server. In case the metastore server becomes unreachable, the client randomly picks a URI from the list and tries to connect with it.