TencentDB Service for Transmission (DTS) provides data migration and continuous data replication from self-built MySQL databases to TencentDB, allowing users to migrate hot data without interrupting their services. Data migration is supported for local IDCs with public IP/Port or access to Tencent Cloud via direct connection, or MySQL databases in Tencent Cloud CVMs. MySQL 5.7 does not support DTS, and you can import your data by downloading cold backup files.
Create a migration account in the source MySQL database (this is not required if you already have an authorized account for data migration);
GRANT ALL PRIVILEGES ON *. * TO "migration account" @ "%" IDENTIFIED BY "migration password";
FLUSH PRIVILEGES;
Confirm source database MySQL variables
Use SHOW GLOBAL VARIABLES LIKE 'XXX'
;
Check MySQL global variables to confirm whether migration can be performed under the current status:
server_id > 1
log_bin = ON;
binlog_format = ROW/MIXED
binlog_row_image = FULL
innodb_stats_on_metadata = 0
It is recommended that wait_timeout is higher than or equal to 3,600 seconds, and it must be lower than 7,200 seconds.
The same time length is configured for interactive_timeout and wait_timeout.
If the source instance is slave, confirm the following parameters in the source instance:
log_slave_updates = 1
Change variable value:
a. Change the source database MySQL configuration file my.cnf
, and restart:
log-bin=[custom binlog file name]
b. Modify configuration dynamically:
set global server_id = 99;
set global binlog_format=ROW;
set global binlog_row_image=FULL;
set global innodb_stats_on_metadata = 0;
Log into the console, go to the Data Migration page and click New Task.
On the page you are redirected to, complete task configuration, source database configuration, and destination database configuration. Details:
Required information:
Required information:
Select the database to migrate (you can choose to migrate the entire database or only certain tables), create migration task and check task information.
Notes:
- The character_set_server and lower_case_table_names configuration items are migrated only when the whole instance is migrated.
- If the character set configuration of migrated tables for the source instance is different from that of the destination instance, the character set configuration of the source instance is retained.
Data migration: Export data in the selected database and import it into TencentDB for MySQL.
Incremental synchronization: After performing data export and import, configure TencentDB for MySQL as the slave database for source database to achieve incremental synchronization between master and slave.
Overwrite root account: Since the root account is used for security verification for cloud databases, subsequent TencentDB operations will be affected if no root account exists in the source database. Therefore, if the entire instance is migrated, you should specify whether to overwrite the destination database root account with the source database root account. Choose Yes if you want to use the root account of the source database or if no root account is configured for the destination database. Choose No if you want to retain the root account for the destination database.
Select a data test type. (Choose from whole test, partial test, or no test.)
Note:
The test ratio fields are required for certain test items.
After a migration task is created, verify the task information. Click Next Step: Verification Task to verify it. You cannot start the task until all the verification items pass. Click Start to complete the process.
There are 3 statuses for task verification:
Once the verification passes, you can click Start Migration to start the migration right away. Note that if you have set a specified time for a migration task, the task will be queued and executed at the specified time. Otherwise, it will be executed immediately.
When the migration is started, you can see the corresponding migration progress information under the migration task. Required migration steps and the current stage will be displayed if you move your cursor over the exclamation mark following the steps.
Note:
Due to system design limitations, multiple migration tasks submitted or queued at the same time will be performed serially based on the queuing time.
When creating a migration task, the incremental synchronization option is selected by default. When data migration is completed, the target TencentDB for MySQL will be set as the slave database for the source database, and new data of the source database during migration will be synchronized to the destination TencentDB for MySQL via master/slave synchronization. In this case, any changes made to the source database will be synchronized to the destination TencentDB for MySQL.
After migration, click the Finish button to terminate the synchronization relationship between source and destination databases, then switch the service to the destination the TencentDB for MySQL instance to complete migration.
Note:
Before terminating synchronization, do not write data into the destination database instance as this may cause data inconsistency between the source and destination databases, which will cause data comparison to fail, resulting in a failed migration.
To cancel an in-progress migration task, click the Cancel button.
The following displays upon cancellation:
Notes:
- Clicking the Cancel button does not clear any data synchronized to the destination instance.
- Restarting the task may cause the verification or task to fail. You may need to manually clear all conflicting databases or tables in the destination database to start the migration task again.
- When migrating a single table, make sure that tables relied on by foreign keys of all tables are migrated.
When the migration is 100% complete, click the Finish button on the right to complete the migration.
The following displays after you click Finish:
Note:
While the migration is in a status of Unfinished, the migration task will continue, so will data synchronization.
Was this page helpful?