Does Data Migration (DM) support renaming databases during incremental and full synchronization from MySQL to TiDB?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: Data Migration (DM) 从mysql到tidb 增量+全量同步是否支持改库名

| username: love-cat

[TiDB Usage Environment] Production Environment
[TiDB Version] 5.2.2
[Reproduction Path]
Does Data Migration (DM) support renaming databases during incremental and full synchronization from MySQL to TiDB?
For example, there is a database named test_123 in MySQL, and in TiDB it is test_456.
[Encountered Problem: Problem Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: Billmay表妹 | Original post link

Yes, in the DM configuration file, you can use the source-schema parameter to specify the source database name and the target-schema parameter to specify the target database name. For example, you can set source-schema to test_123 and target-schema to test_456. This way, DM will synchronize the data from the source database to the target database during data synchronization.

| username: TiDB_C罗 | Original post link

Support,

| username: zhanggame1 | Original post link

Yes, renaming tables and databases is supported.

| username: TiDBer_小阿飞 | Original post link

Extracting Sharded Database and Table Source Information into a Merged Table

Assuming a sharded database and table scenario, you need to migrate tables test_{11,12,13...}.t_{1,2,3...} from two upstream MySQL instances into a single table test.t in the downstream TiDB. Additionally, you need to extract the source information of the sharded databases and tables into the merged table to identify the origin of each row of data.

To migrate to the downstream instance’s table test.t, you need to create table routing rules similar to the sharded database and table merging scenario and add configurations for extract-table, extract-schema, and extract-source to extract the source information of the sharded databases and tables:

  • extract-table: For sharded tables that match the schema-pattern and table-pattern, DM extracts the sharded table based on table-regexp and writes the suffix information (after removing t_) into the target-column of the merged table, i.e., the c_table column.
  • extract-schema: For sharded databases that match the schema-pattern and table-pattern, DM extracts the sharded database based on schema-regexp and writes the suffix information (after removing test_) into the target-column of the merged table, i.e., the c_schema column.
  • extract-source: For sharded tables that match the schema-pattern and table-pattern, DM writes their data source information into the target-column of the merged table, i.e., the c_source column.
| username: 大飞哥online | Original post link

Absolutely, the database name and table name can be migrated according to your configuration file, and the source and target can be different.

| username: 像风一样的男子 | Original post link

DM is more flexible and can be configured with target-schema: “test” and target-table: “t”.

| username: Fly-bird | Original post link

Support it, just set the synchronization policy.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.