Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Distributed Database Middleware/ Best Practices/ Migrating an Entire RDS Database to DDM

Migrating an Entire RDS Database to DDM

Updated on 2022-12-07 GMT+08:00

Scenario

This section describes how to migrate an entire RDS instance (the old RDS instance) to an unsharded schema of a DDM instance to split read and write requests in DDM.

NOTE:
  • 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.
  • If a large amount of data is involved, contact DDM technical engineers by submitting a service ticket or through after-sales services. Fully rehearse the migration before migrating data.

Preparations before Migration

  • Prepare an ECS that can access the old RDS instance, the target DDM instance, and the RDS instance associated with the target DDM instance.
    1. Ensure that the old RDS instance, the target DDM instance, and the RDS instance associated with the target DDM instance are in the same VPC for network connectivity.
    2. Configure the same security group for the above-mentioned instances. If they belong to different security groups, enable the required ports.
    3. Install an official MySQL client on the ECS. Version 5.6 or 5.7 is recommended.
      • Red Hat Enterprise Linux: yum install mysql mysql-devel
      • Debian Linux: apt install mysql-client-5.7 mysql-client-core-5.7
    1. 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 instance, and configure the required DDM account and DDM schema for it.
  • If the target schema is sharded, create a logical table with the same structure as data tables in the old RDS instance on the DDM console.

Constraints

  • To ensure data integrity, stop services in the old RDS instance before data migration.
  • In this scenario, associating the old RDS instance with DDM does not mean data association. You need to export data from the old RDS instance and then import it into the DDM instance.
  • The version of the RDS instance associated with the target DDM instance must be consistent with the MySQL version of the old RDS instance.

Exporting Data from the Old RDS Instance

  1. Log in to the target ECS.
  2. Run the following command to export structure data. Set parameters in italics to actual values. For details about the parameters, see Table 1.

    mysqldump -h {DB_ADDRESS} -P {DB_PORT} -u {DB_USER} -p --skip-lock-tables --add-locks=false --set-gtid-purged=OFF --no-data {DB_NAME} > {mysql_schema.sql}
    Table 1 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 name 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

  3. Run the following command to export data of the entire database. Set the parameters in italics. For details, see Table 1.

    mysqldump -h {DB_ADDRESS} -P {DB_PORT} -u {DB_USER} -p --hex-blob --complete-insert --skip-lock-tables --skip-tz-utc --skip-add-locks --set-gtid-purged=OFF --no-create-info {DB_NAME} > {mysql_data.sql}

  4. Run the following command on the ECS to view the SQL files exported in 2 and 3.

    ls -l

Importing Data into DDM

  1. Run the following command on the ECS to import the structure file into DDM:

    mysql -f -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p {DB_NAME} < {mysql_schema.sql}
    Enter password: **********
    Table 2 Parameter description

    Parameter

    Description

    Remarks

    DDM_ADDRESS

    Connection address of the DDM instance into which data is to be imported

    View the floating IP address and port number on the Basic Information tab on the DDM console.

    DDM_PORT

    Listening port of the DDM instance into which data is to 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 into which data is to be imported

    N/A

    mysql_schema.sql

    Name of the structure file to be imported

    Name of the file exported in 2

    mysql_data.sql

    Name of the entire DB data file to be imported

    Name of the file exported in 3

  2. Run the following command on the ECS to import the data file into DDM:

    mysql -f -h {DDM_ADDRESS} -P {DDM_PORT} -u {DDM_USER} -p {DB_NAME} < {mysql_data.sql}
    Enter password: **********

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback