View a markdown version of this page

Data Catalog Migration - Amazon EMR Migration Guide

Data Catalog Migration

Apache Hive is an open source data warehouse and analytics package that runs on an Apache Hadoop cluster and is one of the applications that can run on Amazon EMR. A Hive metastore contains a description of the table and the underlying data, including partition names and data types. There are three modes for Hive metastore deployment: embedded metastore, local metastore, and remote metastore. When migrating an on-premises Hadoop cluster to EMR, your strategy depends on how the Hive metastore is deployed. This chapter covers the patterns used to deploy a Hive metastore and how to migrate an existing metastore to EMR.

Choosing a catalog strategy for your migration

Your on-premises Hive metastore was the central schema registry. On AWS you have multiple options with different trade-offs.

Catalog strategies by migration scenario
Migration scenario Recommended catalog Rationale
Standard migration (most customers) AWS Glue Data Catalog Default recommendation. Serverless, no infrastructure, supports Hive-compatible tables and Apache Iceberg natively; integrates with Lake Formation for fine-grained access control, cross-account sharing, and multi-engine access (EMR, Athena, Redshift).
New Iceberg tables on S3 Tables S3 Tables built-in catalog plus AWS Glue Data Catalog federation S3 Tables includes its own Iceberg catalog; register tables in the AWS Glue Data Catalog through federation for unified discovery across engines.
Hybrid migration (on-premises and cloud running in parallel) External Hive metastore on Amazon RDS or Amazon Aurora Maintains schema compatibility with on-premises Hive during coexistence; use AWS Database Migration Service for ongoing sync; migrate to the AWS Glue Data Catalog after cutover is complete.
Organization uses Databricks alongside AWS AWS Glue Data Catalog plus Databricks Unity Catalog federation Use the AWS Glue Data Catalog as the primary catalog; federate Databricks Unity Catalog tables through the Iceberg REST endpoint.
Strict Hive 2.x or 3.x compatibility required External Hive metastore on Amazon RDS or Amazon Aurora Some legacy Hive features (materialized views, certain UDFs) require the native Hive metastore schema; use Amazon RDS or Amazon Aurora until workloads are refactored.

Migration principle — For most migrations, target the AWS Glue Data Catalog as the long-term catalog. It is serverless, supports Hive-compatible and Iceberg formats, and is the foundation for Lake Formation governance. If you need an external Hive metastore during transition, plan to migrate from Amazon RDS to the AWS Glue Data Catalog once parallel running ends.

Modern Glue Data Catalog capabilities (migration-relevant)

Since this guide was first published, the AWS Glue Data Catalog has added capabilities that change the migration landscape.

  • Apache Iceberg table management — Natively registers, manages, and exposes Iceberg tables through a standards-compliant Iceberg REST catalog endpoint (EMR 7.5 and later), replacing a separate Iceberg catalog service. For more information, see Using Iceberg tables with the AWS Glue Data Catalog.

  • Lake Formation fine-grained access control — Table, column, row, and cell-level permissions managed centrally, replacing Apache Ranger or Sentry policies. For more information, see AWS Lake Formation.

  • Cross-account catalog sharing — Share databases and tables across accounts without copying data. For more information, see Lake Formation cross-account access.

  • Catalog federation — Access tables from external catalogs (Databricks Unity Catalog, Snowflake, Apache Polaris) through the AWS Glue Data Catalog without migrating metadata. For more information, see Federated catalog access.

  • SageMaker Lakehouse integration — Iceberg tables in the AWS Glue Data Catalog are automatically accessible through SageMaker Lakehouse, providing unified query access from EMR, Athena, Redshift, and SageMaker notebooks with consistent governance. For more information, see SageMaker Lakehouse.

What this means for your migration — On-premises you likely managed a single Hive metastore with Apache Ranger for access control and no built-in cross-team sharing. Migrating to the AWS Glue Data Catalog with Lake Formation provides centralized governance, multi-engine access, and cross-account sharing, capabilities that required complex custom solutions on-premises.

Hive metastore deployment patterns

Apache Hive ships with the Derby database, an embedded database backed by local disk. Derby is used for embedded metastores but is not recommended because it cannot scale for production.

In EMR, by default Hive records metastore information in a MySQL database on the primary node's file system. When a cluster terminates, all nodes shut down, including the primary, and local data is lost because the file systems use ephemeral storage. To avoid this, create an external Hive metastore outside the cluster. You have two options for an EMR external metastore:

  • AWS Glue Data Catalog (recommended)

  • Amazon RDS database or Amazon Aurora database

For an FAQ on these options, see Appendix E: Data Catalog Migration FAQs.

AWS Glue Data Catalog

The AWS Glue Data Catalog provides a unified metadata repository across data sources and formats, integrating with EMR, Amazon RDS, Amazon Redshift, Redshift Spectrum, Amazon Athena, and any application compatible with the Apache Hive metastore. With the AWS Glue Data Catalog, you don't manage a separate Hive metastore database instance, maintain replication, or scale the instance. It is fully managed, serverless, highly available, and fault-tolerant, maintains replicas, and scales with usage.

Diagram showing AWS Glue Data Catalog used as the Hive metastore for Amazon EMR.

Figure 13: Using AWS Glue Data Catalog as the Hive metastore

When creating a new EMR cluster, you can choose the AWS Glue Data Catalog as the Hive metastore (EMR 5.8.0 or later). Provide the following hive-site classification.

[ { "Classification": "hive-site", "Properties": { "hive.metastore.client.factory.class": "com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory" } } ]

To configure the AWS Glue Data Catalog as the Hive metastore, enable the AWS Glue Data Catalog setting in the EMR console during cluster creation, or set hive.metastore.client.factory.class to com.amazonaws.glue.catalog.metastore.AWSGlueDataCatalogHiveClientFactory in the hive-site configuration. For step-by-step instructions, see Using the AWS Glue Data Catalog as the metastore for Hive in the Amazon EMR Release Guide.

Consider the following when you use the AWS Glue Data Catalog as the Hive metastore.

  • You can enable encryption on an AWS Glue Data Catalog. We recommend AWS managed keys. If you must use customer managed KMS keys, enable Delegate KMS operations to an IAM role. For more information, see Setting Up Encryption in AWS Glue.

  • Hive authorizations and Hive constraints are not currently supported. For a list of incompatibilities, see Using the AWS Glue Data Catalog as the Metastore for Hive.

  • An AWS Glue Data Catalog has versions, so a table can have multiple schema versions.

Amazon RDS or Amazon Aurora

There are two main steps to deploy an external Hive metastore on Amazon RDS or Amazon Aurora:

  1. Create an Amazon RDS (MySQL) or Amazon Aurora database.

  2. Configure the hive-site.xml file to point to the MySQL or Aurora database.

Diagram of a Hive metastore hosted on Amazon RDS or Amazon Aurora.

Figure 14: Creating Hive metastore on Amazon RDS or Amazon Aurora

To configure the external metastore, create a MySQL or PostgreSQL database, configure the hive-site settings to point to the external metastore JDBC URL, and ensure the EMR cluster's security group allows connectivity. For step-by-step instructions, including schema initialization and configurations with multiple primary nodes, see Configuring an External Metastore for Hive in the Amazon EMR Release Guide.

Consider the following when you use Amazon RDS or Amazon Aurora as the Hive metastore.

  • A Hive metastore is a single point of failure. Amazon RDS doesn't automatically replicate databases, so enable replication to avoid failure. To learn how to create a database replica in a different Availability Zone, see How do I create a read replica for an Amazon RDS database? and Working with Read Replicas.

Hive metastore migration options

Depending on the plan and requirements, you can migrate a metastore two ways: a one-time migration that migrates an existing Hive metastore completely to AWS, or an ongoing migration that migrates the Hive metastore but keeps a copy on-premises, with the two metastores synced in real time during the migration phase.

One-time metastore migration

A one-time metastore migration is for organizations that plan to use the Hive metastore on AWS.

Diagram of a one-time Hive metastore migration to AWS.

Figure 15: One-time metastore migration

Existing Hive Metastore to AWS Glue Data Catalog

Use an AWS Glue ETL job to extract metadata from your Hive metastore and AWS Glue jobs to load the metadata and update the AWS Glue Data Catalog. For more information, see Migration between the Hive Metastore and the AWS Glue Data Catalog on GitHub.

Existing Hive Metastore to Amazon RDS

Move the Hive metastore data from an on-premises database to Amazon RDS. The steps depend on the current database:

  • MySQL on-premises to MySQL on Amazon RDS or Amazon Aurora

  • PostgreSQL on-premises to PostgreSQL on Amazon RDS or Amazon Aurora

  • Oracle on-premises to Oracle on Amazon RDS

For more information, see the following resources:

  • Migrate On-Premises MySQL Data to Amazon RDS

  • Importing Data into PostgreSQL on Amazon RDS

  • Migrating Data from a PostgreSQL DB Instance to an Aurora PostgreSQL DB Cluster

  • Migrating Data from a MySQL DB Instance to an Amazon Aurora MySQL DB Cluster

On-going metastore sync

An ongoing metastore sync is used mainly for large-scale migrations when you want to migrate an on-premises Hive metastore to AWS but also keep running the on-premises Hive metastore during the migration phase. On-going sync keeps both up-to-date. For a given time, only one application should update the Hive metastore, otherwise it goes out of sync.

Diagram of an ongoing Hive metastore synchronization process.

Figure 16: Ongoing metastore sync

AWS Database Migration Service can create ongoing replication. The blog post Replicating Amazon EC2 or On-Premises SQL Server to Amazon RDS for SQL Server discusses achieving ongoing replication for SQL Server, and the same method applies to other databases.