This topic describes how to migrate data from a self-managed MySQL database to a PolarDB for MySQL cluster by using Data Transmission Service (DTS).
Supported source databases
You can use DTS to migrate data from the following types of MySQL databases to a PolarDB for MySQL cluster. In this example, the source database is a self-managed MySQL database with a public IP address. You can also follow the procedure to configure data migration tasks for other types of MySQL databases.- ApsaraDB RDS for MySQL instances
- Self-managed databases:
- Self-managed database with a public IP address
- Self-managed database that is hosted on Elastic Compute Service (ECS)
- Self-managed database that is connected over Express Connect, VPN Gateway, or Smart Access Gateway
- Self-managed database that is connected over Database Gateway
Prerequisites
- The version of the self-managed MySQL database is 5.1, 5.5, 5.6, 5.7, or 8.0.
- If the source MySQL database is an on-premises database, the CIDR blocks of DTS servers must be added to the IP whitelist of the database. This setting ensures that DTS servers can access the source MySQL database. For more information, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
- The destination PolarDB for MySQL cluster is created. For more information, see Purchase a pay-as-you-go cluster and Purchase a subscription cluster.
- The available storage space of the PolarDB for MySQL cluster is larger than the total size of the data in the self-managed MySQL database.
Limits
Category | Description |
---|---|
Limits on the source database |
|
Other limits |
|
Special cases |
|
Migration types
- Schema migration
DTS migrates the schemas of required objects from the source database to the destination database.
Note- DTS supports schema migration for the following types of objects: table, view, trigger, stored procedure, and function.
- During schema migration, DTS changes the value of the SECURITY attribute from DEFINER to INVOKER for views, stored procedures, and functions.
- DTS does not migrate user information. To call a view, stored procedure, or function of the destination database, you must grant the read and write permissions to INVOKER.
- Full data migration
DTS migrates historical data of required objects from the source database to the destination database.
- Incremental data migration
After full data migration is completed, DTS migrates incremental data from the source database to the destination database. Incremental data migration ensures service continuity when you migrate data between self-managed databases.
SQL operations that can be migrated
Operation type | SQL statement |
---|---|
DML | INSERT, UPDATE, and DELETE |
DDL |
|
Permissions required for database accounts
Database | Schema migration | Full data migration | Incremental data migration |
---|---|---|---|
Self-managed MySQL database | The SELECT permission | The SELECT permission | The SELECT permission on the objects to migrate
The REPLICATION CLIENT, REPLICATION SLAVE, and SHOW VIEW permissions Permissions to create databases and tables. The permissions allow DTS to create a database named dts to record heartbeat data during migration. |
PolarDB for MySQL cluster | Read and write permissions |
For more information about how to create a database account and grant permissions to the account, see the following topics:
- Self-managed MySQL database: Create an account for a user-created MySQL database and configure binary logging
- PolarDB for MySQL clusters: Create a database account