开源数据库迁移工具canal

Posted Carlton Xu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了开源数据库迁移工具canal相关的知识,希望对你有一定的参考价值。

1. canal

1.1. 产品特性

canal是阿里巴巴旗下的一款开源项目,纯Java开发。基于数据库增量日志解析,提供增量数据订阅&消费,目前主要支持了mysql(也支持mariaDB)

是一款基于Mysql或者Mariadb关系型数据库的全量/增量数据实时复制的工具,实现原理canal伪装自己为mysql的slave节点,监听mysql的binlog日志来获取数据,binlog设置为row模式以后,不仅能获取到执行的每一个增删改的脚本,同时还是获取到修改前和修改后的数据,基于这个特性,canal就能高性能的获取到mysql数据的变更

1.1.1. 知识科普

1.1.1.1. mysql Binlog介绍

1.1.1.2. mysql主备复制实现

从上层来看,复制分成三步:
(1)master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,binary log events,可以通过show binlog events进行查看);
(2)slave将master的binary log events拷贝到它的中继日志(relay log);
(3)slave重做中继日志中的事件,将改变反映它自己的数据。

1.1.2. 工作原理

原理相对比较简单:
(1)canal模拟mysql slave的交互协议,伪装自己为mysql slave,向mysql master发送dump协议
(2)mysql master收到dump请求,开始推送binary log给slave(也就是canal)
(3)canal解析binary log对象(原始为byte流)

1.1.3. 部署使用

canal的部署主要分为server端和client端。
server端部署好以后,可以直接监听mysql binlog,因为server端是把自己模拟成了mysql slave,所以,只能接受数据,没有进行任何逻辑的处理,具体的逻辑处理,需要client端进行处理。
client端一般是需要大家进行简单的开发,下面有一个简单的示例,相对比较简单,可以试着去理解一下;
示例:https://github.com/alibaba/canal/wiki/ClientAPI

1.2. 支持场景

目前数据源主要支持Mysql(Mariadb),因为canal只作为服务端伪装为slave,接收并记录二进制binlog,其他数据转换可以依靠其他client工具完成,下面是canal官方编写的一个独立的组件Adapter,可以完成不同目标数据源的转换

1.2.1. 中间件数据源 - canal Adapter

为了便于大家的使用,官方做了一个独立的组件Adapter,Adapter是可以将canal server端获取的数据转换成几个常用的中间件数据源,现在支持kafka、rocketmq、hbase、elasticsearch,针对这几个中间件的支持,直接配置即可,无需开发。上文中,如果需要将mysql的数据同步到elasticsearch,直接运行 canal Adapter,修改相关的配置即可。

1.3. 迁移场景解决方案

1.3.1. 迁移测试场景

数据源与目标均为阿里云RDS数据库之间的数据迁移

1.3.1.1. 迁移程序安装环境

本次测试环境:CentOS7.5,2c4G,下载canal server端以及canal Adapter中间件数据源组件作为接收端,可以部署在同一台虚拟机

1.3.1.2. 待迁移源端数据库

  • 数据库基础设施信息
数据库类型数据源数据库版本资源大小部署方式
关系型数据库阿里云RDSMysql 5.62C-4G-50G单主库
  • 数据库信息
数据库名数据表名表数据备注
coredbseepcore_table220万大小预估在2GB
  • 表结构信息

1.3.1.3. 待同步目标端数据库

  • 数据库基础设施信息
数据库类型数据源数据库版本资源大小部署方式
关系型数据库阿里云RDSMysql 5.62C-4G-50G单主库
  • 数据库信息
数据库名数据表名表数据备注
coredbseepcore_table0新建立数据库,表为空,表结构与原表结构一致
  • 表结构信息

1.3.1.4. 场景模拟

源端阿里云RDS数据库建立1个数据库coredb,下面产生1个表seepcore_table,表里面存放220万条数据
使用canal服务获取源数据库表信息,通过canal-Adapter组件来消费并全量增量数据到目标数据库(单表 – 单表)复制

场景场景描述
场景一启动canal服务,查看可以自动同步源端数据库表数据到目标数据库
场景二在数据全量同步过程中,源端数据库seepcore_table表持续进行读、update、insert、delete操作,看是否可以完整进行数据同步并更新到目标数据库
场景三在数据库增量同步过程中,源端数据库seepcore_table表持续进行读、update、insert、delete操作、看是否可以实进行数据同步并更新到目标数据库

1.3.2. 安装部署

1.3.2.1. 提前条件

对于自建 MySQL , 需要先开启 Binlog 写入功能,配置 binlog-format 为 ROW 模式,my.cnf 中配置如下
(自建数据库需开启,本次测试不涉及)

[mysqld]
log-bin=mysql-bin # 开启 binlog
binlog-format=ROW # 选择 ROW 模式
server_id=1 # 配置 MySQL replaction 需要定义,不要和 canal 的 slaveId 重复
  • 授权 canal 链接 MySQL 账号具有作为 MySQL slave 的权限, 如果已有账户可直接 grant
CREATE USER canal IDENTIFIED BY 'canal'; 
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';
-- GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;
FLUSH PRIVILEGES;

这个第一步还是蛮简单的,就是要自己搭建一个mysql,修改一下mysql的配置,这个配置一般是再/etc/my.cnf中

注意⚠️ :如果数据源为阿里云RDS数据库实例,有关binlog的内容,需要注意以下几点,请查看官方链接:
https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart

1.3.2.2. 安装JDK环境

canal deployer依赖Java >= 1.5,我们安装java 1.8.0版本,直接使用CentOS7.5默认yum源安装即可

yum install -y java-1.8.0

1.3.2.3. 下载canal deployer安装包

目前canal官方release最新版本为canal 1.1.4版本,我们就使用最新release版本进行测试

  • canal deployer包下载 - canal 服务端
https://github.com/alibaba/canal/releases/download/canal-1.1.4/canal.deployer-1.1.4.tar.gz
  • 解压缩canal deployer - canal 服务端
mkdir canal-deployer
tar xf canal.deployer-1.1.4.tar.gz -C canal-deployer/

1.3.2.4. 下载canal adapter安装包

  • canal adapter包下载 - canal 客户端
https://github.com/alibaba/canal/releases/download/canal-1.1.4/canal.adapter-1.1.4.tar.gz
  • 解压缩canal adapter - canal 客户端
mkdir canal-adapter
tar xf canal.adapter-1.1.4.tar.gz -C canal-adapter/

1.3.3. 迁移使用

1.3.3.1. 目录结构

.
|-- bin # canal程序起停服务脚本目录
|   |-- restart.sh
|   |-- startup.bat
|   |-- startup.sh
|   `-- stop.sh
|-- conf # canal配置文件存放目录,我们主要修改此目录下的配置文件
|   |-- canal_local.properties
|   |-- canal.properties
|   |-- example
|   |   `-- instance.properties
|   |-- logback.xml
|   |-- metrics
|   |   `-- Canal_instances_tmpl.json
|   `-- spring
|       |-- base-instance.xml
|       |-- default-instance.xml
|       |-- file-instance.xml
|       |-- group-instance.xml
|       |-- memory-instance.xml
|       `-- tsdb
|           |-- h2-tsdb.xml
|           |-- mysql-tsdb.xml
|           |-- sql
|           |   `-- create_table.sql
|           `-- sql-map
|               |-- sqlmap-config.xml
|               |-- sqlmap_history.xml
|               `-- sqlmap_snapshot.xml
|-- lib # canal使用的java库文件存放目录
|   |-- aopalliance-1.0.jar
|   |-- aviator-2.2.1.jar
|   |-- canal.common-1.1.4.jar
|   |-- canal.deployer-1.1.4.jar
|   |-- canal.filter-1.1.4.jar
|   |-- canal.instance.core-1.1.4.jar
|   |-- canal.instance.manager-1.1.4.jar
|   |-- canal.instance.spring-1.1.4.jar
|   |-- canal.meta-1.1.4.jar
|   |-- canal.parse-1.1.4.jar
|   |-- canal.parse.dbsync-1.1.4.jar
|   |-- canal.parse.driver-1.1.4.jar
|   |-- canal.prometheus-1.1.4.jar
|   |-- canal.protocol-1.1.4.jar
|   |-- canal.server-1.1.4.jar
|   |-- canal.sink-1.1.4.jar
|   |-- canal.store-1.1.4.jar
|   |-- commons-beanutils-1.8.2.jar
|   |-- commons-cli-1.2.jar
|   |-- commons-codec-1.9.jar
|   |-- commons-compress-1.9.jar
|   |-- commons-io-2.4.jar
|   |-- commons-lang-2.6.jar
|   |-- commons-lang3-3.4.jar
|   |-- commons-logging-1.1.3.jar
|   |-- disruptor-3.4.2.jar
|   |-- druid-1.1.9.jar
|   |-- fastjson-1.2.58.jar
|   |-- fastsql-2.0.0_preview_973.jar
|   |-- guava-18.0.jar
|   |-- h2-1.4.196.jar
|   |-- httpclient-4.5.1.jar
|   |-- httpcore-4.4.3.jar
|   |-- ibatis-sqlmap-2.3.4.726.jar
|   |-- jackson-annotations-2.9.0.jar
|   |-- jackson-core-2.9.6.jar
|   |-- jackson-databind-2.9.6.jar
|   |-- javax.annotation-api-1.3.2.jar
|   |-- jcl-over-slf4j-1.7.12.jar
|   |-- jctools-core-2.1.2.jar
|   |-- jopt-simple-5.0.4.jar
|   |-- jsr305-3.0.2.jar
|   |-- kafka_2.11-1.1.1.jar
|   |-- kafka-clients-1.1.1.jar
|   |-- logback-classic-1.1.3.jar
|   |-- logback-core-1.1.3.jar
|   |-- lz4-java-1.4.1.jar
|   |-- metrics-core-2.2.0.jar
|   |-- mysql-connector-java-5.1.47.jar
|   |-- netty-3.2.2.Final.jar
|   |-- netty-all-4.1.6.Final.jar
|   |-- netty-tcnative-boringssl-static-1.1.33.Fork26.jar
|   |-- oro-2.0.8.jar
|   |-- protobuf-java-3.6.1.jar
|   |-- rocketmq-acl-4.5.2.jar
|   |-- rocketmq-client-4.5.2.jar
|   |-- rocketmq-common-4.5.2.jar
|   |-- rocketmq-logging-4.5.2.jar
|   |-- rocketmq-remoting-4.5.2.jar
|   |-- rocketmq-srvutil-4.5.2.jar
|   |-- scala-library-2.11.12.jar
|   |-- scala-logging_2.11-3.8.0.jar
|   |-- scala-reflect-2.11.12.jar
|   |-- simpleclient-0.4.0.jar
|   |-- simpleclient_common-0.4.0.jar
|   |-- simpleclient_hotspot-0.4.0.jar
|   |-- simpleclient_httpserver-0.4.0.jar
|   |-- simpleclient_pushgateway-0.4.0.jar
|   |-- slf4j-api-1.7.12.jar
|   |-- snakeyaml-1.19.jar
|   |-- snappy-java-1.1.7.1.jar
|   |-- spring-aop-3.2.18.RELEASE.jar
|   |-- spring-beans-3.2.18.RELEASE.jar
|   |-- spring-context-3.2.18.RELEASE.jar
|   |-- spring-core-3.2.18.RELEASE.jar
|   |-- spring-expression-3.2.18.RELEASE.jar
|   |-- spring-jdbc-3.2.18.RELEASE.jar
|   |-- spring-orm-3.2.18.RELEASE.jar
|   |-- spring-tx-3.2.18.RELEASE.jar
|   |-- zkclient-0.10.jar
|   `-- zookeeper-3.4.5.jar
`-- logs  # 程序启动日志输出都存在这个目录

1.3.3.2. 配置canal deployer服务端

修改canal deployer服务的配置文件,添加源端数据库连接信息 - 源端数据库

vim /root/canal-deployer/config/example/instance.properties
#################################################
## mysql serverId , v1.0.26+ will autoGen
# canal.instance.mysql.slaveId=0

# enable gtid use true/false
canal.instance.gtidon=false

# position info
canal.instance.master.address=rm-uf6xxpgxxhaxxo.mysql.rds.aliyuncs.com:3306 #填写源端数据库连接地址以及端口号,默认3306
canal.instance.master.journal.name=
canal.instance.master.position=
canal.instance.master.timestamp=
canal.instance.master.gtid=

# rds oss binlog
canal.instance.rds.accesskey=
canal.instance.rds.secretkey=
canal.instance.rds.instanceId=

# table meta tsdb info
canal.instance.tsdb.enable=true
#canal.instance.tsdb.url=jdbc:mysql://127.0.0.1:3306/canal_tsdb
#canal.instance.tsdb.dbUsername=canal
#canal.instance.tsdb.dbPassword=canal

#canal.instance.standby.address =
#canal.instance.standby.journal.name =
#canal.instance.standby.position =
#canal.instance.standby.timestamp =
#canal.instance.standby.gtid=

# username/password
canal.instance.dbUsername=xuxingzhuang # 填写源端数据库连接用户名
canal.instance.dbPassword=********   # 填写源端数据库连接用户密码
canal.instance.connectionCharset = UTF-8
# enable druid Decrypt database password
canal.instance.enableDruid=false
#canal.instance.pwdPublicKey=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALK4BUxdDltRRE5/zXpVEVPUgunvscYFtEip3pmLlhrWpacX7y7GCMo2/JM6LeHmiiNdH1FWgGCpUfircSwlWKUCAwEAAQ==

# table regex
canal.instance.filter.regex=.*\\\\..*
# table black regex
canal.instance.filter.black.regex=mysql..* #RDS Mysql限制用户访问mysql.slave_master_info表的权限,需要加入到黑名单才可以,其他自建数据库可以不配置
# table field filter(format: schema1.tableName1:field1/field2,schema2.tableName2:field1/field2)
#canal.instance.filter.field=test1.t_product:id/subject/keywords,test2.t_company:id/name/contact/ch
# table field black filter(format: schema1.tableName1:field1/field2,schema2.tableName2:field1/field2)
#canal.instance.filter.black.field=test1.t_product:subject/product_image,test2.t_company:id/name/contact/ch

# mq config
canal.mq.topic=example
# dynamic topic route by schema or table regex
#canal.mq.dynamicTopic=mytest1.user,mytest2\\\\..*,.*\\\\..*
canal.mq.partition=0
# hash partition config
#canal.mq.partitionsNum=3
#canal.mq.partitionHash=test.table:id^name,.*\\\\..*
#################################################

1.3.3.3. 启动canal deployer服务

/root/canal-deployer/bin/startup.sh
  • 查看启动日志,数据库连接是否正常
tail -f /root/canal-deployer/logs/example/example.log
  • 日志输出一下内容则表示canal服务端已经连接源数据正常,等待binlog dump指令
2020-07-20 09:36:30.381 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties]
2020-07-20 09:36:30.386 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties]
2020-07-20 09:36:30.557 [main] WARN  o.s.beans.GenericTypeAwarePropertyDescriptor - Invalid JavaBean property 'connectionCharset' being accessed! Ambiguous write methods found next to actually used [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.nio.charset.Charset)]: [public void com.alibaba.otter.canal.parse.inbound.mysql.AbstractMysqlEventParser.setConnectionCharset(java.lang.String)]
2020-07-20 09:36:30.597 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties]
2020-07-20 09:36:30.598 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties]
2020-07-20 09:36:30.955 [main] INFO  c.a.otter.canal.instance.spring.CanalInstanceWithSpring - start CannalInstance for 1-example
2020-07-20 09:36:30.962 [main] WARN  c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\\..*$
2020-07-20 09:36:30.962 [main] WARN  c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table black filter : ^mysql..*$
2020-07-20 09:36:30.969 [main] INFO  c.a.otter.canal.instance.core.AbstractCanalInstance - start successful....
2020-07-20 09:36:34.307 [destination = example , address = rm-uf6b0pg70y7h9lha9qo.mysql.rds.aliyuncs.com/8.133.15.188:3306 , EventParser] WARN  c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> begin to find start position, it will be long time for reset or first position
2020-07-20 09:36:34.307 [destination = example , address = rm-uf6b0pg70y7h9lha9qo.mysql.rds.aliyuncs.com/8.133.15.188:3306 , EventParser] WARN  c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - prepare to find start position just show master status
2020-07-20 09:36:54.083 [destination = example , address = rm-uf6b0pg70y7h9lha9qo.mysql.rds.aliyuncs.com/8.133.15.188:3306 , EventParser] WARN  c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ---> find start position successfully, EntryPosition[included=false,journalName=mysql-bin.000006,position=83537126,serverId=2614176453,gtid=,timestamp=1595237786000] cost : 19764ms , the next step is binlog dump

如出现权限问题请查看:RDS Mysql限制用户访问mysql.slave_master_info表权限

1.3.3.4. 配置canal Adapter 客户端服务 - 启动器

修改canal adapter客户端中间件启动器服务配置文件,添加源端以及目标端数据库连接信息

  • application.yaml
vim /root/canal-adapter/conf/application.yml
server:
  port: 8081
logging: # 添加服务启动级别为debug模式
  level:
    com.alibaba.otter.canal.client.adapter.hbase: DEBUG  
spring:
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
    default-property-inclusion: non_null

canal.conf:
  mode: tcp # kafka rocketMQ
  canalServerHost: 127.0.0.1:11111   #本地canal deployer服务端启动地址以及端口号,默认不需要修改
#  zookeeperHosts: slave1:2181
#  mqServers: 127.0.0.1:9092 #or rocketmq 
#  flatMessage: true
  batchSize: 500
  syncBatchSize: 1000 
  retries: 0
  timeout:
  accessKey:
  secretKey:
  srcDataSources:
    defaultDS:
      url: jdbc:mysql://8.133.15.188:3306/coredb?useUnicode=true # 源数据库连接地址以及端口号,地址建议使用IP,不要使用域名
      username: xuxingzhuang # 源数据库连接用户
      password: Abc999@1 # 源数据库连接密码
  canalAdapters:
  - instance: example # canal instance Name or mq topic name # 对应canal destination
    groups: # 对应适配器分组, 分组间的适配器并行运行
    - groupId: g1
      outerAdapters: # 适配器列表, 分组内的适配串行运行
      - name: logger # 适配器SPI名
      - name: rdb # 指定为rdb类型同步
        key: mysql1 # 指定adapter的唯一key, 与表映射配置中outerAdapterKey对应
        properties: # HBase相关连接参数
          jdbc.driverClassName: com.mysql.jdbc.Driver # 使用的jdbc库名称
          jdbc.url: jdbc:mysql://172.19.134.199:3306/coredb?useUnicode=true # 目标数据库连接地址以及端口号,地址建议使用IP,不要使用域名
          jdbc.username: xuxingzhuang # 目标数据库连接用户
          jdbc.password: Abc999@1 # 目标数据库连接密码
          threads: 5 # 并行执行的线程数, 默认为1
          commitSize: 3000 # 批次提交的最大行数
#      - name: rdb
#        key: oracle1
#        properties:
#          jdbc.driverClassName: oracle.jdbc.OracleDriver
#          jdbc.url: jdbc:oracle:thin:@localhost:49161:XE
#          jdbc.username: mytest
#          jdbc.password: m121212
#      - name: rdb
#        key: postgres1
#        properties:
#          jdbc.driverClassName: org.postgresql.Driver
#          jdbc.url: jdbc:postgresql://localhost:5432/postgres
#          jdbc.username: postgres
#          jdbc.password: 121212
#          threads: 2
#          commitSize: 3000
#      - name: hbase
#        properties:
#          hbase.zookeeper.quorum: 127.0.0.1
#          hbase.zookeeper.property.clientPort: 2181
#          zookeeper.znode.parent: /hbase
#      - name: es
#        hosts: 127.0.0.1:9300 # 127.0.0.1:9200 for rest mode
#        properties:
#          mode: transport # or rest
#          # security.auth: test:123456 #  only used for rest mode
#          cluster.name: elasticsearch

注意⚠️ :其中 outAdapter 的配置: name统一为rdb, key为对应的数据源的唯一标识需和下面的表映射文件中的outerAdapterKey对应, properties为目标库jdb的相关参数 adapter将会自动加载 conf/rdb 下的所有.yml结尾的表映射配置文件
canal adapter 中间件相关配置参数请参考:https://github.com/alibaba/canal/tree/master/client-adapter

1.3.3.5. 配置canal Adapter 客户端服务 - 适配器

修改canal adapter客户端中间件适配器服务配置文件,添加目标端数据库信息与2.3.3.4启动器配置相对应

  • mytest_user.yml # 可以自定义配置文件,adapter会自动加载conf/rdb目录下的所有.yml结尾的表映射配置文件
vim /root/canal-adapter/conf/rdb/mytest_user.yml
dataSourceKey: defaultDS # 源数据源的key, 对应上面配置的srcDataSources中的值
destination: example # cannal的instance或者MQ的topic
groupId: g1 
outerAdapterKey: mysql1 # adapter key, 对应上面配置outAdapters中的key
concurrent: true # 是否按主键hase并行同步, 并行同步的表必须保证主键不会更改及主键不能为其他同步表的外键!!
dbMapping:
  database: coredb # 源数据源的database/shcema
  table: seepcore_table # 源数据源表名
  targetTable: coredb.seepcore_table # 目标数据源的库名.表名
  targetPk: # 主键映射
    id: id # 如果是复合主键可以换行映射多个
#  mapAll: true # 是否整表映射, 要求源表和目标表字段名一模一样 (如果targetColumns也配置了映射,则以targetColumns配置为准)
#  targetColumns: # 字段映射, 格式: 目标表字段: 源表字段, 如果字段名一样源表字段名可不填
#    id:
#    name:
#    role_id:
#    c_time:
#    test1:
  etlCondition: "where c_time>="
  commitBatch: 3000 # 批量提交的大小


## Mirror schema synchronize config
#dataSourceKey: defaultDS
#destination: example
#groupId: g1
#outerAdapterKey: mysql1
#concurrent: true
#dbMapping:
#  mirrorDb: true
#  database: mytest

1.3.3.6. 启动RDB数据同步

启动canal-adapter启动器

/root/canal-adapter/bin/startup.sh

服务启动日志 - 启动成功

2020-07-20 10:27:13.078 [main] INFO  o.s.c.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3c3d9b6b: startup date [Mon Jul 20 10:27:13 UTC 2020]; root of context hierarchy
2020-07-20 10:27:13.391 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$fbd7a6d0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-07-20 10:27:13.717 [main] INFO  c.a.otter.canal.adapter.launcher.CanalAdapterApplication - No active profile set, falling back to default profiles: default
2020-07-20 10:27:13.740 [main] INFO  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6eb2384f: startup date [Mon Jul 20 10:27:13 UTC 2020]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3c3d9b6b
2020-07-20 10:27:14.311 [main] INFO  org.springframework.cloud.context.scope.GenericScope - BeanFactory id=ba9c0aec-0105-3f1f-b89e-e85c68567039
2020-07-20 10:27:14.373 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$fbd7a6d0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-07-20 10:27:14.612 [main] INFO  o.s.boot.web.embedded.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8081 (http)
2020-07-20 10:27:14.627 [main] INFO  org.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8081"]
2020-07-20 10:27:14.640 [main] INFO  org.apache.catalina.core.StandardService - Starting service [Tomcat]
2020-07-20 10:27:14.641 [main] INFO  org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/8.5.29
2020-07-20 10:27:14.662 [localhost-startStop-1] INFO  org.apache.catalina.core.AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2020-07-20 10:27:14.783 [localhost-startStop-1] INFO  o.a.catalina.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2020-07-20 10:27:14.784 [localhost-startStop-1] INFO  org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1044 ms
2020-07-20 10:27:14.913 [localhost-startStop-1] INFO  o.s.boot.web.servlet.ServletRegistrationBean - Servlet dispatcherServlet mapped to [/]
2020-07-20 10:27:14.917 [localhost-startStop-1] INFO  o.s.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'characterEncodingFilter' to: [/*]
2020-07-20 10:27:14.918 [localhost-startStop-1] INFO  o.s.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2020-07-20 10:27:14.918 [localhost-startStop-1] INFO  o.s.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'httpPutFormContentFilter' to: [/*]
2020-07-20 10:27:14.919 [localhost-startStop-1] INFO  o.s.boot.web.servlet.FilterRegistrationBean - Mapping filter: 'requestContextFilter' to: [/*]
2020-07-20 10:27:15.645 [main] INFO  com.alibaba.druid.pool.DruidDataSource - dataSource-1 inited
2020-07-20 10:27:15.820 [main] INFO  o.s.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-07-20 10:27:16.182 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6eb2384f: startup date [Mon Jul 20 10:27:13 GMT+00:00 2020]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3c3d9b6b
2020-07-20 10:27:16.276 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/count/type/key/task],methods=[GET]" onto public java.util.Map<java.lang.String, java.lang.Object> com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.count(java.lang.String,java.lang.String,java.lang.String)
2020-07-20 10:27:16.278 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/count/type/task],methods=[GET]" onto public java.util.Map<java.lang.String, java.lang.Object> com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.count(java.lang.String,java.lang.String)
2020-07-20 10:27:16.278 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/syncSwitch/destination/status],methods=[PUT]" onto public com.alibaba.otter.canal.client.adapter.support.Result com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.etl(java.lang.String,java.lang.String)
2020-07-20 10:27:16.279 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/syncSwitch/destination],methods=[GET]" onto public java.util.Map<java.lang.String, java.lang.String> com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.etl(java.lang.String)
2020-07-20 10:27:16.280 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/etl/type/key/task],methods=[POST]" onto public com.alibaba.otter.canal.client.adapter.support.EtlResult com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.etl(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
2020-07-20 10:27:16.280 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/etl/type/task],methods=[POST]" onto public com.alibaba.otter.canal.client.adapter.support.EtlResult com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.etl(java.lang.String,java.lang.String,java.lang.String)
2020-07-20 10:27:16.281 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/destinations],methods=[GET]" onto public java.util.List<java.util.Map<java.lang.String, java.lang.String>> com.alibaba.otter.canal.adapter.launcher.rest.CommonRest.destinations()
2020-07-20 10:27:16.285 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/error]" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-07-20 10:27:16.286 [main] INFO  o.s.w.s.m.method.annotation.RequestMappingHandlerMapping - Mapped "[/error],produces=[text/html]" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-07-20 10:27:16.330 [main] INFO  o.s.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-07-20 10:27:16.330 [main] INFO  o.s.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-07-20 10:27:16.575 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Registering beans for JMX exposure on startup
2020-07-20 10:27:16.584 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Bean with name 'refreshScope' has been autodetected for JMX exposure
2020-07-20 10:27:16.585 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2020-07-20 10:27:16.586 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Bean with name 'environmentManager' has been autodetected for JMX exposure
2020-07-20 10:27:16.589 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2020-07-20 10:27:16.608 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2020-07-20 10:27:16.620 [main] INFO  o.s.jmx.export.annotation.AnnotationMBeanExporter - Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean <

以上是关于开源数据库迁移工具canal的主要内容,如果未能解决你的问题,请参考以下文章

秒杀系统番外篇 | 阿里开源MySQL中间件Canal快速入门

mysql的数据表同步工具 canal的使用

监听MySQL的binlog日志工具分析:Canal

数据同步工具otter谈谈binlog和canal

canal入门

Canal的理解和应用