canal
canal copied to clipboard
MySQL同步到MySQL修改库名,canal-adapter如何配置dbMapping
Question
canal版本
1.1.7
问题描述
- 想要增量同步test0718库的数据到改名的库test0723中,如何写dbMapping配置, 目前只要指定表名才能正常同步,配置如下:
concurrent: true
dataSourceKey: demoSyncDS
destination: test-1721045534
groupId: g1
outerAdapterKey: mysql0
dbMapping:
commitBatch: 3000
database: test0718
targetDb: test0723
table: t1
targetTable: t1
mapAll: true
targetPk:
id: id
- 尝试了以下好几种配置都不行,以下是错误配置
错误配置1:
concurrent: true
dataSourceKey: demoSyncDS
destination: test-1721045534
groupId: g1
outerAdapterKey: mysql0
dbMapping:
commitBatch: 3000
database: test0718
targetDb: test0723
错误配置2
concurrent: true
dataSourceKey: demoSyncDS
destination: test-1721045534
groupId: g1
outerAdapterKey: mysql0
dbMapping:
commitBatch: 3000
database: test0718
targetDb: test0723
table: *
targetTable: *
建议用mirror模式,数据库也同名
@xiaobai1017 多对1的场景、用途不一样经常是不同库名
目前是全库映射配置后,只能映射schema, 但数据同步不了