canal怎样实现多个rdb配置文件共用同一个instance

示例:

baidd-yingshe-ef里包含两个rdb key,每个rdb里是一个单独的表映射:

application.yml文件内容:

- instance: baidd-yingshe-ef # canal instance Name or mq topic name
    groups:
    - groupId: g1
      outerAdapters:
      - name: logger
      - name: rdb                                               # 指定为rdb类型同步
        key: baidd-yingshe-ee                                            # 指定adapter的唯一key, 与表映射配置中outerAdapterKey对应
        properties:
          jdbc.driverClassName: com.mysql.jdbc.Driver        # jdbc驱动名, 部分jdbc的jar包需要自行放致lib目录下
          jdbc.url: jdbc:mysql://192.168.1.107:3306/baiddtarget?useUnicode=true        # jdbc url
          jdbc.username: baidd                                 # jdbc username
          jdbc.password: 123456                                # jdbc password
               

      - name: logger
      - name: rdb                                               # 指定为rdb类型同步
        key: baidd-yingshe-ff                                            # 指定adapter的唯一key, 与表映射配置中outerAdapterKey对应
        properties:
          jdbc.driverClassName: com.mysql.jdbc.Driver        # jdbc驱动名, 部分jdbc的jar包需要自行放致lib目录下
          jdbc.url: jdbc:mysql://192.168.1.107:3306/baiddtarget?useUnicode=true        # jdbc url
          jdbc.username: baidd                                 # jdbc username
          jdbc.password: 123456                                # jdbc password
          

--rdb配置文件内容:

[root@master rdb]# cat baidd-yingshe-ee.yml 
dataSourceKey: defaultDS
destination: baidd-yingshe-ef
groupId: g1
outerAdapterKey: baidd-yingshe-ee
concurrent: true
dbMapping:
  database: baiddsource 
  table: ee 
  targetTable: baiddtarget.ee
  targetPk:
    id: id
  mapAll: true
 

[root@master rdb]# cat baidd-yingshe-ff.yml 
dataSourceKey: defaultDS
destination: baidd-yingshe-ef
groupId: g1
outerAdapterKey: baidd-yingshe-ff
concurrent: true
dbMapping:
  database: baiddsource 
  table: ff 
  targetTable: baiddtarget.ff
  targetPk:
    id: id
  mapAll: true

--本篇文章转自:https://www.cnblogs.com/tcarry/p/13668579.html

猜你喜欢

转载自blog.csdn.net/yabignshi/article/details/113472041