__tencentdb__
in the source database to record the data comparison information during the sync task.__tencentdb__
system database in the source database will not be deleted after the sync task ends.__tencentdb__
system database uses a single-threaded connection wait mechanism and occupies a very small space, about 0.01%–0.1% of the storage space of the source database; for example, if the source database is 50 GB, __tencentdb__
will be about 5–50 MB. Therefore, it has almost no impact on the performance of the source database and will not preempt resources.GRANT RELOAD,LOCK TABLES,REPLICATION CLIENT,REPLICATION SLAVE,SHOW VIEW,PROCESS,SELECT ON *.* TO 'account'@'%' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON `__tencentdb__`.* TO 'account'@'%';FLUSH PRIVILEGES;
user1
corresponding to DEFINER
([DEFINER = user1]
) in the source database is the same as the sync account user2
, and if not, DTS will change the SQL SECURITY
attribute of user1
in the target database from DEFINER
to INVOKER
([INVOKER = user1]
) after the sync, and set the DEFINER
in the target database to the sync account user2
([DEFINER = sync account user2]
). If the view definition in the source database is too complex, the task may fail.STATEMENT
format, sync will fail.ALTER VIEW
statement is not supported and will be skipped during sync.STATEMENT
format into the source database.__tencentdb__
during incremental sync.Operation Type | SQL Statement |
DML | INSERT, UPDATE, DELETE |
DDL | CREATE DATABASE, DROP DATABASE, ALTER DATABASE, CREATE TABLE, ALTER TABLE, DROP TABLE, TRUNCATE TABLE, RENAME TABLE, CREATE VIEW, DROP VIEW, CREATE INDEX, DROP INDEX |
Type | Environment Requirements |
Requirements for the source database | The source and target databases can be connected. Requirements for instance parameters: The server_id parameter in the source database must be set manually and cannot be 0.row_format for the source databases/tables cannot be set to FIXED .The values of the lower_case_table_names variable in both the source and target databases must be the same.The connect_timeout variable in the source database must be greater than or equal to 10.Requirements for binlog parameters: The log_bin variable in the source database must be set to ON .The binlog_format variable in the source database must be set to ROW .The binlog_row_image variable in the source database must be set to FULL .On MySQL 5.6 or later, if the gtid_mode variable is not ON , an alarm will be triggered. We recommend you enable gtid_mode .It is not allowed to set do_db and ignore_db .If the source instance is a replica database, the log_slave_updates variable must be set to ON .We recommend that you retain the binlog of the source database for at least three days; otherwise, the task cannot be resumed from the checkpoint and will fail. Foreign key dependency: Foreign key dependency can be set to only one of the following two types: NO ACTION and RESTRICT .During partial table sync, all tables with foreign key dependency must be migrated. The environment variable innodb_stats_on_metadata must be set to OFF . |
Requirements for the target database | The target database version must be later than or equal to the source database version. The target database must have sufficient storage space. If you select Full data initialization as the initialization type, the target database space must be at least 1.2 times the space of databases/tables to be synced in the source database. The target database cannot have sync objects such as tables and views with the same name as those in the source database. The max_allowed_packet parameter of the target database must be set to 4 MB or above. |
Parameter | Description |
Billing Mode | Monthly subscription and pay-as-you-go billing are supported. |
Source Instance Type | Select MySQL, which cannot be changed after purchase. |
Source Instance Region | Select the source database region, which cannot be changed after purchase. |
Target Instance Type | Select MySQL, which cannot be changed after purchase. |
Target Instance Region | Select the target database region, which cannot be changed after purchase. |
Specification | Select a specification based on your business needs. The higher the specification, the higher the performance. For more information, see Billing Overview. |
Setting Items | Parameter | Description |
Task Configuration | Task Name | DTS will automatically generate a task name, which is customizable. |
| Running Mode | Immediate execution and scheduled execution are supported. |
Source Instance Settings | Source Instance Type | The source database type selected during purchase, which cannot be changed. |
| Source Instance Region | The source database region selected during purchase, which cannot be changed. |
| Service Provider | For a self-built database (such as a CVM-based one) or TencentDB database, select Others. For a third-party cloud database, select the corresponding service provider. In this scenario, select Others. |
| Access Type | Select Database. |
| Cross-/Intra-Account | In this scenario, select Intra-account. |
| Instance ID | Source database instance ID. |
| Account | Account of the source database, which must have the required permissions. |
| Password | Password of the source database account. |
Target Instance Settings | Target Instance Type | The target database type selected during purchase, which cannot be changed. |
| Target Instance Region | The target database region selected during purchase, which cannot be changed. |
| Access Type | For a self-built or third-party cloud database, you can select Public Network generally or select VPN Access, Direct Connect, or CCN based on your actual network conditions. For the preparations for different access types, see Preparations Overview. |
| Host Address | IP address or domain name of the target database. |
| Port | Target database port. |
| Account | Account of the target database, which must have the required permissions. |
| Password | Password of the target database account. |
Setting Items | Parameter | Description |
Data Initialization Option | Initialization Type | Structure initialization: Table structures in the source instance will be initialized into the target instance before the sync task runs. Full data initialization: Data in the source instance will be initialized into the target instance before the sync task runs. If you select Full data initialization, you need to create the table structure in the target database in advance. Both options are selected by default, and you can deselect them as needed. |
| If Target Already Exists | Precheck and report error: If a table with the same name exists in both the source and target databases, an error will be reported, and the task will stop. Ignore and execute: Full and incremental data will be directly added to tables in the target instance. |
Data Sync Option | Conflict Resolution Method | Report: If a primary key conflict of tables is found during data sync, the system will report an error and pause the data sync task. Ignore: If a primary key conflict is found during data sync, the system will keep the primary key record in the target database. Overwrite: If a primary key conflict is found during data sync, the system will use the primary key record in the source database to overwrite that in the target database. |
| SQL Type | Supported operations include INSERT, UPDATE, DELETE, and DDL. If you select Custom DDL, you can select different DDL statement sync policies as needed. For more information, see Setting SQL Filter Policy. |
Sync Object Option | Database and Table Objects of Source Instance | Select the objects to be synced. You can select basic databases, tables, views, procedures, and functions. The sync of advanced objects is a one-time operation: only advanced objects already in the source database before the task start can be synced, while those added to the source database after the task start will not be synced to the target database. For more information, see Syncing Advanced Object. |
| Selected Object | Database/table mapping (renaming) is supported. Hover over a database or table name, click the displayed Edit icon, and enter a new name in the pop-up window. We recommend that you do not rename tables when syncing advanced objects; otherwise, the sync may fail. Sync of online DDL temp tables (by using gh-ost, pt-online-schema-change tools) is supported. Click the edit button next to the table, and select the temp table name in the pop-up window. For more information, see Syncing Online DDL Temp Table. |
Was this page helpful?