[{"data":1,"prerenderedAt":2234},["ShallowReactive",2],{"post-\u002Fblog\u002F2020-05-12-canal-kafka-mysql":3,"surround-\u002Fblog\u002F2020-05-12-canal-kafka-mysql":2227},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"tags":11,"cover":17,"source":18,"body":19,"_type":2221,"_id":2222,"_source":2223,"_file":2224,"_stem":2225,"_extension":2226},"\u002Fblog\u002F2020-05-12-canal-kafka-mysql","blog",false,"","Canal + Kafka 实现 MySQL 的 binlog 近实时同步","基于 Alibaba 开源中间件 Canal 实现 MySQL binlog 近实时同步至 Kafka，搭建完整的 Canal 相关组件。","2020-05-12",[12,13,14,15,16],"简书","历史归档","Canal","Kafka","MySQL","https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-fb09aa1da4d8ec7a.png","https:\u002F\u002Fwww.jianshu.com\u002Fp\u002Fd03ef9e8f204",{"type":20,"children":21,"toc":2206},"root",[22,30,36,44,49,55,60,72,79,84,114,119,124,131,193,198,216,221,254,260,267,272,278,283,289,294,300,305,311,323,408,413,586,621,717,744,761,912,924,994,999,1006,1018,2085,2092,2139,2144,2171,2176,2200],{"type":23,"tag":24,"props":25,"children":27},"element","h2",{"id":26},"背景",[28],{"type":29,"value":26},"text",{"type":23,"tag":31,"props":32,"children":33},"p",{},[34],{"type":29,"value":35},"经过上篇文章的测试 Kafka Connect For MySQL 实现增量数据同步，因为研究时间较短，网上资源较少，只能自己一步一步去探索，在理论层面上是可以实现业务需求，但是实践过程中遇到一些原因，导致实际效果没有达到业务需求。所以将基于业务需求重新进行技术调研。因为笔者目前工作重心在于搭建一个小型的实时数仓。优先级比较高的一个任务就是需要近实时同步业务系统的数据（包括保存、更新或者软删除）到一个另一个数据源，持久化之前需要清洗数据并且构建一个相对合理的便于后续业务数据指标统计、数据指标计算等扩展功能的业务模型。基于当前团队的资源和能力，优先调研了Alibaba开源中间件Canal的使用。",{"type":23,"tag":31,"props":37,"children":38},{},[39],{"type":23,"tag":40,"props":41,"children":43},"img",{"alt":7,"src":42},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-fb09aa1da4d8ec7a.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F950\u002Fformat\u002Fwebp",[],{"type":23,"tag":31,"props":45,"children":46},{},[47],{"type":29,"value":48},"这篇文章将测试一下如何快速地搭建一套Canal相关的组件。",{"type":23,"tag":24,"props":50,"children":52},{"id":51},"关于-canal",[53],{"type":29,"value":54},"关于 Canal",{"type":23,"tag":24,"props":56,"children":58},{"id":57},"简介",[59],{"type":29,"value":57},{"type":23,"tag":31,"props":61,"children":62},{},[63,70],{"type":23,"tag":64,"props":65,"children":67},"code",{"className":66},[],[68],{"type":29,"value":69},"canal[kə'næl]",{"type":29,"value":71}," ，译意为水道\u002F管道\u002F沟渠，主要用途是基于MySQL数据库增量日志解析，提供增量数据订阅和消费。早期阿里巴巴因为杭州和美国双机房部署，存在跨机房同步的业务需求，实现方式主要是基于业务trigger获取增量变更。从 2010 年开始，业务逐步尝试数据库日志解析获取增量变更进行同步，由此衍生出了大量的数据库增量订阅和消费业务。",{"type":23,"tag":31,"props":73,"children":74},{},[75],{"type":23,"tag":40,"props":76,"children":78},{"alt":7,"src":77},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-94d458394bdc7ab9.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F1200\u002Fformat\u002Fwebp",[],{"type":23,"tag":31,"props":80,"children":81},{},[82],{"type":29,"value":83},"基于日志增量订阅和消费的业务包括：",{"type":23,"tag":85,"props":86,"children":87},"ul",{},[88,94,99,104,109],{"type":23,"tag":89,"props":90,"children":91},"li",{},[92],{"type":29,"value":93},"数据库镜像",{"type":23,"tag":89,"props":95,"children":96},{},[97],{"type":29,"value":98},"数据库实时备份",{"type":23,"tag":89,"props":100,"children":101},{},[102],{"type":29,"value":103},"索引构建和实时维护（拆分异构索引、倒排索引等）",{"type":23,"tag":89,"props":105,"children":106},{},[107],{"type":29,"value":108},"业务Cache刷新",{"type":23,"tag":89,"props":110,"children":111},{},[112],{"type":29,"value":113},"带业务逻辑的增量数据处理",{"type":23,"tag":24,"props":115,"children":117},{"id":116},"工作原理",[118],{"type":29,"value":116},{"type":23,"tag":31,"props":120,"children":121},{},[122],{"type":29,"value":123},"MySQL主备复制原理：",{"type":23,"tag":31,"props":125,"children":126},{},[127],{"type":23,"tag":40,"props":128,"children":130},{"alt":7,"src":129},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-304d42d58596fd93.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F497\u002Fformat\u002Fwebp",[],{"type":23,"tag":85,"props":132,"children":133},{},[134,152,177],{"type":23,"tag":89,"props":135,"children":136},{},[137,142,144,150],{"type":23,"tag":64,"props":138,"children":140},{"className":139},[],[141],{"type":29,"value":16},{"type":29,"value":143}," 的 ",{"type":23,"tag":64,"props":145,"children":147},{"className":146},[],[148],{"type":29,"value":149},"Master",{"type":29,"value":151}," 实例将数据变更写入二进制日志（binary log，其中记录叫做二进制日志事件binary log events，可以通过show binlog events进行查看）",{"type":23,"tag":89,"props":153,"children":154},{},[155,160,161,167,169,175],{"type":23,"tag":64,"props":156,"children":158},{"className":157},[],[159],{"type":29,"value":16},{"type":29,"value":143},{"type":23,"tag":64,"props":162,"children":164},{"className":163},[],[165],{"type":29,"value":166},"Slave",{"type":29,"value":168}," 实例将master的 ",{"type":23,"tag":64,"props":170,"children":172},{"className":171},[],[173],{"type":29,"value":174},"binary log events",{"type":29,"value":176}," 拷贝到它的中继日志（relay log）",{"type":23,"tag":89,"props":178,"children":179},{},[180,185,186,191],{"type":23,"tag":64,"props":181,"children":183},{"className":182},[],[184],{"type":29,"value":16},{"type":29,"value":143},{"type":23,"tag":64,"props":187,"children":189},{"className":188},[],[190],{"type":29,"value":166},{"type":29,"value":192}," 实例重放relay log中的事件，将数据变更反映它到自身的数据",{"type":23,"tag":31,"props":194,"children":195},{},[196],{"type":29,"value":197},"Canal 的工作原理如下：",{"type":23,"tag":85,"props":199,"children":200},{},[201,206,211],{"type":23,"tag":89,"props":202,"children":203},{},[204],{"type":29,"value":205},"Canal模拟MySQL Slave的交互协议，伪装自己为MySQL Slave，向MySQL Master发送dump协议",{"type":23,"tag":89,"props":207,"children":208},{},[209],{"type":29,"value":210},"MySQL Master收到dump请求，开始推送binary log给Slave（即Canal）",{"type":23,"tag":89,"props":212,"children":213},{},[214],{"type":29,"value":215},"Canal解析binary log对象（原始为byte流），并且可以通过连接器发送到对应的消息队列等中间件中",{"type":23,"tag":24,"props":217,"children":219},{"id":218},"部署所需的中间件",[220],{"type":29,"value":218},{"type":23,"tag":31,"props":222,"children":223},{},[224,226,231,233,239,240,245,247,252],{"type":29,"value":225},"搭建一套可以用的组件需要部署 ",{"type":23,"tag":64,"props":227,"children":229},{"className":228},[],[230],{"type":29,"value":16},{"type":29,"value":232}," 、 ",{"type":23,"tag":64,"props":234,"children":236},{"className":235},[],[237],{"type":29,"value":238},"Zookeeper",{"type":29,"value":232},{"type":23,"tag":64,"props":241,"children":243},{"className":242},[],[244],{"type":29,"value":15},{"type":29,"value":246}," 和 ",{"type":23,"tag":64,"props":248,"children":250},{"className":249},[],[251],{"type":29,"value":14},{"type":29,"value":253}," 四个中间件的实例，下面简单分析一下部署过程。选用的服务器系统是CentOS7。",{"type":23,"tag":24,"props":255,"children":257},{"id":256},"mysql-环境搭建",[258],{"type":29,"value":259},"MySQL 环境搭建",{"type":23,"tag":261,"props":262,"children":264},"h3",{"id":263},"mysql-安装",[265],{"type":29,"value":266},"MySQL 安装",{"type":23,"tag":31,"props":268,"children":269},{},[270],{"type":29,"value":271},"MySQL-5.7 的安装参考文章 Centos 7.3 安装 MySQL 5.7\nMySQL-8.0 的安装参考文章 Centos 7.3 安装 MySQL 8.0",{"type":23,"tag":261,"props":273,"children":275},{"id":274},"mysql-开启-binlog",[276],{"type":29,"value":277},"Mysql 开启 binlog",{"type":23,"tag":31,"props":279,"children":280},{},[281],{"type":29,"value":282},"参考文章 MySQL 开启 binlog",{"type":23,"tag":24,"props":284,"children":286},{"id":285},"zookeeper-分布式环境搭建",[287],{"type":29,"value":288},"Zookeeper 分布式环境搭建",{"type":23,"tag":31,"props":290,"children":291},{},[292],{"type":29,"value":293},"参考文章 Zookeeper 分布式环境搭建",{"type":23,"tag":24,"props":295,"children":297},{"id":296},"kafka-分布式环境搭建",[298],{"type":29,"value":299},"Kafka 分布式环境搭建",{"type":23,"tag":31,"props":301,"children":302},{},[303],{"type":29,"value":304},"参考文章 Kafka 分布式环境搭建",{"type":23,"tag":24,"props":306,"children":308},{"id":307},"安装和使用-canal",[309],{"type":29,"value":310},"安装和使用 Canal",{"type":23,"tag":31,"props":312,"children":313},{},[314,316,321],{"type":29,"value":315},"终于到了主角登场，这里选用 ",{"type":23,"tag":64,"props":317,"children":319},{"className":318},[],[320],{"type":29,"value":14},{"type":29,"value":322}," 的v1.1.4稳定发布版，只需要下载deployer模块：",{"type":23,"tag":324,"props":325,"children":329},"pre",{"className":326,"code":327,"language":328,"meta":7,"style":7},"language-bash shiki shiki-themes github-light github-dark","mkdir \u002Fdata\u002Fcanal\ncd \u002Fdata\u002Fcanal\n# 这里注意一点，Github在国内被墙，下载速度极慢，可以先用其他下载工具下载完再上传到服务器中\nwget https:\u002F\u002Fgithub.com\u002Falibaba\u002Fcanal\u002Freleases\u002Fdownload\u002Fcanal-1.1.4\u002Fcanal.deployer-1.1.4.tar.gz\ntar -zxvf canal.deployer-1.1.4.tar.gz\n","bash",[330],{"type":23,"tag":64,"props":331,"children":332},{"__ignoreMap":7},[333,351,365,375,389],{"type":23,"tag":334,"props":335,"children":338},"span",{"class":336,"line":337},"line",1,[339,345],{"type":23,"tag":334,"props":340,"children":342},{"style":341},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[343],{"type":29,"value":344},"mkdir",{"type":23,"tag":334,"props":346,"children":348},{"style":347},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[349],{"type":29,"value":350}," \u002Fdata\u002Fcanal\n",{"type":23,"tag":334,"props":352,"children":354},{"class":336,"line":353},2,[355,361],{"type":23,"tag":334,"props":356,"children":358},{"style":357},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[359],{"type":29,"value":360},"cd",{"type":23,"tag":334,"props":362,"children":363},{"style":347},[364],{"type":29,"value":350},{"type":23,"tag":334,"props":366,"children":368},{"class":336,"line":367},3,[369],{"type":23,"tag":334,"props":370,"children":372},{"style":371},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[373],{"type":29,"value":374},"# 这里注意一点，Github在国内被墙，下载速度极慢，可以先用其他下载工具下载完再上传到服务器中\n",{"type":23,"tag":334,"props":376,"children":378},{"class":336,"line":377},4,[379,384],{"type":23,"tag":334,"props":380,"children":381},{"style":341},[382],{"type":29,"value":383},"wget",{"type":23,"tag":334,"props":385,"children":386},{"style":347},[387],{"type":29,"value":388}," https:\u002F\u002Fgithub.com\u002Falibaba\u002Fcanal\u002Freleases\u002Fdownload\u002Fcanal-1.1.4\u002Fcanal.deployer-1.1.4.tar.gz\n",{"type":23,"tag":334,"props":390,"children":392},{"class":336,"line":391},5,[393,398,403],{"type":23,"tag":334,"props":394,"children":395},{"style":341},[396],{"type":29,"value":397},"tar",{"type":23,"tag":334,"props":399,"children":400},{"style":357},[401],{"type":29,"value":402}," -zxvf",{"type":23,"tag":334,"props":404,"children":405},{"style":347},[406],{"type":29,"value":407}," canal.deployer-1.1.4.tar.gz\n",{"type":23,"tag":31,"props":409,"children":410},{},[411],{"type":29,"value":412},"解压后的目录如下：",{"type":23,"tag":324,"props":414,"children":416},{"className":326,"code":415,"language":328,"meta":7,"style":7},"- bin   # 运维脚本\n- conf  # 配置文件\n  canal_local.properties  # canal本地配置，一般不需要动\n  canal.properties        # canal服务配置\n  logback.xml             # logback日志配置\n  metrics                 # 度量统计配置\n  spring                  # spring-实例配置，主要和binlog位置计算、一些策略配置相关\n  example                 # 实例配置文件夹，一般认为单个数据库对应一个独立的实例配置文件夹\n    instance.properties   # 实例配置，一般指单个数据库的配置\n- lib   # 服务依赖包\n- logs  # 日志文件输出目录\n",[417],{"type":23,"tag":64,"props":418,"children":419},{"__ignoreMap":7},[420,438,455,468,481,494,508,522,536,550,568],{"type":23,"tag":334,"props":421,"children":422},{"class":336,"line":337},[423,428,433],{"type":23,"tag":334,"props":424,"children":425},{"style":341},[426],{"type":29,"value":427},"-",{"type":23,"tag":334,"props":429,"children":430},{"style":347},[431],{"type":29,"value":432}," bin",{"type":23,"tag":334,"props":434,"children":435},{"style":371},[436],{"type":29,"value":437},"   # 运维脚本\n",{"type":23,"tag":334,"props":439,"children":440},{"class":336,"line":353},[441,445,450],{"type":23,"tag":334,"props":442,"children":443},{"style":341},[444],{"type":29,"value":427},{"type":23,"tag":334,"props":446,"children":447},{"style":347},[448],{"type":29,"value":449}," conf",{"type":23,"tag":334,"props":451,"children":452},{"style":371},[453],{"type":29,"value":454},"  # 配置文件\n",{"type":23,"tag":334,"props":456,"children":457},{"class":336,"line":367},[458,463],{"type":23,"tag":334,"props":459,"children":460},{"style":341},[461],{"type":29,"value":462},"  canal_local.properties",{"type":23,"tag":334,"props":464,"children":465},{"style":371},[466],{"type":29,"value":467},"  # canal本地配置，一般不需要动\n",{"type":23,"tag":334,"props":469,"children":470},{"class":336,"line":377},[471,476],{"type":23,"tag":334,"props":472,"children":473},{"style":341},[474],{"type":29,"value":475},"  canal.properties",{"type":23,"tag":334,"props":477,"children":478},{"style":371},[479],{"type":29,"value":480},"        # canal服务配置\n",{"type":23,"tag":334,"props":482,"children":483},{"class":336,"line":391},[484,489],{"type":23,"tag":334,"props":485,"children":486},{"style":341},[487],{"type":29,"value":488},"  logback.xml",{"type":23,"tag":334,"props":490,"children":491},{"style":371},[492],{"type":29,"value":493},"             # logback日志配置\n",{"type":23,"tag":334,"props":495,"children":497},{"class":336,"line":496},6,[498,503],{"type":23,"tag":334,"props":499,"children":500},{"style":341},[501],{"type":29,"value":502},"  metrics",{"type":23,"tag":334,"props":504,"children":505},{"style":371},[506],{"type":29,"value":507},"                 # 度量统计配置\n",{"type":23,"tag":334,"props":509,"children":511},{"class":336,"line":510},7,[512,517],{"type":23,"tag":334,"props":513,"children":514},{"style":341},[515],{"type":29,"value":516},"  spring",{"type":23,"tag":334,"props":518,"children":519},{"style":371},[520],{"type":29,"value":521},"                  # spring-实例配置，主要和binlog位置计算、一些策略配置相关\n",{"type":23,"tag":334,"props":523,"children":525},{"class":336,"line":524},8,[526,531],{"type":23,"tag":334,"props":527,"children":528},{"style":341},[529],{"type":29,"value":530},"  example",{"type":23,"tag":334,"props":532,"children":533},{"style":371},[534],{"type":29,"value":535},"                 # 实例配置文件夹，一般认为单个数据库对应一个独立的实例配置文件夹\n",{"type":23,"tag":334,"props":537,"children":539},{"class":336,"line":538},9,[540,545],{"type":23,"tag":334,"props":541,"children":542},{"style":341},[543],{"type":29,"value":544},"    instance.properties",{"type":23,"tag":334,"props":546,"children":547},{"style":371},[548],{"type":29,"value":549},"   # 实例配置，一般指单个数据库的配置\n",{"type":23,"tag":334,"props":551,"children":553},{"class":336,"line":552},10,[554,558,563],{"type":23,"tag":334,"props":555,"children":556},{"style":341},[557],{"type":29,"value":427},{"type":23,"tag":334,"props":559,"children":560},{"style":347},[561],{"type":29,"value":562}," lib",{"type":23,"tag":334,"props":564,"children":565},{"style":371},[566],{"type":29,"value":567},"   # 服务依赖包\n",{"type":23,"tag":334,"props":569,"children":571},{"class":336,"line":570},11,[572,576,581],{"type":23,"tag":334,"props":573,"children":574},{"style":341},[575],{"type":29,"value":427},{"type":23,"tag":334,"props":577,"children":578},{"style":347},[579],{"type":29,"value":580}," logs",{"type":23,"tag":334,"props":582,"children":583},{"style":371},[584],{"type":29,"value":585},"  # 日志文件输出目录\n",{"type":23,"tag":31,"props":587,"children":588},{},[589,591,597,599,605,606,612,614,619],{"type":29,"value":590},"在开发和测试环境建议把 ",{"type":23,"tag":64,"props":592,"children":594},{"className":593},[],[595],{"type":29,"value":596},"logback.xml",{"type":29,"value":598}," 的日志级别修改为DEBUG方便定位问题。这里需要关注 ",{"type":23,"tag":64,"props":600,"children":602},{"className":601},[],[603],{"type":29,"value":604},"canal.properties",{"type":29,"value":246},{"type":23,"tag":64,"props":607,"children":609},{"className":608},[],[610],{"type":29,"value":611},"instance.properties",{"type":29,"value":613}," 两个配置文件。 ",{"type":23,"tag":64,"props":615,"children":617},{"className":616},[],[618],{"type":29,"value":604},{"type":29,"value":620}," 文件中，需要修改：",{"type":23,"tag":85,"props":622,"children":623},{},[624,637,684],{"type":23,"tag":89,"props":625,"children":626},{},[627,629,635],{"type":29,"value":628},"去掉 ",{"type":23,"tag":64,"props":630,"children":632},{"className":631},[],[633],{"type":29,"value":634},"canal.instance.parser.parallelThreadSize = 16",{"type":29,"value":636}," 这个配置项的注释，也就是启用此配置项，和实例解析器的线程数相关，不配置会表现为阻塞或者不进行解析。",{"type":23,"tag":89,"props":638,"children":639},{},[640,646,648,654,656,662,663,668,669,675,677,682],{"type":23,"tag":64,"props":641,"children":643},{"className":642},[],[644],{"type":29,"value":645},"canal.serverMode",{"type":29,"value":647}," 配置项指定为 ",{"type":23,"tag":64,"props":649,"children":651},{"className":650},[],[652],{"type":29,"value":653},"kafka",{"type":29,"value":655}," ，可选值有 ",{"type":23,"tag":64,"props":657,"children":659},{"className":658},[],[660],{"type":29,"value":661},"tcp",{"type":29,"value":232},{"type":23,"tag":64,"props":664,"children":666},{"className":665},[],[667],{"type":29,"value":653},{"type":29,"value":246},{"type":23,"tag":64,"props":670,"children":672},{"className":671},[],[673],{"type":29,"value":674},"rocketmq",{"type":29,"value":676}," ，默认是 ",{"type":23,"tag":64,"props":678,"children":680},{"className":679},[],[681],{"type":29,"value":653},{"type":29,"value":683}," 。",{"type":23,"tag":89,"props":685,"children":686},{},[687,693,695,700,702,708,710,716],{"type":23,"tag":64,"props":688,"children":690},{"className":689},[],[691],{"type":29,"value":692},"canal.mq.servers",{"type":29,"value":694}," 配置需要指定为 ",{"type":23,"tag":64,"props":696,"children":698},{"className":697},[],[699],{"type":29,"value":15},{"type":29,"value":701}," 服务或者集群 ",{"type":23,"tag":64,"props":703,"children":705},{"className":704},[],[706],{"type":29,"value":707},"Broker",{"type":29,"value":709}," 的地址，这里配置为 ",{"type":23,"tag":64,"props":711,"children":713},{"className":712},[],[714],{"type":29,"value":715},"127.0.0.1:9092",{"type":29,"value":683},{"type":23,"tag":718,"props":719,"children":720},"blockquote",{},[721,726],{"type":23,"tag":31,"props":722,"children":723},{},[724],{"type":29,"value":725},"canal.mq.servers在不同的canal.serverMode有不同的意义。",{"type":23,"tag":85,"props":727,"children":728},{},[729,734,739],{"type":23,"tag":89,"props":730,"children":731},{},[732],{"type":29,"value":733},"kafka模式下，指Kafka服务或者集群Broker的地址，也就是bootstrap.servers",{"type":23,"tag":89,"props":735,"children":736},{},[737],{"type":29,"value":738},"rocketmq模式下，指NameServer列表",{"type":23,"tag":89,"props":740,"children":741},{},[742],{"type":29,"value":743},"rabbitmq模式下，指RabbitMQ服务的Host和Port",{"type":23,"tag":31,"props":745,"children":746},{},[747,752,754,759],{"type":23,"tag":64,"props":748,"children":750},{"className":749},[],[751],{"type":29,"value":611},{"type":29,"value":753}," 一般指一个数据库实例的配置，Canal架构支持一个Canal服务实例，处理多个数据库实例的binlog异步解析。 ",{"type":23,"tag":64,"props":755,"children":757},{"className":756},[],[758],{"type":29,"value":611},{"type":29,"value":760}," 需要修改的配置项主要包括：",{"type":23,"tag":85,"props":762,"children":763},{},[764,782,849],{"type":23,"tag":89,"props":765,"children":766},{},[767,773,775,781],{"type":23,"tag":64,"props":768,"children":770},{"className":769},[],[771],{"type":29,"value":772},"canal.instance.mysql.slaveId",{"type":29,"value":774}," 需要配置一个和Master节点的服务ID完全不同的值，这里笔者配置为 ",{"type":23,"tag":64,"props":776,"children":778},{"className":777},[],[779],{"type":29,"value":780},"654321",{"type":29,"value":683},{"type":23,"tag":89,"props":783,"children":784},{},[785,787],{"type":29,"value":786},"配置数据源实例，包括地址、用户、密码和目标数据库：\n",{"type":23,"tag":85,"props":788,"children":789},{},[790,808,819,836],{"type":23,"tag":89,"props":791,"children":792},{},[793,799,801,807],{"type":23,"tag":64,"props":794,"children":796},{"className":795},[],[797],{"type":29,"value":798},"canal.instance.master.address",{"type":29,"value":800}," ，这里指定为 ",{"type":23,"tag":64,"props":802,"children":804},{"className":803},[],[805],{"type":29,"value":806},"127.0.0.1:3306",{"type":29,"value":683},{"type":23,"tag":89,"props":809,"children":810},{},[811,817],{"type":23,"tag":64,"props":812,"children":814},{"className":813},[],[815],{"type":29,"value":816},"canal.instance.dbUsername",{"type":29,"value":818}," ，这里指定为canal。",{"type":23,"tag":89,"props":820,"children":821},{},[822,828,829,835],{"type":23,"tag":64,"props":823,"children":825},{"className":824},[],[826],{"type":29,"value":827},"canal.instance.dbPassword",{"type":29,"value":800},{"type":23,"tag":64,"props":830,"children":832},{"className":831},[],[833],{"type":29,"value":834},"QWqw12!@",{"type":29,"value":683},{"type":23,"tag":89,"props":837,"children":838},{},[839,841,847],{"type":29,"value":840},"新增 ",{"type":23,"tag":64,"props":842,"children":844},{"className":843},[],[845],{"type":29,"value":846},"canal.instance.defaultDatabaseName",{"type":29,"value":848}," ，这里指定为test。",{"type":23,"tag":89,"props":850,"children":851},{},[852,857,859,865,867,873,875],{"type":23,"tag":64,"props":853,"children":855},{"className":854},[],[856],{"type":29,"value":15},{"type":29,"value":858}," 相关配置，这里暂时使用静态 ",{"type":23,"tag":64,"props":860,"children":862},{"className":861},[],[863],{"type":29,"value":864},"topic",{"type":29,"value":866}," 和单个 ",{"type":23,"tag":64,"props":868,"children":870},{"className":869},[],[871],{"type":29,"value":872},"partition",{"type":29,"value":874}," ：\n",{"type":23,"tag":85,"props":876,"children":877},{},[878,895],{"type":23,"tag":89,"props":879,"children":880},{},[881,887,888,894],{"type":23,"tag":64,"props":882,"children":884},{"className":883},[],[885],{"type":29,"value":886},"canal.mq.topic",{"type":29,"value":800},{"type":23,"tag":64,"props":889,"children":891},{"className":890},[],[892],{"type":29,"value":893},"test",{"type":29,"value":683},{"type":23,"tag":89,"props":896,"children":897},{},[898,904,905,911],{"type":23,"tag":64,"props":899,"children":901},{"className":900},[],[902],{"type":29,"value":903},"canal.mq.partition",{"type":29,"value":800},{"type":23,"tag":64,"props":906,"children":908},{"className":907},[],[909],{"type":29,"value":910},"0",{"type":29,"value":683},{"type":23,"tag":31,"props":913,"children":914},{},[915,917,922],{"type":29,"value":916},"配置工作做好之后，可以启动 ",{"type":23,"tag":64,"props":918,"children":920},{"className":919},[],[921],{"type":29,"value":14},{"type":29,"value":923}," 服务：",{"type":23,"tag":324,"props":925,"children":927},{"className":326,"code":926,"language":328,"meta":7,"style":7},"sh \u002Fdata\u002Fcanal\u002Fbin\u002Fstartup.sh\n# 查看服务日志\ntail -100f \u002Fdata\u002Fcanal\u002Flogs\u002Fcanal\u002Fcanal\n# 查看实例日志  -- 一般情况下，关注实例日志即可\ntail -100f \u002Fdata\u002Fcanal\u002Flogs\u002Fexample\u002Fexample.log\n",[928],{"type":23,"tag":64,"props":929,"children":930},{"__ignoreMap":7},[931,944,952,970,978],{"type":23,"tag":334,"props":932,"children":933},{"class":336,"line":337},[934,939],{"type":23,"tag":334,"props":935,"children":936},{"style":341},[937],{"type":29,"value":938},"sh",{"type":23,"tag":334,"props":940,"children":941},{"style":347},[942],{"type":29,"value":943}," \u002Fdata\u002Fcanal\u002Fbin\u002Fstartup.sh\n",{"type":23,"tag":334,"props":945,"children":946},{"class":336,"line":353},[947],{"type":23,"tag":334,"props":948,"children":949},{"style":371},[950],{"type":29,"value":951},"# 查看服务日志\n",{"type":23,"tag":334,"props":953,"children":954},{"class":336,"line":367},[955,960,965],{"type":23,"tag":334,"props":956,"children":957},{"style":341},[958],{"type":29,"value":959},"tail",{"type":23,"tag":334,"props":961,"children":962},{"style":357},[963],{"type":29,"value":964}," -100f",{"type":23,"tag":334,"props":966,"children":967},{"style":347},[968],{"type":29,"value":969}," \u002Fdata\u002Fcanal\u002Flogs\u002Fcanal\u002Fcanal\n",{"type":23,"tag":334,"props":971,"children":972},{"class":336,"line":377},[973],{"type":23,"tag":334,"props":974,"children":975},{"style":371},[976],{"type":29,"value":977},"# 查看实例日志  -- 一般情况下，关注实例日志即可\n",{"type":23,"tag":334,"props":979,"children":980},{"class":336,"line":391},[981,985,989],{"type":23,"tag":334,"props":982,"children":983},{"style":341},[984],{"type":29,"value":959},{"type":23,"tag":334,"props":986,"children":987},{"style":357},[988],{"type":29,"value":964},{"type":23,"tag":334,"props":990,"children":991},{"style":347},[992],{"type":29,"value":993}," \u002Fdata\u002Fcanal\u002Flogs\u002Fexample\u002Fexample.log\n",{"type":23,"tag":31,"props":995,"children":996},{},[997],{"type":29,"value":998},"启动正常后，见实例日志如下：",{"type":23,"tag":31,"props":1000,"children":1001},{},[1002],{"type":23,"tag":40,"props":1003,"children":1005},{"alt":7,"src":1004},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-6af348f8c1f04d14.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F1200\u002Fformat\u002Fwebp",[],{"type":23,"tag":31,"props":1007,"children":1008},{},[1009,1011,1016],{"type":29,"value":1010},"在 ",{"type":23,"tag":64,"props":1012,"children":1014},{"className":1013},[],[1015],{"type":29,"value":893},{"type":29,"value":1017}," 数据库创建一个订单表，并且执行几个简单的DML：",{"type":23,"tag":324,"props":1019,"children":1023},{"className":1020,"code":1021,"language":1022,"meta":7,"style":7},"language-sql shiki shiki-themes github-light github-dark","USE test;\n\nCREATE TABLE IF NOT EXISTS test.omneo(\n    pid int(11) NOT NULL AUTO_INCREMENT,\n    uuid varchar(100) NOT NULL,\n    firstname varchar(20) CHARACTER SET utf8 DEFAULT NULL,\n    lastname varchar(20) CHARACTER SET utf8 DEFAULT NULL,\n    birthdate varchar(20),\n    postalcode varchar(20),\n    city varchar(20),\n    sexe varchar(20),\n    status varchar(20),\n    commenttime timestamp NOT NULL DEFAULT current_timestamp,\n    PRIMARY KEY (pid)\n)ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n# 插入 4 条测试数据\ninsert into omneo values(1,\"0049683542a7-5bdb-d564-3133-276ae3ce\",\"Maurice\",\"Samuel\",\"01\u002F11\u002F1977\",\"H2M2V5\",\"Ballancourt\",\"male\",\"en couple\",\"2020-05-09 11:01:54\");\ninsert into omneo values(2,\"8338623542a7-5bdb-d564-3133-276ae3ce\",\"Gauthier\",\"Garbuet\",\"23\u002F05\u002F1965\",\"05274\",\"Cocagne\",\"female\",\"maried\",\"2020-05-09 11:01:54\");\ninsert into omneo values(3,\"3374573542a7-5bdb-d564-3133-276ae3ce\",\"Maurice\",\"Samuel\",\"01\u002F11\u002F1977\",\"H0H0H0\",\"Ottawa\",\"male\",\"en couple\",\"2020-05-09 11:01:54\");\ninsert into omneo values(4,\"5494133542a7-5bdb-d564-3133-276ae3ce\",\"Nicole\",\"Garbuet\",\"01\u002F11\u002F1977\",\"H0H0H0\",\"Maugio\",\"unknown\",\"single\",\"2020-05-09 11:01:54\");\n\n# 更新测试数据\nupdate omneo set firstname = \"world\" ,commenttime=\"2020-12-20 15:55:10\" where pid in(2,4);\n# 删除测试数据\ndelete from omneo where pid = 1;\n","sql",[1024],{"type":23,"tag":64,"props":1025,"children":1026},{"__ignoreMap":7},[1027,1042,1051,1099,1137,1172,1226,1274,1299,1323,1347,1371,1397,1426,1440,1477,1485,1504,1619,1728,1832,1937,1945,1954,2035,2044],{"type":23,"tag":334,"props":1028,"children":1029},{"class":336,"line":337},[1030,1036],{"type":23,"tag":334,"props":1031,"children":1033},{"style":1032},"--shiki-default:#D73A49;--shiki-dark:#F97583",[1034],{"type":29,"value":1035},"USE",{"type":23,"tag":334,"props":1037,"children":1039},{"style":1038},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[1040],{"type":29,"value":1041}," test;\n",{"type":23,"tag":334,"props":1043,"children":1044},{"class":336,"line":353},[1045],{"type":23,"tag":334,"props":1046,"children":1048},{"emptyLinePlaceholder":1047},true,[1049],{"type":29,"value":1050},"\n",{"type":23,"tag":334,"props":1052,"children":1053},{"class":336,"line":367},[1054,1059,1064,1069,1074,1079,1084,1089,1094],{"type":23,"tag":334,"props":1055,"children":1056},{"style":1032},[1057],{"type":29,"value":1058},"CREATE",{"type":23,"tag":334,"props":1060,"children":1061},{"style":1032},[1062],{"type":29,"value":1063}," TABLE",{"type":23,"tag":334,"props":1065,"children":1066},{"style":341},[1067],{"type":29,"value":1068}," IF",{"type":23,"tag":334,"props":1070,"children":1071},{"style":1032},[1072],{"type":29,"value":1073}," NOT",{"type":23,"tag":334,"props":1075,"children":1076},{"style":1032},[1077],{"type":29,"value":1078}," EXISTS",{"type":23,"tag":334,"props":1080,"children":1081},{"style":357},[1082],{"type":29,"value":1083}," test",{"type":23,"tag":334,"props":1085,"children":1086},{"style":1038},[1087],{"type":29,"value":1088},".",{"type":23,"tag":334,"props":1090,"children":1091},{"style":357},[1092],{"type":29,"value":1093},"omneo",{"type":23,"tag":334,"props":1095,"children":1096},{"style":1038},[1097],{"type":29,"value":1098},"(\n",{"type":23,"tag":334,"props":1100,"children":1101},{"class":336,"line":377},[1102,1107,1112,1117,1122,1127,1132],{"type":23,"tag":334,"props":1103,"children":1104},{"style":1038},[1105],{"type":29,"value":1106},"    pid ",{"type":23,"tag":334,"props":1108,"children":1109},{"style":1032},[1110],{"type":29,"value":1111},"int",{"type":23,"tag":334,"props":1113,"children":1114},{"style":1038},[1115],{"type":29,"value":1116},"(",{"type":23,"tag":334,"props":1118,"children":1119},{"style":357},[1120],{"type":29,"value":1121},"11",{"type":23,"tag":334,"props":1123,"children":1124},{"style":1038},[1125],{"type":29,"value":1126},") ",{"type":23,"tag":334,"props":1128,"children":1129},{"style":1032},[1130],{"type":29,"value":1131},"NOT NULL",{"type":23,"tag":334,"props":1133,"children":1134},{"style":1038},[1135],{"type":29,"value":1136}," AUTO_INCREMENT,\n",{"type":23,"tag":334,"props":1138,"children":1139},{"class":336,"line":391},[1140,1145,1150,1154,1159,1163,1167],{"type":23,"tag":334,"props":1141,"children":1142},{"style":1038},[1143],{"type":29,"value":1144},"    uuid ",{"type":23,"tag":334,"props":1146,"children":1147},{"style":1032},[1148],{"type":29,"value":1149},"varchar",{"type":23,"tag":334,"props":1151,"children":1152},{"style":1038},[1153],{"type":29,"value":1116},{"type":23,"tag":334,"props":1155,"children":1156},{"style":357},[1157],{"type":29,"value":1158},"100",{"type":23,"tag":334,"props":1160,"children":1161},{"style":1038},[1162],{"type":29,"value":1126},{"type":23,"tag":334,"props":1164,"children":1165},{"style":1032},[1166],{"type":29,"value":1131},{"type":23,"tag":334,"props":1168,"children":1169},{"style":1038},[1170],{"type":29,"value":1171},",\n",{"type":23,"tag":334,"props":1173,"children":1174},{"class":336,"line":496},[1175,1180,1184,1188,1193,1197,1202,1207,1212,1217,1222],{"type":23,"tag":334,"props":1176,"children":1177},{"style":1038},[1178],{"type":29,"value":1179},"    firstname ",{"type":23,"tag":334,"props":1181,"children":1182},{"style":1032},[1183],{"type":29,"value":1149},{"type":23,"tag":334,"props":1185,"children":1186},{"style":1038},[1187],{"type":29,"value":1116},{"type":23,"tag":334,"props":1189,"children":1190},{"style":357},[1191],{"type":29,"value":1192},"20",{"type":23,"tag":334,"props":1194,"children":1195},{"style":1038},[1196],{"type":29,"value":1126},{"type":23,"tag":334,"props":1198,"children":1199},{"style":1032},[1200],{"type":29,"value":1201},"CHARACTER",{"type":23,"tag":334,"props":1203,"children":1204},{"style":1032},[1205],{"type":29,"value":1206}," SET",{"type":23,"tag":334,"props":1208,"children":1209},{"style":1038},[1210],{"type":29,"value":1211}," utf8 ",{"type":23,"tag":334,"props":1213,"children":1214},{"style":1032},[1215],{"type":29,"value":1216},"DEFAULT",{"type":23,"tag":334,"props":1218,"children":1219},{"style":1032},[1220],{"type":29,"value":1221}," NULL",{"type":23,"tag":334,"props":1223,"children":1224},{"style":1038},[1225],{"type":29,"value":1171},{"type":23,"tag":334,"props":1227,"children":1228},{"class":336,"line":510},[1229,1234,1238,1242,1246,1250,1254,1258,1262,1266,1270],{"type":23,"tag":334,"props":1230,"children":1231},{"style":1038},[1232],{"type":29,"value":1233},"    lastname ",{"type":23,"tag":334,"props":1235,"children":1236},{"style":1032},[1237],{"type":29,"value":1149},{"type":23,"tag":334,"props":1239,"children":1240},{"style":1038},[1241],{"type":29,"value":1116},{"type":23,"tag":334,"props":1243,"children":1244},{"style":357},[1245],{"type":29,"value":1192},{"type":23,"tag":334,"props":1247,"children":1248},{"style":1038},[1249],{"type":29,"value":1126},{"type":23,"tag":334,"props":1251,"children":1252},{"style":1032},[1253],{"type":29,"value":1201},{"type":23,"tag":334,"props":1255,"children":1256},{"style":1032},[1257],{"type":29,"value":1206},{"type":23,"tag":334,"props":1259,"children":1260},{"style":1038},[1261],{"type":29,"value":1211},{"type":23,"tag":334,"props":1263,"children":1264},{"style":1032},[1265],{"type":29,"value":1216},{"type":23,"tag":334,"props":1267,"children":1268},{"style":1032},[1269],{"type":29,"value":1221},{"type":23,"tag":334,"props":1271,"children":1272},{"style":1038},[1273],{"type":29,"value":1171},{"type":23,"tag":334,"props":1275,"children":1276},{"class":336,"line":524},[1277,1282,1286,1290,1294],{"type":23,"tag":334,"props":1278,"children":1279},{"style":1038},[1280],{"type":29,"value":1281},"    birthdate ",{"type":23,"tag":334,"props":1283,"children":1284},{"style":1032},[1285],{"type":29,"value":1149},{"type":23,"tag":334,"props":1287,"children":1288},{"style":1038},[1289],{"type":29,"value":1116},{"type":23,"tag":334,"props":1291,"children":1292},{"style":357},[1293],{"type":29,"value":1192},{"type":23,"tag":334,"props":1295,"children":1296},{"style":1038},[1297],{"type":29,"value":1298},"),\n",{"type":23,"tag":334,"props":1300,"children":1301},{"class":336,"line":538},[1302,1307,1311,1315,1319],{"type":23,"tag":334,"props":1303,"children":1304},{"style":1038},[1305],{"type":29,"value":1306},"    postalcode ",{"type":23,"tag":334,"props":1308,"children":1309},{"style":1032},[1310],{"type":29,"value":1149},{"type":23,"tag":334,"props":1312,"children":1313},{"style":1038},[1314],{"type":29,"value":1116},{"type":23,"tag":334,"props":1316,"children":1317},{"style":357},[1318],{"type":29,"value":1192},{"type":23,"tag":334,"props":1320,"children":1321},{"style":1038},[1322],{"type":29,"value":1298},{"type":23,"tag":334,"props":1324,"children":1325},{"class":336,"line":552},[1326,1331,1335,1339,1343],{"type":23,"tag":334,"props":1327,"children":1328},{"style":1038},[1329],{"type":29,"value":1330},"    city ",{"type":23,"tag":334,"props":1332,"children":1333},{"style":1032},[1334],{"type":29,"value":1149},{"type":23,"tag":334,"props":1336,"children":1337},{"style":1038},[1338],{"type":29,"value":1116},{"type":23,"tag":334,"props":1340,"children":1341},{"style":357},[1342],{"type":29,"value":1192},{"type":23,"tag":334,"props":1344,"children":1345},{"style":1038},[1346],{"type":29,"value":1298},{"type":23,"tag":334,"props":1348,"children":1349},{"class":336,"line":570},[1350,1355,1359,1363,1367],{"type":23,"tag":334,"props":1351,"children":1352},{"style":1038},[1353],{"type":29,"value":1354},"    sexe ",{"type":23,"tag":334,"props":1356,"children":1357},{"style":1032},[1358],{"type":29,"value":1149},{"type":23,"tag":334,"props":1360,"children":1361},{"style":1038},[1362],{"type":29,"value":1116},{"type":23,"tag":334,"props":1364,"children":1365},{"style":357},[1366],{"type":29,"value":1192},{"type":23,"tag":334,"props":1368,"children":1369},{"style":1038},[1370],{"type":29,"value":1298},{"type":23,"tag":334,"props":1372,"children":1374},{"class":336,"line":1373},12,[1375,1380,1385,1389,1393],{"type":23,"tag":334,"props":1376,"children":1377},{"style":1032},[1378],{"type":29,"value":1379},"    status",{"type":23,"tag":334,"props":1381,"children":1382},{"style":1032},[1383],{"type":29,"value":1384}," varchar",{"type":23,"tag":334,"props":1386,"children":1387},{"style":1038},[1388],{"type":29,"value":1116},{"type":23,"tag":334,"props":1390,"children":1391},{"style":357},[1392],{"type":29,"value":1192},{"type":23,"tag":334,"props":1394,"children":1395},{"style":1038},[1396],{"type":29,"value":1298},{"type":23,"tag":334,"props":1398,"children":1400},{"class":336,"line":1399},13,[1401,1406,1411,1416,1421],{"type":23,"tag":334,"props":1402,"children":1403},{"style":1038},[1404],{"type":29,"value":1405},"    commenttime ",{"type":23,"tag":334,"props":1407,"children":1408},{"style":1032},[1409],{"type":29,"value":1410},"timestamp",{"type":23,"tag":334,"props":1412,"children":1413},{"style":1032},[1414],{"type":29,"value":1415}," NOT NULL",{"type":23,"tag":334,"props":1417,"children":1418},{"style":1032},[1419],{"type":29,"value":1420}," DEFAULT",{"type":23,"tag":334,"props":1422,"children":1423},{"style":1038},[1424],{"type":29,"value":1425}," current_timestamp,\n",{"type":23,"tag":334,"props":1427,"children":1429},{"class":336,"line":1428},14,[1430,1435],{"type":23,"tag":334,"props":1431,"children":1432},{"style":1032},[1433],{"type":29,"value":1434},"    PRIMARY KEY",{"type":23,"tag":334,"props":1436,"children":1437},{"style":1038},[1438],{"type":29,"value":1439}," (pid)\n",{"type":23,"tag":334,"props":1441,"children":1443},{"class":336,"line":1442},15,[1444,1449,1454,1459,1463,1468,1472],{"type":23,"tag":334,"props":1445,"children":1446},{"style":1038},[1447],{"type":29,"value":1448},")ENGINE",{"type":23,"tag":334,"props":1450,"children":1451},{"style":1032},[1452],{"type":29,"value":1453},"=",{"type":23,"tag":334,"props":1455,"children":1456},{"style":1038},[1457],{"type":29,"value":1458},"InnoDB ",{"type":23,"tag":334,"props":1460,"children":1461},{"style":1032},[1462],{"type":29,"value":1216},{"type":23,"tag":334,"props":1464,"children":1465},{"style":1038},[1466],{"type":29,"value":1467}," CHARSET",{"type":23,"tag":334,"props":1469,"children":1470},{"style":1032},[1471],{"type":29,"value":1453},{"type":23,"tag":334,"props":1473,"children":1474},{"style":1038},[1475],{"type":29,"value":1476},"utf8;\n",{"type":23,"tag":334,"props":1478,"children":1480},{"class":336,"line":1479},16,[1481],{"type":23,"tag":334,"props":1482,"children":1483},{"emptyLinePlaceholder":1047},[1484],{"type":29,"value":1050},{"type":23,"tag":334,"props":1486,"children":1488},{"class":336,"line":1487},17,[1489,1494,1499],{"type":23,"tag":334,"props":1490,"children":1491},{"style":1038},[1492],{"type":29,"value":1493},"# 插入 ",{"type":23,"tag":334,"props":1495,"children":1496},{"style":357},[1497],{"type":29,"value":1498},"4",{"type":23,"tag":334,"props":1500,"children":1501},{"style":1038},[1502],{"type":29,"value":1503}," 条测试数据\n",{"type":23,"tag":334,"props":1505,"children":1507},{"class":336,"line":1506},18,[1508,1513,1518,1523,1527,1532,1537,1542,1546,1551,1555,1560,1564,1569,1573,1578,1582,1587,1591,1596,1600,1605,1609,1614],{"type":23,"tag":334,"props":1509,"children":1510},{"style":1032},[1511],{"type":29,"value":1512},"insert into",{"type":23,"tag":334,"props":1514,"children":1515},{"style":1038},[1516],{"type":29,"value":1517}," omneo ",{"type":23,"tag":334,"props":1519,"children":1520},{"style":1032},[1521],{"type":29,"value":1522},"values",{"type":23,"tag":334,"props":1524,"children":1525},{"style":1038},[1526],{"type":29,"value":1116},{"type":23,"tag":334,"props":1528,"children":1529},{"style":357},[1530],{"type":29,"value":1531},"1",{"type":23,"tag":334,"props":1533,"children":1534},{"style":1038},[1535],{"type":29,"value":1536},",",{"type":23,"tag":334,"props":1538,"children":1539},{"style":347},[1540],{"type":29,"value":1541},"\"0049683542a7-5bdb-d564-3133-276ae3ce\"",{"type":23,"tag":334,"props":1543,"children":1544},{"style":1038},[1545],{"type":29,"value":1536},{"type":23,"tag":334,"props":1547,"children":1548},{"style":347},[1549],{"type":29,"value":1550},"\"Maurice\"",{"type":23,"tag":334,"props":1552,"children":1553},{"style":1038},[1554],{"type":29,"value":1536},{"type":23,"tag":334,"props":1556,"children":1557},{"style":347},[1558],{"type":29,"value":1559},"\"Samuel\"",{"type":23,"tag":334,"props":1561,"children":1562},{"style":1038},[1563],{"type":29,"value":1536},{"type":23,"tag":334,"props":1565,"children":1566},{"style":347},[1567],{"type":29,"value":1568},"\"01\u002F11\u002F1977\"",{"type":23,"tag":334,"props":1570,"children":1571},{"style":1038},[1572],{"type":29,"value":1536},{"type":23,"tag":334,"props":1574,"children":1575},{"style":347},[1576],{"type":29,"value":1577},"\"H2M2V5\"",{"type":23,"tag":334,"props":1579,"children":1580},{"style":1038},[1581],{"type":29,"value":1536},{"type":23,"tag":334,"props":1583,"children":1584},{"style":347},[1585],{"type":29,"value":1586},"\"Ballancourt\"",{"type":23,"tag":334,"props":1588,"children":1589},{"style":1038},[1590],{"type":29,"value":1536},{"type":23,"tag":334,"props":1592,"children":1593},{"style":347},[1594],{"type":29,"value":1595},"\"male\"",{"type":23,"tag":334,"props":1597,"children":1598},{"style":1038},[1599],{"type":29,"value":1536},{"type":23,"tag":334,"props":1601,"children":1602},{"style":347},[1603],{"type":29,"value":1604},"\"en couple\"",{"type":23,"tag":334,"props":1606,"children":1607},{"style":1038},[1608],{"type":29,"value":1536},{"type":23,"tag":334,"props":1610,"children":1611},{"style":347},[1612],{"type":29,"value":1613},"\"2020-05-09 11:01:54\"",{"type":23,"tag":334,"props":1615,"children":1616},{"style":1038},[1617],{"type":29,"value":1618},");\n",{"type":23,"tag":334,"props":1620,"children":1622},{"class":336,"line":1621},19,[1623,1627,1631,1635,1639,1644,1648,1653,1657,1662,1666,1671,1675,1680,1684,1689,1693,1698,1702,1707,1711,1716,1720,1724],{"type":23,"tag":334,"props":1624,"children":1625},{"style":1032},[1626],{"type":29,"value":1512},{"type":23,"tag":334,"props":1628,"children":1629},{"style":1038},[1630],{"type":29,"value":1517},{"type":23,"tag":334,"props":1632,"children":1633},{"style":1032},[1634],{"type":29,"value":1522},{"type":23,"tag":334,"props":1636,"children":1637},{"style":1038},[1638],{"type":29,"value":1116},{"type":23,"tag":334,"props":1640,"children":1641},{"style":357},[1642],{"type":29,"value":1643},"2",{"type":23,"tag":334,"props":1645,"children":1646},{"style":1038},[1647],{"type":29,"value":1536},{"type":23,"tag":334,"props":1649,"children":1650},{"style":347},[1651],{"type":29,"value":1652},"\"8338623542a7-5bdb-d564-3133-276ae3ce\"",{"type":23,"tag":334,"props":1654,"children":1655},{"style":1038},[1656],{"type":29,"value":1536},{"type":23,"tag":334,"props":1658,"children":1659},{"style":347},[1660],{"type":29,"value":1661},"\"Gauthier\"",{"type":23,"tag":334,"props":1663,"children":1664},{"style":1038},[1665],{"type":29,"value":1536},{"type":23,"tag":334,"props":1667,"children":1668},{"style":347},[1669],{"type":29,"value":1670},"\"Garbuet\"",{"type":23,"tag":334,"props":1672,"children":1673},{"style":1038},[1674],{"type":29,"value":1536},{"type":23,"tag":334,"props":1676,"children":1677},{"style":347},[1678],{"type":29,"value":1679},"\"23\u002F05\u002F1965\"",{"type":23,"tag":334,"props":1681,"children":1682},{"style":1038},[1683],{"type":29,"value":1536},{"type":23,"tag":334,"props":1685,"children":1686},{"style":347},[1687],{"type":29,"value":1688},"\"05274\"",{"type":23,"tag":334,"props":1690,"children":1691},{"style":1038},[1692],{"type":29,"value":1536},{"type":23,"tag":334,"props":1694,"children":1695},{"style":347},[1696],{"type":29,"value":1697},"\"Cocagne\"",{"type":23,"tag":334,"props":1699,"children":1700},{"style":1038},[1701],{"type":29,"value":1536},{"type":23,"tag":334,"props":1703,"children":1704},{"style":347},[1705],{"type":29,"value":1706},"\"female\"",{"type":23,"tag":334,"props":1708,"children":1709},{"style":1038},[1710],{"type":29,"value":1536},{"type":23,"tag":334,"props":1712,"children":1713},{"style":347},[1714],{"type":29,"value":1715},"\"maried\"",{"type":23,"tag":334,"props":1717,"children":1718},{"style":1038},[1719],{"type":29,"value":1536},{"type":23,"tag":334,"props":1721,"children":1722},{"style":347},[1723],{"type":29,"value":1613},{"type":23,"tag":334,"props":1725,"children":1726},{"style":1038},[1727],{"type":29,"value":1618},{"type":23,"tag":334,"props":1729,"children":1731},{"class":336,"line":1730},20,[1732,1736,1740,1744,1748,1753,1757,1762,1766,1770,1774,1778,1782,1786,1790,1795,1799,1804,1808,1812,1816,1820,1824,1828],{"type":23,"tag":334,"props":1733,"children":1734},{"style":1032},[1735],{"type":29,"value":1512},{"type":23,"tag":334,"props":1737,"children":1738},{"style":1038},[1739],{"type":29,"value":1517},{"type":23,"tag":334,"props":1741,"children":1742},{"style":1032},[1743],{"type":29,"value":1522},{"type":23,"tag":334,"props":1745,"children":1746},{"style":1038},[1747],{"type":29,"value":1116},{"type":23,"tag":334,"props":1749,"children":1750},{"style":357},[1751],{"type":29,"value":1752},"3",{"type":23,"tag":334,"props":1754,"children":1755},{"style":1038},[1756],{"type":29,"value":1536},{"type":23,"tag":334,"props":1758,"children":1759},{"style":347},[1760],{"type":29,"value":1761},"\"3374573542a7-5bdb-d564-3133-276ae3ce\"",{"type":23,"tag":334,"props":1763,"children":1764},{"style":1038},[1765],{"type":29,"value":1536},{"type":23,"tag":334,"props":1767,"children":1768},{"style":347},[1769],{"type":29,"value":1550},{"type":23,"tag":334,"props":1771,"children":1772},{"style":1038},[1773],{"type":29,"value":1536},{"type":23,"tag":334,"props":1775,"children":1776},{"style":347},[1777],{"type":29,"value":1559},{"type":23,"tag":334,"props":1779,"children":1780},{"style":1038},[1781],{"type":29,"value":1536},{"type":23,"tag":334,"props":1783,"children":1784},{"style":347},[1785],{"type":29,"value":1568},{"type":23,"tag":334,"props":1787,"children":1788},{"style":1038},[1789],{"type":29,"value":1536},{"type":23,"tag":334,"props":1791,"children":1792},{"style":347},[1793],{"type":29,"value":1794},"\"H0H0H0\"",{"type":23,"tag":334,"props":1796,"children":1797},{"style":1038},[1798],{"type":29,"value":1536},{"type":23,"tag":334,"props":1800,"children":1801},{"style":347},[1802],{"type":29,"value":1803},"\"Ottawa\"",{"type":23,"tag":334,"props":1805,"children":1806},{"style":1038},[1807],{"type":29,"value":1536},{"type":23,"tag":334,"props":1809,"children":1810},{"style":347},[1811],{"type":29,"value":1595},{"type":23,"tag":334,"props":1813,"children":1814},{"style":1038},[1815],{"type":29,"value":1536},{"type":23,"tag":334,"props":1817,"children":1818},{"style":347},[1819],{"type":29,"value":1604},{"type":23,"tag":334,"props":1821,"children":1822},{"style":1038},[1823],{"type":29,"value":1536},{"type":23,"tag":334,"props":1825,"children":1826},{"style":347},[1827],{"type":29,"value":1613},{"type":23,"tag":334,"props":1829,"children":1830},{"style":1038},[1831],{"type":29,"value":1618},{"type":23,"tag":334,"props":1833,"children":1835},{"class":336,"line":1834},21,[1836,1840,1844,1848,1852,1856,1860,1865,1869,1874,1878,1882,1886,1890,1894,1898,1902,1907,1911,1916,1920,1925,1929,1933],{"type":23,"tag":334,"props":1837,"children":1838},{"style":1032},[1839],{"type":29,"value":1512},{"type":23,"tag":334,"props":1841,"children":1842},{"style":1038},[1843],{"type":29,"value":1517},{"type":23,"tag":334,"props":1845,"children":1846},{"style":1032},[1847],{"type":29,"value":1522},{"type":23,"tag":334,"props":1849,"children":1850},{"style":1038},[1851],{"type":29,"value":1116},{"type":23,"tag":334,"props":1853,"children":1854},{"style":357},[1855],{"type":29,"value":1498},{"type":23,"tag":334,"props":1857,"children":1858},{"style":1038},[1859],{"type":29,"value":1536},{"type":23,"tag":334,"props":1861,"children":1862},{"style":347},[1863],{"type":29,"value":1864},"\"5494133542a7-5bdb-d564-3133-276ae3ce\"",{"type":23,"tag":334,"props":1866,"children":1867},{"style":1038},[1868],{"type":29,"value":1536},{"type":23,"tag":334,"props":1870,"children":1871},{"style":347},[1872],{"type":29,"value":1873},"\"Nicole\"",{"type":23,"tag":334,"props":1875,"children":1876},{"style":1038},[1877],{"type":29,"value":1536},{"type":23,"tag":334,"props":1879,"children":1880},{"style":347},[1881],{"type":29,"value":1670},{"type":23,"tag":334,"props":1883,"children":1884},{"style":1038},[1885],{"type":29,"value":1536},{"type":23,"tag":334,"props":1887,"children":1888},{"style":347},[1889],{"type":29,"value":1568},{"type":23,"tag":334,"props":1891,"children":1892},{"style":1038},[1893],{"type":29,"value":1536},{"type":23,"tag":334,"props":1895,"children":1896},{"style":347},[1897],{"type":29,"value":1794},{"type":23,"tag":334,"props":1899,"children":1900},{"style":1038},[1901],{"type":29,"value":1536},{"type":23,"tag":334,"props":1903,"children":1904},{"style":347},[1905],{"type":29,"value":1906},"\"Maugio\"",{"type":23,"tag":334,"props":1908,"children":1909},{"style":1038},[1910],{"type":29,"value":1536},{"type":23,"tag":334,"props":1912,"children":1913},{"style":347},[1914],{"type":29,"value":1915},"\"unknown\"",{"type":23,"tag":334,"props":1917,"children":1918},{"style":1038},[1919],{"type":29,"value":1536},{"type":23,"tag":334,"props":1921,"children":1922},{"style":347},[1923],{"type":29,"value":1924},"\"single\"",{"type":23,"tag":334,"props":1926,"children":1927},{"style":1038},[1928],{"type":29,"value":1536},{"type":23,"tag":334,"props":1930,"children":1931},{"style":347},[1932],{"type":29,"value":1613},{"type":23,"tag":334,"props":1934,"children":1935},{"style":1038},[1936],{"type":29,"value":1618},{"type":23,"tag":334,"props":1938,"children":1940},{"class":336,"line":1939},22,[1941],{"type":23,"tag":334,"props":1942,"children":1943},{"emptyLinePlaceholder":1047},[1944],{"type":29,"value":1050},{"type":23,"tag":334,"props":1946,"children":1948},{"class":336,"line":1947},23,[1949],{"type":23,"tag":334,"props":1950,"children":1951},{"style":1038},[1952],{"type":29,"value":1953},"# 更新测试数据\n",{"type":23,"tag":334,"props":1955,"children":1957},{"class":336,"line":1956},24,[1958,1963,1967,1972,1977,1981,1986,1991,1995,2000,2005,2010,2015,2019,2023,2027,2031],{"type":23,"tag":334,"props":1959,"children":1960},{"style":1032},[1961],{"type":29,"value":1962},"update",{"type":23,"tag":334,"props":1964,"children":1965},{"style":1038},[1966],{"type":29,"value":1517},{"type":23,"tag":334,"props":1968,"children":1969},{"style":1032},[1970],{"type":29,"value":1971},"set",{"type":23,"tag":334,"props":1973,"children":1974},{"style":1038},[1975],{"type":29,"value":1976}," firstname ",{"type":23,"tag":334,"props":1978,"children":1979},{"style":1032},[1980],{"type":29,"value":1453},{"type":23,"tag":334,"props":1982,"children":1983},{"style":347},[1984],{"type":29,"value":1985}," \"world\"",{"type":23,"tag":334,"props":1987,"children":1988},{"style":1038},[1989],{"type":29,"value":1990}," ,commenttime",{"type":23,"tag":334,"props":1992,"children":1993},{"style":1032},[1994],{"type":29,"value":1453},{"type":23,"tag":334,"props":1996,"children":1997},{"style":347},[1998],{"type":29,"value":1999},"\"2020-12-20 15:55:10\"",{"type":23,"tag":334,"props":2001,"children":2002},{"style":1032},[2003],{"type":29,"value":2004}," where",{"type":23,"tag":334,"props":2006,"children":2007},{"style":1038},[2008],{"type":29,"value":2009}," pid ",{"type":23,"tag":334,"props":2011,"children":2012},{"style":1032},[2013],{"type":29,"value":2014},"in",{"type":23,"tag":334,"props":2016,"children":2017},{"style":1038},[2018],{"type":29,"value":1116},{"type":23,"tag":334,"props":2020,"children":2021},{"style":357},[2022],{"type":29,"value":1643},{"type":23,"tag":334,"props":2024,"children":2025},{"style":1038},[2026],{"type":29,"value":1536},{"type":23,"tag":334,"props":2028,"children":2029},{"style":357},[2030],{"type":29,"value":1498},{"type":23,"tag":334,"props":2032,"children":2033},{"style":1038},[2034],{"type":29,"value":1618},{"type":23,"tag":334,"props":2036,"children":2038},{"class":336,"line":2037},25,[2039],{"type":23,"tag":334,"props":2040,"children":2041},{"style":1038},[2042],{"type":29,"value":2043},"# 删除测试数据\n",{"type":23,"tag":334,"props":2045,"children":2047},{"class":336,"line":2046},26,[2048,2053,2058,2062,2067,2071,2075,2080],{"type":23,"tag":334,"props":2049,"children":2050},{"style":1032},[2051],{"type":29,"value":2052},"delete",{"type":23,"tag":334,"props":2054,"children":2055},{"style":1032},[2056],{"type":29,"value":2057}," from",{"type":23,"tag":334,"props":2059,"children":2060},{"style":1038},[2061],{"type":29,"value":1517},{"type":23,"tag":334,"props":2063,"children":2064},{"style":1032},[2065],{"type":29,"value":2066},"where",{"type":23,"tag":334,"props":2068,"children":2069},{"style":1038},[2070],{"type":29,"value":2009},{"type":23,"tag":334,"props":2072,"children":2073},{"style":1032},[2074],{"type":29,"value":1453},{"type":23,"tag":334,"props":2076,"children":2077},{"style":357},[2078],{"type":29,"value":2079}," 1",{"type":23,"tag":334,"props":2081,"children":2082},{"style":1038},[2083],{"type":29,"value":2084},";\n",{"type":23,"tag":31,"props":2086,"children":2087},{},[2088],{"type":23,"tag":40,"props":2089,"children":2091},{"alt":7,"src":2090},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-d113eca607421a19.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F1200\u002Fformat\u002Fwebp",[],{"type":23,"tag":31,"props":2093,"children":2094},{},[2095,2097,2102,2104,2109,2110,2115,2117,2123,2125,2130,2132,2137],{"type":29,"value":2096},"可见 ",{"type":23,"tag":64,"props":2098,"children":2100},{"className":2099},[],[2101],{"type":29,"value":15},{"type":29,"value":2103}," 的名为 ",{"type":23,"tag":64,"props":2105,"children":2107},{"className":2106},[],[2108],{"type":29,"value":893},{"type":29,"value":143},{"type":23,"tag":64,"props":2111,"children":2113},{"className":2112},[],[2114],{"type":29,"value":864},{"type":29,"value":2116}," 已经写入了对应的结构化 ",{"type":23,"tag":64,"props":2118,"children":2120},{"className":2119},[],[2121],{"type":29,"value":2122},"binlog",{"type":29,"value":2124}," 事件数据，可以编写消费者监听 ",{"type":23,"tag":64,"props":2126,"children":2128},{"className":2127},[],[2129],{"type":29,"value":15},{"type":29,"value":2131}," 对应的 ",{"type":23,"tag":64,"props":2133,"children":2135},{"className":2134},[],[2136],{"type":29,"value":864},{"type":29,"value":2138}," 然后对获取到的数据进行后续处理。",{"type":23,"tag":24,"props":2140,"children":2142},{"id":2141},"总结",[2143],{"type":29,"value":2141},{"type":23,"tag":31,"props":2145,"children":2146},{},[2147,2149,2154,2156,2161,2163,2169],{"type":29,"value":2148},"这篇文章大部分篇幅用于介绍其他中间件是怎么部署的，这个问题侧面说明了 ",{"type":23,"tag":64,"props":2150,"children":2152},{"className":2151},[],[2153],{"type":29,"value":14},{"type":29,"value":2155}," 本身部署并不复杂，它的配置文件属性项比较多，但是实际上需要自定义和改动的配置项是比较少的，也就是说明了它的运维成本和学习成本并不高。后面会分析基于结构化 ",{"type":23,"tag":64,"props":2157,"children":2159},{"className":2158},[],[2160],{"type":29,"value":2122},{"type":29,"value":2162}," 事件做 ",{"type":23,"tag":64,"props":2164,"children":2166},{"className":2165},[],[2167],{"type":29,"value":2168},"ELT",{"type":29,"value":2170}," 和持久化相关工作以及Canal的生产环境可用级别HA集群的搭建。",{"type":23,"tag":31,"props":2172,"children":2173},{},[2174],{"type":29,"value":2175},"参考资料：",{"type":23,"tag":85,"props":2177,"children":2178},{},[2179,2191],{"type":23,"tag":89,"props":2180,"children":2181},{},[2182],{"type":23,"tag":2183,"props":2184,"children":2188},"a",{"href":2185,"rel":2186},"https:\u002F\u002Fdev.mysql.com\u002Fdoc\u002Fmysql-yum-repo-quick-guide\u002Fen\u002F",[2187],"nofollow",[2189],{"type":29,"value":2190},"A Quick Guide to Using the MySQL Yum Repository",{"type":23,"tag":89,"props":2192,"children":2193},{},[2194],{"type":23,"tag":2183,"props":2195,"children":2198},{"href":2196,"rel":2197},"https:\u002F\u002Fgithub.com\u002Falibaba\u002Fcanal",[2187],[2199],{"type":29,"value":14},{"type":23,"tag":2201,"props":2202,"children":2203},"style",{},[2204],{"type":29,"value":2205},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":7,"searchDepth":367,"depth":367,"links":2207},[2208,2209,2210,2211,2212,2213,2217,2218,2219,2220],{"id":26,"depth":353,"text":26},{"id":51,"depth":353,"text":54},{"id":57,"depth":353,"text":57},{"id":116,"depth":353,"text":116},{"id":218,"depth":353,"text":218},{"id":256,"depth":353,"text":259,"children":2214},[2215,2216],{"id":263,"depth":367,"text":266},{"id":274,"depth":367,"text":277},{"id":285,"depth":353,"text":288},{"id":296,"depth":353,"text":299},{"id":307,"depth":353,"text":310},{"id":2141,"depth":353,"text":2141},"markdown","content:blog:2020-05-12-canal-kafka-mysql.md","content","blog\u002F2020-05-12-canal-kafka-mysql.md","blog\u002F2020-05-12-canal-kafka-mysql","md",[2228,2231],{"_path":2229,"title":2230},"\u002Fblog\u002F2022-09-25-flink-memory-model","Flink内存模型的思考",{"_path":2232,"title":2233},"\u002Fblog\u002F2020-05-12-centos-mysql57","Centos 7.3 安装 MySQL 5.7",1796523532993]