As organizations adopt multi-cloud strategies, application databases are increasingly being moved between cloud providers. One common scenario is migrating an existing Amazon RDS for MySQL environment to Alibaba Cloud ApsaraDB RDS for MySQL.
At first glance, this may appear to be a straightforward database export and import. However, production database migration involves much more than moving tables and data. Organizations need to consider MySQL compatibility, database size, replication, application connectivity, security, downtime requirements, performance, and rollback planning.
The good news is that because both Amazon RDS for MySQL and ApsaraDB RDS for MySQL are based on MySQL, this is generally a homogeneous database migration. That makes the migration considerably simpler than moving between completely different database engines.
This article explains the major migration approaches and provides a practical migration strategy for moving Amazon RDS for MySQL workloads to Alibaba Cloud ApsaraDB RDS for MySQL.
1. Understanding the Migration
The source and target architecture can be represented as:
AWS CLOUD
+-----------------------+
| Amazon RDS for MySQL |
| |
| Production Database |
+-----------+-----------+
|
|
Data Migration
|
v
+-----------------------+
| Alibaba Cloud |
| ApsaraDB RDS MySQL |
| |
| Target Database |
+-----------+-----------+
|
v
Application
The migration strategy depends primarily on:
Database size
Business criticality
Acceptable downtime
Network connectivity
MySQL version compatibility
Application architecture
Data change rate
Recovery requirements
There is no single migration method that is appropriate for every environment.
2. Homogeneous Migration
The first and most common approach is homogeneous migration.
In this scenario:
Amazon RDS for MySQL
|
| MySQL
v
ApsaraDB RDS for MySQL
Both systems use MySQL, so most database objects—including tables, indexes, data types, and SQL statements—are compatible.
This is significantly simpler than a heterogeneous migration such as:
Oracle
|
v
MySQL
where schema conversion and application changes may be required.
Typical migration methods
Several approaches can be used:
Alibaba Cloud Data Transmission Service (DTS)
mysqldump/mysqlLogical backup and restore
Replication-based migration
Third-party migration tools
For smaller environments, dump and restore can be perfectly adequate.
For production environments where downtime needs to be minimized, continuous synchronization is generally more appropriate.
The referenced C# Corner article similarly identifies MySQL-to-MySQL migration as a homogeneous migration and highlights DTS for full migration and real-time synchronization.
3. Offline Migration
The simplest migration model is an offline migration.
The basic process is:
1. Stop Application
|
v
2. Stop Database Writes
|
v
3. Export RDS Database
|
v
4. Transfer Backup
|
v
5. Import into ApsaraDB
|
v
6. Validate Data
|
v
7. Change Application Connection
|
v
8. Start Application
A typical logical backup might use:
mysqldump \
--single-transaction \
--routines \
--triggers \
--events \
database_name > database_name.sql
The dump can then be restored to the target ApsaraDB RDS instance.
When should offline migration be used?
Offline migration is suitable when:
The database is relatively small
Downtime is acceptable
The workload is non-production
The migration can be performed during a maintenance window
The application can tolerate an extended outage
Simplicity is more important than minimizing downtime
For example, development, testing, staging, or smaller internal applications may be good candidates.
Advantages
Simple architecture
Easy to understand
Easy to troubleshoot
No continuous replication requirement
Suitable for smaller databases
Disadvantages
Requires application downtime
Migration duration increases with database size
Long-running imports can extend the outage
Not ideal for business-critical production systems
4. Online Migration With Minimal Downtime
For production systems, an online migration is usually the preferred approach.
Instead of stopping the source database for the entire migration, the source remains available while the target is populated.
The migration process looks like this:
Amazon RDS
|
|
Full Migration
|
v
ApsaraDB RDS
|
|
Incremental Sync
|
v
Target Catches Up
|
v
Final Cutover
|
v
Application
The process can be divided into two stages:
Stage 1 – Full Data Migration
The existing data is copied from Amazon RDS to ApsaraDB.
Stage 2 – Incremental Synchronization
New changes occurring on the source are continuously synchronized to the target.
This allows the source application to continue operating while the migration is taking place.
Alibaba Cloud DTS supports migration and synchronization capabilities designed for this type of scenario, including full data migration followed by incremental synchronization.
5. Using Alibaba Cloud DTS
For production migration, Alibaba Cloud Data Transmission Service (DTS) can be considered as the migration mechanism.
The high-level architecture is:
+-------------------------+
| Amazon RDS for MySQL |
| |
| Production Workload |
+------------+------------+
|
| Full Load
| +
| Incremental Changes
v
+-------------------------+
| Alibaba Cloud DTS |
+------------+------------+
|
v
+-------------------------+
| ApsaraDB RDS for MySQL |
| |
| Target Environment |
+-------------------------+
The important advantage is that the migration does not have to wait until the application is stopped before transferring the entire database.
Instead, the target database can be prepared in advance and kept synchronized with the source.
6. Migration Preparation
Before starting the migration, perform a detailed assessment of the Amazon RDS environment.
Collect:
MySQL version
Database size
Table count
Largest tables
Storage utilization
CPU utilization
Memory utilization
IOPS
Network throughput
Connection count
Slow queries
Stored procedures
Functions
Triggers
Events
Views
Users and privileges
Character sets
Collations
SQL modes
Check the MySQL version:
SELECT VERSION();
Check the server character set and collation:
SELECT
@@character_set_server,
@@collation_server;
Check SQL mode:
SELECT @@sql_mode;
Database size can be reviewed with:
SELECT
table_schema AS database_name,
ROUND(
SUM(data_length + index_length) / 1024 / 1024,
2
) AS size_mb
FROM information_schema.tables
GROUP BY table_schema
ORDER BY size_mb DESC;
This information should be used to size the ApsaraDB target appropriately.
7. MySQL Compatibility Assessment
Although this is a homogeneous migration, compatibility should not be assumed.
Compare:
Source Target
MySQL Version <----> MySQL Version
Character Set <----> Character Set
Collation <----> Collation
SQL Mode <----> SQL Mode
Authentication <----> Authentication
Storage Engine <----> Storage Engine
Time Zone <----> Time Zone
Particular attention should be given to:
MySQL major versions
Authentication plugins
Reserved keywords
SQL modes
Character sets
Collations
Stored procedures
Triggers
Events
Generated columns
JSON functionality
Partitioned tables
Join the conversation! Your thoughts help the community grow.