Hive to MaxCompute data warehouse migration
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
You have created an instance. The recommended specifications are 8 cores and 16 GB of memory. The recommended operating system is Alibaba Cloud Linux or CentOS 7.9. Before you install the agent, you must enable the PrivateLink service.
You have created a bucket. The account used for the migration must have write permissions for OSS.
You have created a MaxCompute project. The account used for the migration must have the following permissions:
Access permissions for OSS. For more information, see Configure and use permissions for MaxCompute foreign tables.
All permissions on projects, tables, instances, and jobs in the MaxCompute project. Assign the developer role (Role_Project_Dev) to the migration account. For more information about permissions, see MaxCompute permissions.
You have created a workspace and used a Serverless resource group. You must also attach the workspace to the resource group and establish a network connection to the source Hadoop cluster. For more information, see Network connectivity solutions.
The data to be migrated is ready. Before you migrate data, stop write operations on the source tables and partitions to prevent data validation failures after the migration.
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
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.
In the navigation pane on the left, choose Migration Preparation > Resource Group and Service Agent Management.
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.
In the navigation pane on the left, choose Migration Preparation > Resource Group and Service Agent Management.
On the Service Agent tab, click Request License. A license is automatically generated to prevent misuse of the service agent.
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
In the navigation pane on the left, choose Migration Preparation > Data Source Management.
On the Lakehouse Storage and Metadata Management tab, click Create Data Source.
Configure the Hive data source. Set Data Source Type to
Hive. For more information, see Hive data source.Configure the HDFS data source. Set Data Source Type to
HDFS. For more information, see HDFS data source.Configure the OSS data source. Set Data Source Type to
OSS. For more information, see OSS data source.Configure the MaxCompute data source. Set Data Source Type to
MaxCompute. For more information, see MaxCompute data source.
Step 4: Add a migration group
In the navigation pane on the left, choose Lakehouse Data Migration > Data Migration.
On the Hive->MaxCompute tab, click Add Migration Group.
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:
|
Step 5: Create and run a migration task
On the Hive->MaxCompute tab, click Create Migration Task.
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. |
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:
|
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
vto 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.

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.

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.