- What's New
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
User Guide
- Function Overview
- Kernel Version Notes
- Permissions Management
-
Instance Management
- Instance Statuses
- Buying a DDM instance
- Splitting Read-only and Read-Write Services
- Changing Node Class
- Scaling Out a DDM Instance
- Scaling In a DDM Instance
- Restarting a DDM Instance or an Instance Node
- Deleting Pay-per-Use Instances
- Reloading Table Data
- Changing a Parameter Template
- Modifying Parameters of a DDM Instance
- Rolling Back the Version of a DDM Instance
- Upgrading the Version of a DDM Instance
- Upgrading the DDM Engine and OS
- Connection Management
- Schema Management
- Shard Configuration
- Data Nodes
-
Parameter Template Management
- Instance Parameters
- Creating a Parameter Template
- Modifying a Custom Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Account Management
- Backups and Restorations
-
Data Migration
- Overview
- Migration Evaluation
- Scenario 1: Migrating Data from an On-Premises MySQL Instance to DDM
- Scenario 2: Migrating Data from a Third-Party Cloud MySQL Instance to DDM
- Scenario 3: Migrating Data from an ECS-hosted MySQL Instance on Huawei Cloud to DDM
- Scenario 4: Exporting Data from a DDM Instance
- Scenario 5: Migrating Data from Heterogeneous Databases to DDM
- Scenario 6: Migrating Data from Huawei Cloud RDS for MySQL to DDM
- Session Management
- Slow Queries
- Monitoring and Alarm Reporting
- Task Center
- Tags
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Online DDL
- Functions
- Unsupported Objects and Use Constraints
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
- Quotas
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
APIs (Recommended)
-
DDM Instances
- Buying a DDM instance
- Querying DDM Instances
- Querying Details of a DDM Instance
- Modifying the Name of a DDM Instance
- Changing the Security Group of a DDM Instance
- Deleting a DDM Instance
- Restarting a DDM Instance
- Reloading Table Data
- Scaling Out a DDM Instance
- Scaling in a DDM instance
- Modifying the Read Policy of the Associated DB Instance
- Synchronizing Data Node Information
- Querying Nodes of a DDM Instance
- Querying Details of a DDM Instance Node
- Querying Parameters of a Specified DDM Instance
- Modifying Parameters of a DDM Instance
- Querying DDM Engine Information
- Querying DDM Node Classes Available in an AZ
- Changing the Node Class of a DDM Instance
- Obtaining the Instance Group Information
- Creating an Instance Group
- Schemas
- Accounts
- Monitoring
- Session Management
- Application Examples
-
DDM Instances
- Permissions Policies and Supported Actions
- Appendix
- SDK Reference
-
Best Practices
- Overview
- Formulating Sharding Rules
- Determining the Number of Shards in a Schema
- Using Broadcast and Unsharded Tables
- Transaction Models
- SQL Standards
- Migrating an Entire RDS Database to DDM
- Migrating an Entire MyCat Database to DDM
- Accessing DDM Using a JDBC Connection Pool
- Logging In to a DDM Instance Using Navicat
- Migrating Data from RDS for MySQL to DDM Using DRS
- Sharding Database and Table Data of an RDS for MySQL Instance
- Performance White Paper
-
FAQs
- General Questions
-
DDM Usage
- How Does DDM Perform Sharding?
- What Do I Do If I Fail to Connect to a DDM Instance Using the JDBC Driver?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- What Do I Do If a Duplicate Primary Key Error Occurs When Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned When I Specify an Auto-Increment Primary Key During Migration?
- What Do I Do If an Error Is Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, a Schema or its Associated RDS Instances?
- Can I Manually Delete Databases and Accounts Remained in Data Nodes After a Schema Is Deleted?
- SQL Syntax
-
RDS-related Questions
- Is the Name of a Database Table Case-Sensitive?
- What Risky Operations on RDS for MySQL Will Affect DDM?
- How Do I Handle Data with Duplicate Primary Keys in a Table?
- How Can I Query RDS for MySQL Information by Running Command show full innodb status?
- What Should I Pay Attention to When Selecting RDS for MySQL Instance Specifications?
- Connection Management
- Resource Freezing, Release, Deletion, and Unsubscription
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
- Function Overview
- Instance Management
-
Parameter Template Management
- Creating a Parameter Template
- Editing a Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Task Center
- Schema Management
- Account Management
- Backup Management
- Monitoring Management
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Functions
- Unsupported Items
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
-
FAQs
- General Questions
-
DDM Usage
- How Can I Rectify a Fault in Accessing DDM by Using the JDBC Driver?
- What Version and Parameters Should I Select?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- How Should I Handle the Duplicate Primary Key Error Occurring After Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned After I Specify an Auto-Increment Primary Key?
- How Do I Handle the Error Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, Schema or Associated RDS DB Instances?
- Should I Manually Delete Databases and Accounts Remained in the Associated RDS DB Instances After a Schema Is Deleted?
- SQL Syntax
- RDS-related Questions
- Connection Management
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Getting Started
- Function Overview
- Instance Management
-
Parameter Template Management
- Creating a Parameter Template
- Editing a Parameter Template
- Comparing Two Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying the Description of a Parameter Template
- Deleting a Parameter Template
- Task Center
- Schema Management
- Account Management
- Backup Management
- Monitoring Management
- Auditing
-
SQL Syntax
- Introduction
- DDL
- DML
- Functions
- Unsupported Items
- Supported SQL Statements
- Global Sequence
- Database Management Syntax
- Advanced SQL Functions
-
FAQs
- General Questions
-
DDM Usage
- How Can I Rectify a Fault in Accessing DDM by Using the JDBC Driver?
- What Version and Parameters Should I Select?
- Why It Takes So Long Time to Export Data from MySQL Using mysqldump?
- How Should I Handle the Duplicate Primary Key Error Occurring After Data Is Imported into DDM?
- What Should I Do If an Error Message Is Returned After I Specify an Auto-Increment Primary Key?
- How Do I Handle the Error Reported When Parameter Configuration Does Not Time Out?
- Which Should I Delete First, Schema or Associated RDS DB Instances?
- Should I Manually Delete Databases and Accounts Remained in the Associated RDS DB Instances After a Schema Is Deleted?
- SQL Syntax
- RDS-related Questions
- Connection Management
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
-
DDM Instance Management
- Querying DDM Engine
- Querying the Quota of Classes Available in Each AZ
- Creating a DDM Instance
- Querying DDM Instances
- Viewing Details of a DDM Instance
- Modifying the Name of a DDM Instance
- Modifying the Security Group of a DDM Instance
- Deleting a DDM Instance
- Restarting a DDM Instance
- Reloading Table Data
- Scaling Out a DDM instance
- Scaling In a DDM instance
- Modifying the Read Policy of the Associated DB Instance
- Synchronizing DB Instance Data
- Querying Nodes of a DDM Instance
- Querying Details of a DDM Instance Node
- Querying Parameters of a Specified DDM Instance
- Modifying Parameters of a DDM Instance
- Schema Management
- Account Management
- Monitoring Management
- Permissions Policies and Supported Actions
- Appendix
- Change History
-
User Guide (ME-Abu Dhabi Region)
- General Reference
- Scenario
- Preparations for Migration
- Migration Scheme
- Constraints
- Exporting Table Structure Data from the MyCat Database
- Exporting Data from the Entire MyCat Database
- Importing Data from Unsharded Tables into the Target DDM Instance
- Importing Data from Sharded or Broadcast Tables into the Target DDM Instance
Show all
Copied.
Migrating an Entire MyCat Database to DDM
Scenario
This section describes how to migrate an entire MyCat database to DDM.
- Services may be interrupted during migration. The duration of the interruption depends on the amount of data to be migrated and on network conditions.
- Data migration is complicated and is recommended during off-peak hours. This guide is for reference only. The actual migration scheme you should use depends on your specific service scenarios, the amount of data to be migrated, and how much downtime can be tolerated.
- You can only access DDM through an ECS. Therefore, you must export databases as files to the ECS, and then import data in the files into DDM from the ECS.
Preparations for Migration
- Prepare an ECS that can access the MyCat database, the target DDM instance, and the RDS DB instance associated with the target DDM instance.
- Ensure that the MyCat database, the target DDM instance, and the associated RDS DB instance are in the same VPC for stable network connectivity.
- Configure the same security group for the ECS where the MyCat database is deployed, the target DDM instance, and the associated RDS DB instance. If they belong to different security groups, configure their security group rules to allow them to access each other.
- Install an official MySQL client on the ECS. Version 5.6 or 5.7 is recommended.
- Red Hat Linux: yum install mysql mysql-devel
- Debian Linux: apt install mysql-client-5.7 mysql-client-core-5.7
- Ensure that there is enough disk space and memory on the ECS to store and compare dump files.
- Prepare a DDM instance that has been associated with an RDS DB instance, and configure DDM accounts and schemas for it as required.
- Use MyCat 1.6 as an example in this section.
Migration Scheme
Table types in MyCat and DDM are different from each other and migration schemes vary by table type, as described in Table 1.
MyCat Table Type |
DDM Table Type |
Migration Scheme |
---|---|---|
Unsharded |
Unsharded |
|
Sharded: hash sharding (including by date) |
Sharded: hash sharding (including by date function) |
|
Sharded: range sharding (including by date) |
Sharded: range sharding (including by date function) |
|
Broadcast |
Broadcast |
Constraints
- MyCat services need to be stopped before data migration to ensure data integrity.
- Associating the MyCat database with a DDM instance for data association is not supported. You must export data from the MyCat database and then import the data into the DDM instance.
- The version of the associated RDS DB instance associated must be consistent with that of the MyCat database.
Exporting Table Structure Data from the MyCat Database
- Log in to the target ECS.
- Run the following command to export table structure data in the MyCat database. Configure the parameters in italics. For details about the parameters, see Table 2.
mysqldump -h {DB_ADDRESS} -P {DB_PORT} -u {DB_USER} -p --skip-lock-tables --add-locks=false --set-gtid-purged=OFF --no-data --order-by-primary {DB_NAME} > {mysql_schema.sql} Enter password: **********
Table 2 Parameter description Parameter
Description
Remarks
DB_ADDRESS
Connection address of the database whose data is to be exported
Mandatory
DB_PORT
Listening port of the database
Mandatory
DB_USER
Database user
Mandatory
DB_NAME
Database name
Mandatory
mysql_schema.sql
Name of the table structure file
The file varies depending on the table whose structure is exported.
You are advised to name the file in the format of schema name_schema to prevent data from being overwritten, for example, mysql_schema.sql.
mysql_data.sql
Name of the database data file
N/A
Exporting Data from the Entire MyCat Database
- Log in to the ECS.
- Run the following command to export data of the MyCat database. Configure the parameters in italics. For details about the parameters, see Table 2.
mysqldump -h {DB_ADDRESS} -P {DB_PORT} -u {DB_USER} -p --hex-blob --complete-insert --skip-lock-tables --add-locks=false --set-gtid-purged=OFF --quick --no-create-info --order-by-primary {DB_NAME} > {mysql_data.sql} Enter password: **********
- Run the following command on the ECS to view the exported SQL file.
ls -l
Importing Data from Unsharded Tables into the Target DDM Instance
On the ECS, use a MySQL client to connect to the associated RDS DB instance. Run the following commands to import the table structure and database files.
mysql -f -h {RDS_ADDRESS} -P {RDS_PORT} -u {RDS_USER} -p {DB_NAME} < {mysql_table_schema.sql} Enter password: ********** mysql -f -h {RDS_ADDRESS} -P {RDS_PORT} -u {RDS_USER} -p {DB_NAME} < {mysq_table_data.sql} Enter password: **********
- RDS_ADDRESS indicates the address of an RDS DB instance into which data is to be imported.
- RDS_PORT indicates the port number of an RDS DB instance.
- RDS_USER indicates the username of an RDS DB instance.
- DB_NAME indicates the name of an RDS database. If data of unsharded tables is to be imported, DB_NAME indicates the name of the first shard of RDS.
- mysql_table_schema.sql indicates the name of a table structure file to be imported.
- mysq_table_data.sql indicates the name of a table data file to be imported.
Importing Data from Sharded or Broadcast Tables into the Target DDM Instance
mysql -f -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p {DB_NAME} < {mysql_data.sql} Enter password: **********
Parameter |
Description |
Remarks |
---|---|---|
DDM_ADDRESS |
Connection address of the DDM instance into which data is to be imported |
View the connection address and port number on the Basic Information tab on the DDM console. |
DDM_PORT |
Listening port of the DDM instance into which the data will be imported |
|
DDM_USER |
User accessing the DDM instance |
Account for creating a schema. The account must have both read and write permissions. |
DB_NAME |
Name of the schema that the data will be imported into |
N/A |
mysql_data.sql |
Name of the entire database file to be imported |
Name of the file exported in 2 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot