This topic describes how to migrate the data of a self-managed MySQL instance to an ApsaraDB RDS for MySQL instance that runs the same MySQL version as the self-managed MySQL instance. You can perform a full backup on the self-managed MySQL instance, upload the full backup file to an Object Storage Service (OSS) bucket, import the full backup file from the OSS bucket into a temporary RDS instance, and then restore the data from the full backup file to the destination RDS instance.
Prerequisites
- You have an Alibaba Cloud account.
- The self-managed MySQL instance runs one of the following MySQL versions:
- MySQL 5.7.32 or earlier
- MySQL 8.0.18 or earlier
- An OSS bucket is created in the region where the destination RDS instance resides.
For more information, see Create buckets.
Note The OSS bucket that you create must reside in the same region as the destination RDS instance.
Migration process
The migration process consists of the following steps:
Step 1: Install Percona XtraBackup
Step 2: Install MySQL Backup Helper
Step 3: Back up the self-managed MySQL instance and migrate the backup data to the cloud
Environment
In this topic, the self-managed MySQL instance is deployed on an Elastic Compute Service (ECS) instance. The image that is used to create the self-managed MySQL instance runs CentOS Linux V8.3.2011. For more information, see Create an instance by using the wizard.
Limits
Item | Limit |
---|---|
MySQL version | The self-managed MySQL instance must run one of the following MySQL versions:
Note The self-managed MySQL instance must run the same MySQL version as the destination
RDS instance. For example, the backup data of a self-managed MySQL instance that runs
MySQL 5.7 can be restored only to an RDS instance that runs MySQL 5.7.
|
Self-managed MySQL instance |
|
Backup |
|
OSS |
|
Restoration |
|
Replication |
|
Billing
Step 1: Install Percona XtraBackup
Percona XtraBackup is developed by Percona to help you back up MySQL databases without impacting uptime. Percona XtraBackup is compatible with various storage engines. If you are using an Ubuntu operating system, see the "Appendix 1: Install Percona XtraBackup in an Ubuntu operating system" section of this topic.
Step 2: Install MySQL Backup Helper
Prerequisites
- The Go programming language is installed. If Go is not installed, run the following
command in the CLI to install Go:
yum install -y go
- The UnZip utility is installed. If UnZip is not installed, run the following command
in the CLI to install UnZip:
yum install -y unzip
Step 3: Back up the self-managed MySQL instance and migrate the backup data to the cloud
Appendix 1: Install Percona XtraBackup in an Ubuntu operating system
The following packages have unmet dependencies
" is displayed when you perform any of the preceding steps, run the apt-get -f install
command to install the required dependency packages. Then, perform the step again.
Appendix 2: Install Go and UnZip in an Ubuntu operating system
- Install the Go programming language.
sudo apt-get install -y software-properties-common sudo add-apt-repository ppa:longsleep/golang-backports sudo apt-get update sudo apt-get install -y golang-go
- Install the UnZip utility.
sudo apt-get -y install unzip