Hive to MaxCompute data warehouse migration

Updated at:

This topic describes how to migrate Hive data tables to MaxCompute using Object Storage Service (OSS) as a staging area. The process involves HDFS storage replication and OSS foreign table loading to migrate Hive table schemas and historical data. You can also enable incremental migration to periodically discover and sync new Hive data to MaxCompute.

Scope

This feature is available only in the China (Hangzhou) region.

Prerequisites

Limits

  • The migration of the __HIVE_DEFAULT_PARTITION__ partition is not supported.

  • During the incremental migration phase, the synchronization of Data Definition Language (DDL) operations from the source, such as deleting tables, deleting partitions, or performing schema evolution, is not supported.

Billing details

Data migration incurs the following fees:

  • Data transfer fees: When you copy HDFS data to OSS, compute fees are incurred by the DataWorks resource group. To reduce costs, you can use a subscription resource group to run migration jobs. For more information, see Subscription resource group billing.

  • Staging storage costs: The migration task uses OSS for staging, which incurs storage fees. To reduce storage overhead, you can enable the "Automatically delete temporary OSS files after a single table or partition is migrated" feature.

  • Compute costs: Compute costs are mainly incurred in the following two scenarios:

    • When you load data from an OSS foreign table into MaxCompute, MaxCompute compute fees are incurred for running SQL jobs.

    • If you enable the "Validate migration results" feature, the system runs validation SQL on both the source Hive and the destination MaxCompute, which incurs additional compute costs.

    • To effectively control compute costs, you can purchase subscription MaxCompute compute resources for the migration job. For more information, see Compute fees (Subscription).

  • Network fees: Network fees depend on your connection method. If you use a leased line, leased line fees are incurred. If you transfer data over the public network, you are typically charged for outbound traffic from the source platform.

Procedure

Step 1: Bind a resource group

  1. Log on to the Cloud Migration Center, select the destination region in the upper-left corner, and click Go to Lakehouse Migration Center in the upper-right corner.

  2. In the navigation pane on the left, choose Migration Preparation > Resource Group and Service Agent Management.

  3. On the Resource Group tab, click Bind Resource Group and select a DataWorks Serverless resource group.

After the resource group is attached, you can view it on the Resource Group tab.

Step 2: Install a service agent

Before you can use the data migration module, you must install a service agent. The agent connects to the data source to perform operations such as ad hoc metadata queries and creating a metadata inventory.

  1. In the navigation pane on the left, choose Migration Preparation > Resource Group and Service Agent Management.

  2. On the Service Agent tab, click Request License. A license is automatically generated to prevent misuse of the service agent.

  3. Click Install Service Agent, enter a name for the service agent, and select a region and an ECS instance to automatically deploy and install the agent.

After the installation is complete, you can view the online status of the service agent in the service agent list.

Step 3: Create data sources

  1. In the navigation pane on the left, choose Migration Preparation > Data Source Management.

  2. On the Lakehouse Storage and Metadata Management tab, click Create Data Source.

  3. Configure the Hive data source. Set Data Source Type to Hive. For more information, see Hive data source.

  4. Configure the HDFS data source. Set Data Source Type to HDFS. For more information, see HDFS data source.

  5. Configure the OSS data source. Set Data Source Type to OSS. For more information, see OSS data source.

  6. Configure the MaxCompute data source. Set Data Source Type to MaxCompute. For more information, see MaxCompute data source.

Step 4: Add a migration group

  1. In the navigation pane on the left, choose Lakehouse Data Migration > Data Migration.

  2. On the Hive->MaxCompute tab, click Add Migration Group.

  3. Configure the migration group as prompted.

Parameter

Required

Description

Migration group name

Yes

The name of the migration group. It is used to centrally manage all related tasks for a specific migration scenario.

Source data source type

Yes

The type of the source system. Only Hive is supported.

Destination data source type

Yes

The type of the destination system. Only MaxCompute is supported.

Source data source

Yes

Select the specific source Hive instance from the list of registered data sources.

Destination data source

Yes

Select the specific destination MaxCompute instance from the list of registered data sources.

Migration method

Yes

Only Stage in OSS, then convert foreign table to internal table is supported.

Source storage data source

Yes

Supported types are HDFS, AWS S3, Azure BLOB, and Tencent COS.

Destination staging data source

Yes

Only OSS is supported.

Global parameters

No

You can configure two types of custom parameters:

  • Parameters that start with rclone. control the data replication from the source to OSS. Common parameters include parallel processing parameters (rclone.transfers and rclone.checkers) and bandwidth limit parameters (rclone.bwlimit). For more information about the parameters, see the rclone parameter list.

  • Parameters that start with odps. control the data loading from the OSS foreign table to MaxCompute. For more information about the parameters, see the Flag parameter list.

Step 5: Create and run a migration task

  1. On the Hive->MaxCompute tab, click Create Migration Task.

  2. Enter the basic information.

Parameter name

Required

Description

Migration task name

Yes

The name of the migration task.

Hive database

Yes

Specify the source Hive database.

MaxCompute Project

Yes

The destination MaxCompute project that receives the data.

Description

No

Enter notes or additional information about the migration task.

  1. Configure the migration task settings.

Parameter name

Required

Description

Migration type

Yes

The data migration mode. "Schema + Historical File Migration" migrates only the schema and historical data. "Schema + Historical + Incremental File Migration" adds support for migrating subsequent incremental data.

Data object selection

Yes

The rule pattern used to filter migration objects. Whitelist mode and blacklist mode are supported. For more information about the rules, see Configure blacklists and whitelists.

OSS staging directory

No

The OSS directory for staging data. By default, data is stored in the root directory of the bucket.

Subsequent data migration time

No

This parameter is required and takes effect only when you set Migration Type to "Schema + Historical + Incremental File Migration". It specifies the start time for incremental data synchronization.

Enable migration result validation (built-in count check)

Yes

If you enable this feature, a data volume (count) consistency check is automatically performed on the source and destination after the migration task is complete.

Automatically delete temporary OSS files after a single table or partition is migrated

Yes

Specifies whether to automatically delete temporary files in the staging OSS bucket after a single table or partition is successfully migrated. This helps save on staging storage costs.

Custom parameter settings

No

You can configure two types of custom parameters:

  • Parameters that start with rclone. control the data replication from the source to OSS. Common parameters include parallel processing parameters (rclone.transfers and rclone.checkers) and bandwidth limit parameters (rclone.bwlimit). For more information about the parameters, see the rclone parameter list.

  • Parameters that start with odps. control the data loading from the OSS foreign table to MaxCompute. For more information about the parameters, see the Flag parameter list.

  1. On the Migration Task List page, find the migration task that you created and click Run Migration in the Actions column.

Step 6: View migration task details

After the task is created, you can view its status on the Hive->MaxCompute tab. If a migration task fails, perform the following steps:

  • You can click the arrow v to the left of the migration task to expand the task execution details. Then, click Task Details in the Actions column to view the execution status of each table.

image.png

  • On the Migration Details page, you can filter the results by Table Name, Partition Name, Is Partitioned Table, Migration Status, and Validation Status. Click View in the Actions column for the target task to identify the specific cause of the failure.

image.png

  • You can rerun the task using one of the following methods:

    • Rerun all failed jobs: Return to the migration task list page and click Run Migration in the Actions column again.

    • Rerun specified tables or partitions in a batch: At the bottom of the migration details page, click Batch Rerun, select the target tables and partitions, and then click OK.

    • Rerun a single table or partition: On the migration details page, find the corresponding table or partition and click Rerun in the Actions column.

Note:

  • The data migration process includes three stages: schema migration, storage migration, and converting the foreign table into an internal table. When you rerun a task, the task resumes from the breakpoint of the stage that previously failed.