This document shows how to integrate data from a self-managed MySQL database into a specified bucket in Alibaba Cloud Object Storage Service (OSS).
Prerequisites
Your MySQL database must have public network access or be connected to Alibaba Cloud through a VPC.
NoteTo connect your MySQL database to Alibaba Cloud through a VPC, see VPC connection and Multi-cloud connection (AWS, Azure).
Add the CIDR blocks of the DTS and DMS servers to the security settings of your database, such as security group rules, firewalls, and allowlists. For more information, see Add the CIDR blocks of DTS servers to an allowlist and Add DMS IP address ranges.
Usage notes
This feature is in public preview. During the public preview, no SLA is provided.
This feature is available only in the China (Hangzhou), China (Shanghai), and China (Beijing) regions.
A data integration task supports only one table.
Use the same Alibaba Cloud account (root account) to create the bucket, purchase the AnalyticDB for MySQL 3.0 cluster, create the RAM user, and log on to DMS.
Preparations
Create an OSS bucket
-
Log on to the OSS console.
-
In the left-side navigation pane, click Buckets, then click Create Bucket.
-
Configure the bucket parameters:
-
Bucket Name: Enter a name for the bucket.
-
Region: Select the Singapore region.
-
ACL: Select Private.
-
Configure other parameters based on your requirements.
For more information, see Create a bucket.
-
-
Click OK.
-
Create a directory in the bucket:
-
In the left-side navigation pane, click Buckets. Find and click the bucket you created.
-
In the left-side navigation tree, choose Object Management > Objects.
-
On the Objects page, click Create Directory.
-
In the Create Directory panel, enter a value for Directory Name. > Note: For directory naming requirements, see Manage directories.
-
Click OK.
-
Create a RAM user and grant permissions
-
On the Users page, click Create User and configure the following:
-
Logon Name: Enter a logon name, for example,
dts_testuser. -
Access Mode: Select Using permanent AccessKey to access.
-
-
Click OK. Record the AccessKey ID and AccessKey secret.
-
Grant permissions to the RAM user:
-
On the Users page, find the RAM user and click Add Permissions in the Actions column.
-
Select the policies you need:
Policy
Description
AliyunDTSFullAccess
Permissions to manage DTS
AliyunOSSFullAccess
Permissions to manage OSS
AliyunKMSReadOnlyAccess
(Optional) Read-only permission on KMS
AliyunKMSSecretUserAccess
(Optional) Permission to obtain secrets from KMS
AliyunKMSCryptoUserAccess
(Optional) Permission to use KMS keys for cryptographic operations
NoteInstead of AliyunOSSFullAccess, you can grant AliyunOSSReadOnlyAccess and then configure fine-grained access on the Bucket Policy tab in the OSS console. Set Applied To to Whole Bucket, Authorized User to RAM User, and Authorized Operation to Full Access or Read/Write. See Bucket policies.
-
Click Grant permissions, then click Close.
-
(Optional) Purchase and configure a KMS instance
Complete this section only if you want to encrypt the integrated data with Key Management Service (KMS).
Purchase a KMS instance
-
Log on to the KMS console and select the Singapore region.
-
In the left-side navigation pane, choose Resource > Instances.
-
On the Instances page, click Create Instance and configure the following:
-
Key Management Type: Select Software Key Management.
-
Region: Select the Singapore region.
-
Configure other parameters based on your requirements. See Purchase and enable a KMS instance.
-
-
Click Buy Now and complete the purchase.
Enable the KMS instance
-
Return to the Instances page.
-
On the Software Key Management tab, find the instance you purchased.
-
Click Enable in the Actions column and complete the configuration. See Enable the KMS instance.
-
Wait until the instance status changes to enabled.
Create a customer master key (CMK)
-
In the left-side navigation pane, choose Resource > Keys.
-
Click the Keys tab. On the right side of Create Key, set Instance ID to the KMS instance you created.
-
Click Create Key and configure the following:
-
KMS Instance: Select the KMS instance you purchased.
-
Key Type: Select Symmetric Key.
-
Key Specifications: Select Aliyun_AES_256.
-
Configure other parameters based on your requirements. See Create a CMK.
-
-
Click OK.
Create a generic secret
-
In the left-side navigation pane, choose Resource > Secrets.
-
Click the Generic Secrets tab. On the right side of Create Secret, set Instance ID to the KMS instance you created.
-
Click Create Secret and configure the following:
-
Secret Value: Select Plain Text and enter a secret value in the Plain Text field. > Note: Run
openssl rand 32 | base64in an environment with OpenSSL installed to generate a random secret value. -
CMK: Select the key you created in the previous step.
-
Configure other parameters based on your requirements. See Manage and use generic secrets.
-
-
Click OK.
Create an application access policy
-
In the left-side navigation pane, choose Application Access > AAPs.
-
Click the Policy tab, then click Create Policy.
-
Configure the following:
-
Scope: Select the KMS instance you created.
-
RBAC Permissions: Select all available options.
-
Accessible Resources: Select the CMK and generic secret you created.
-
Configure other parameters based on your requirements. See Create an AAP.
-
-
Click OK.
(Optional) Purchase and configure an AnalyticDB MySQL 3.0 cluster
Complete this section only if you want to store OSS metadata in an AnalyticDB MySQL 3.0 cluster.
-
Purchase an AnalyticDB MySQL 3.0 cluster. See Create a cluster.
-
Create a privileged account. See Create a database account.
-
Create a resource group for the cluster. Set Task Type to Interactive and Engine to Spark — this lets you query the integrated data after the task runs. See Create a resource group.
Procedure
Step 1: Add MySQL instance
Log in to DMS 5.0.
In the left-side navigation pane, click the add icon next to Database Instances.
Alternatively, choose Data Assets > Instances in the top navigation bar. On the Instance List tab, click New.
On the Add Instance page, click the Third-party/Self-managed tab.
NoteTo add an RDS for MySQL instance to DMS, see Add a cloud database instance.
Under Relational Database, click MySQL, and then configure the instance parameters.
Category
Parameter
Description
Basic information
Database type
Select MySQL.
Instance source
Select Public Network.
NoteIf your MySQL database is connected to Alibaba Cloud through a VPC, you can select VPC and configure the related parameters based on your requirements.
Instance region
Select the region where the MySQL database is located.
Endpoint
Enter the public endpoint of the MySQL database.
Port
Enter the service port of the MySQL database.
Control mode
Select Security Collaboration.
Database account
This account must have SELECT permissions on the data to be integrated.
Database password
Enter the password for the database account.
NoteYou can configure other parameters as needed. For more information, see Add a third-party or self-managed database instance.
At the bottom of the page, click Submit.
Step 2: Register the OSS instance
-
Log on to the DMS console V5.0.
-
Click the
icon next to Database Instances in the left-side navigation pane.Alternatively, choose Data Assets > Instances in the top navigation bar. On the Instance List tab, click New.
-
In the Add Instance dialog box, click the Alibaba Cloud tab.
-
In the File and Log section, select OSS and configure the following parameters:
Configure other parameters based on your requirements. See Register an Alibaba Cloud database instance.
Parameter Description File and Log Storage Select OSS Instance Region Select the region of the OSS bucket you created Connection Method Select Connection String Address Connection String Address DMS automatically populates this field based on the selected region. For example, if you set the Instance Region parameter to China (Hangzhou), the Connection String Address parameter is automatically set to oss-cn-hangzhou.aliyuncs.com Bucket (Optional) Select the bucket you created AccessKey ID Enter the AccessKey ID of the RAM user you created AccessKey secret Enter the AccessKey secret of the RAM user you created -
Click Submit.
Step 3: Register the AnalyticDB MySQL 3.0 cluster (optional)
Complete this step only if you want to store OSS metadata in the AnalyticDB MySQL 3.0 cluster.
-
Log on to the DMS console V5.0.
-
Click the
icon next to Database Instances in the left-side navigation pane.Alternatively, choose Data Assets > Instances in the top navigation bar. On the Instance List tab, click New.
-
In the Add Instance dialog box, click the Alibaba Cloud tab.
-
In the Data Warehouse section, select AnalyticDB MySQL 3.0 and configure the following parameters:
Configure other parameters based on your requirements. See Register an Alibaba Cloud database instance.
Parameter Description Database Type Select AnalyticDB MySQL 3.0 Instance Region Select the region where the cluster resides Connection Method Select Instance ID Instance ID Select the ID of the AnalyticDB MySQL 3.0 cluster Database Account Enter the privileged account of the cluster Database Password Enter the password for the account -
Click Submit.
Step 4: Configure data integration task
Create a task flow
-
Log on to the DMS console V5.0.
-
In the top navigation bar, choose Data+AI > Data+AI > Task Orchestration.
In simple mode, hover over the
icon in the upper-left corner and choose All Features > Data+AI > Data Development > Task Orchestration. -
Click Create Task Flow. In the dialog box, set the Business Scenario and Task Flow Name, then click OK.
-
Configure the data integration task.
In the Task Type list on the left, drag the Data Lake Data Integration node from the Data Integration Nodes section onto the canvas.
Double-click the node on the canvas.
Configure the source and destination databases.
Category
Parameter
Description
Source Database
Database Type
Select MySQL.
Access Method
In this example, select Public IP Address.
Instance Region
Select the region where the DMS-managed MySQL instance is located.
DMS database instance
Select the DMS-managed MySQL instance.
Destination Database
Database Type
Fixed as OSS.
Access Method
Fixed as Alibaba Cloud Instance.
Instance Region
Select the region where the DMS-managed OSS instance is located.
DMS database instance
Select the DMS-managed OSS instance.
OSS bucket
Select the destination bucket that you created in the "Preparations" section.
-
Click Next Step: Configure Objects.
Configure the task objects.
Parameter
Description
Destination OSS Database Integration Format
Select Delta, Parquet, or Hudi based on your requirements.
NoteIf you select Hudi, you must right-click the table to be integrated in the Selected Objects list to configure the Primary key and Pre-merger key.
Destination OSS Database Path
Enter the directory that you created in the destination bucket in the "Preparations" section.
Storage location of destination OSS metadata.
Select where to store metadata (databases, tables, columns): DMS stores metadata in DMS; AnalyticDB MySQL 3.0 stores metadata in the cluster (select the registered cluster and enter the RAM User ID from the RAM User ID page of the cluster); None skips metadata storage.
Source Objects
In the Source Objects box, click the table that you want to integrate, and then click
to move it to the Selected Objects box.NoteYou can select only one table.
Selected Objects
By default, the data is stored in the
/<Destination OSS Database Path>/<Table Name>directory of the destination bucket. To change the subdirectory for data storage or set conditions to filter data, right-click the table in the Selected Objects box and configure the table information in the Edit Table dialog box. For more information, see Configuration reference.Click OK.
Click Next Step: Complete.
Run the task and verify results.
-
In the upper-left corner of the page, click Try Run.
-
Click the Execution Logs tab at the bottom of the canvas to monitor progress:
-
status SUCCEEDED — the task completed successfully.
-
status FAILED — the task failed. Review the error in the Execution Logs tab, correct the configuration, and run the task again.
-
-
Verify the output in OSS:

-
Log on to the OSS console.
-
In the left-side navigation pane, click Buckets. Search for and click the bucket you created.
-
Navigate to the
/<Destination OSS database path>/<Table name>directory to confirm the integrated data is present.
<Destination OSS database path>is the Destination OSS Database Path you configured, and<Table name>is the value of Table Name in the Edit Table dialog box. -
-
Configuration
Parameter | Description |
Table Name | This name defines the subdirectory in the destination bucket for data storage. |
Filter Conditions | This parameter is not configured in this example. For more information about how to configure filter conditions, see Set filter conditions. |
Column | This parameter is not configured in this example. You can set the field name for the corresponding column in the destination bucket in Destination Column Name, or clear the Sync All Columns checkbox and select the columns that you want to integrate. |
Partition Information | This parameter is not configured in this example. You can select one or more columns to use as partition keys in the destination bucket. |
Primary key | The primary key (record key) and pre-combine key for writing data to the destination bucket in Hudi format. Note
|
Pre-merger key |