The default built-in MySQL metastore in E-MapReduce (EMR) is tied to the cluster lifecycle: deleting a cluster also deletes its metadata, and the metastore cannot be shared across clusters. Switch to Data Lake Formation (DLF) — a fully managed service by Alibaba Cloud for centralized metadata management, user permission management, data ingestion, and data exploration — to store metadata centrally so that multiple clusters share the same metadata and permissions, even after individual clusters are removed. For more information about DLF, see Overview.
DLF can be used as the Hive metastore only on EMR V3.33.0 or later, or EMR V4.5.0 or later.
Prerequisites
Before you begin, make sure that you have:
Activated the DLF service in the DLF console
Compatibility
DLF is compatible with the following compute engines in EMR:
| Engine | Supported versions |
|---|---|
| Hive | 2.x, 3.x |
| Presto | — |
| Spark SQL | — |
Change the metastore type
Go to the Hive service page.
Log on to the EMR console.
In the top navigation bar, select the region where your cluster resides and select a resource group.
On the EMR on ECS page, find your cluster and click Services in the Actions column.
On the Services tab, find the Hive service and click Configure.
On the Configure tab, enter
hive.imetastoreclient.factory.classin the search box and click the
icon. Set the parameter value based on your target metastore type:Metastore type Parameter value Built-in MySQL, unified metadatabase, or ApsaraDB RDS for MySQL org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClientFactoryDLF unified metadata storage com.aliyun.datalake.metastore.hive2.DlfMetaStoreClientFactorySave the configuration.
In the lower-left corner of the Configure tab, click Save.
In the Save dialog box, set the Execution Reason parameter and click Save.
Restart the Hive service.
In the upper-right corner of the Hive service page, choose More > Restart.
In the Restart HIVE Services dialog box, set the Execution Reason parameter and click OK.
In the Confirm dialog box, click OK.
To track progress, click Operation History in the upper-right corner.