DTS provides data migration and continuous data replication from self-created MySQL databases to TencentDB, allowing you to migrate hot data without interrupting your business. MySQL with public IP/port, Direct Connect-based MySQL in local IDC, and CVM-based self-created MySQL can be migrated. Currently, DTS is supported for MySQL 5.7.
lower_case_table_nameis specified for migration, a migration verification task will be performed to check whether the source and target databases have the same configuration; and if not, an error will be displayed, helping you prevent any restart issues caused by
lower_case_table_name), and their values are different from those in the target database, you need to configure restart of the target database.
SUPER privilege for the source database is not required in most scenarios and required only in the following scenarios:
DEFINERfor this event, an error will occur if the SUPER privilege is unavailable.
GRANT ALL PRIVILEGES ON *.* TO "migration account"@"%" IDENTIFIED BY "migration password"; FLUSH PRIVILEGES;
SHOW GLOBAL VARIABLES LIKE 'XXX';to view the global MySQL variables so as to check whether the database in the current state is suitable for migration:
server_id > 1 log_bin = ON; binlog_format = ROW/MIXED binlog_row_image = FULL innodb_stats_on_metadata = 0 You are recommended to set `wait_timeout` to above or equal to 3,600 seconds and mandatorily below 7,200 seconds. Set `interactive_timeout` and `wait_timeout` to the same value. If the source database is replica, confirm the following parameters in it: log_slave_updates = 1
my.cnfand restart the database:
b. Modify the configuration dynamically:
log-bin=[custom binlog filename]
set global server_id = 99; set global binlog_format=ROW; set global binlog_row_image=FULL; set global innodb_stats_on_metadata = 0;
Log in to the DTS Console, enter the data migration page, and click Create Migration Task.
Configure the task, source database, and target database. After the network connectivity test is successful, click Create.
Source Database Type: MySQL with public IP, CVM-based self-created MySQL, Direct Connect-based MySQL, and VPN-based MySQL are supported.
|Source Database Type||Description|
|MySQL with public IP||It refers to a MySQL database that can be accessed through a public IP. The following information is required:
|CVM-based self-created MySQL||You can migrate a MySQL database deployed on a CVM instance in the classic network or VPC by specifying the CVM instance ID. The following information is required:
|Direct Connect-based MySQL||After connecting a self-created MySQL database in your local IDC to Tencent Cloud through Direct Connect, you can use DTS to migrate data to Tencent Cloud. The following information is required:
|VPN-based MySQL||After connecting a self-created MySQL database in your local IDC to Tencent Cloud through VPN Connections or a CVM-based self-created VPN service, you can use DTS to migrate data to Tencent Cloud. The following information is required:
Select the target database instance and enter its account and password.
Select the database to be migrated (you can choose to migrate the entire database or only certain tables), create a migration task, and check the task information.
lower_case_table_namesconfiguration items will be migrated only if the entire database is migrated.
- If the character set configuration of the migrated tables in the source database is different from that of the target database, the former will be retained.
Data Migration: export data from the selected database and import it into TencentDB for MySQL.
Incremental Sync: after exporting and importing data, set TencentDB for MySQL as the replica of the source database to implement incremental source/replica sync.
Overwrite Target Database with Source Database Root Account: as the root account is used for TencentDB authentication, subsequent TencentDB operations will be affected if the root account of the source database does not exist in the target database. Therefore, if the entire database is migrated, you should specify whether to overwrite the target root account with the source one. Select Yes if you want to use the root account of the source database or if the root account is not configured for the target database. Select No if you want to retain the root account of the target database.
Read-only Target Database: if this configuration item is selected, during data migration, data from the source database will be read-only in the target database and cannot be changed until you click the corresponding button to complete the migration.
Select a data consistency detection type as needed (e.g., full detection, sampling detection, or no detection).
The detection ratio fields are required if sampling detection is selected.
After the migration task is created, you need to click Next step: verify task to verify the task information. You cannot start the migration task until all the check items are passed. Then, click Start Task.
There are 3 statuses for task verification:
After the verification is passed, you can click Immediate start in the migration task list to start data migration. Please note that if you have configured scheduled execution, the migration task will begin queuing and be executed at the specified time; otherwise, it will be executed immediately.
After the migration is started, you can view the corresponding migration progress under the migration task. The subsequent steps required for migration and the current stage will be displayed if you hover over the exclamation mark after the current step.
Due to system design limitations, multiple migration tasks committed or queued at the same time will be performed in sequence by queuing time.
When a migration task is created, the incremental sync option is selected by default. When data migration is completed, the target database will be set as the replica of the source database, and new data in the source database during migration will be synced to the target database through source/replica sync. In this way, any modification of the source database will be synced to the target database.
Before closing the sync, do not write data into the target database; otherwise, data comparison may fail due to inconsistency between the source and target databases, resulting in migration failure.
- Data that has been synced to the target database will not be cleared if you click Cancel.
- Restarting the task may cause the verification or task to fail. You may have to manually clear all databases or tables that may cause conflicts in the target database before you can start the migration task again.
- When migrating a single table, make sure that all tables depended on by its foreign keys are also migrated.
To cancel an ongoing migration task, click Cancel.
If the migration is in "not completed" status, the migration task will continue, so will data sync.
After the migration progress is 100%, the data lag between target and source databases is 0 MB, and the time lag between them is 0 seconds, you can click Complete on the right to complete the migration task.