MySQL同步到MySQL修改库名,canal-adapter如何配置dbMapping

nkoocmlb  于 5个月前  发布在  Mysql
关注(0)|答案(1)|浏览(84)

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: *
mi7gmzs6

mi7gmzs61#

建议用mirror模式,数据库也同名

相关问题