Canal-从零开始:入门简介,搭建环境

github地址:https://github.com/alibaba/canal/wiki

 

简介

  canal我理解是基于Mysql binary log的数据同步中间件。mysql作为master,canal模拟slave,发送请求,作为master的Mysql推送binary log给canal,canal自己再解析出来,推送到其他介质。如(rds,es,mq)

  可以理解canal是一个用来同步增量数据的工具。

 

 

搭建Canal-server

  canal-server有两种方式搭建:

    1.二进制文件安装

    2.基于docker镜像安装

  先介绍第一种:

  进入:https://github.com/alibaba/canal/releases/  官方页面下载relase版本,我选择的版本是1.1.4,

  admin是在1.1.4新加的管理界面

  deployer是下图流程所需(但是这是server,不仅包括是下面的流程)                                                                                                   

                                                                        

 另外的adapter是从canal到其他介质的包,下图的这部分,这里先不管后面会介绍到

 

 

  下好之后进行解压

 

   新建canal文件夹

  mkdir canal

   tar zxvf canal.deployer-1.1.4.tar.gz -C /canal

  解压完目录:

  

 

   修改配置文件了,先看下conf的目录结构:

  

 

   进入到example目录下,修改instance.properties文件

   

 

 

 

   改好之后保存,然后就启动了。

  进入到bin目录,执行:sh startup.sh

  查看server的日志:

  tail -100f logs/canal/canal.log 

  

2020-11-09 18:29:27.323 [main] INFO  com.alibaba.otter.canal.deployer.CanalLauncher - ## set default uncaught exception handler
2020-11-09 18:29:27.356 [main] INFO  com.alibaba.otter.canal.deployer.CanalLauncher - ## load canal configurations
2020-11-09 18:29:27.367 [main] INFO  com.alibaba.otter.canal.deployer.CanalStarter - ## start the canal server.
2020-11-09 18:29:27.391 [main] INFO  com.alibaba.otter.canal.deployer.CanalController - ## start the canal server[172.17.0.1(172.17.0.1):11111]
2020-11-09 18:29:28.472 [main] INFO  com.alibaba.otter.canal.deployer.CanalStarter - ## the canal server is running now ......

 

   查看instance日志:

  tail -100f logs/example/example.log

  

2020-11-09 18:29:27.909 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [canal.properties]
2020-11-09 18:29:27.910 [main] INFO  c.a.o.c.i.spring.support.PropertyPlaceholderConfigurer - Loading properties file from class path resource [example/instance.properties]
2020-11-09 18:29:28.304 [main] INFO  c.a.otter.canal.instance.spring.CanalInstanceWithSpring - start CannalInstance for 1-example
2020-11-09 18:29:28.309 [main] WARN  c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table filter : ^.*\..*$
2020-11-09 18:29:28.316 [main] WARN  c.a.o.canal.parse.inbound.mysql.dbsync.LogEventConvert - --> init table black filter :
2020-11-09 18:29:28.408 [destination = example , address = /127.0.0.1:13306 , 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-11-09 18:29:28.461 [main] INFO  c.a.otter.canal.instance.core.AbstractCanalInstance - start successful....

  

 

   以上canal-server就正式启动好了。

posted @ 2020-11-12 18:51  胡吃海喝的程序猿  阅读(827)  评论(0编辑  收藏  举报