阿里开源的MySQL 数据库增量日志解析,提供增量数据订阅和消费。

agapple 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
.github df86f94409 fixed issue template il y a 6 ans
.mvn e7b81cd83a fixed mvn wrapper il y a 6 ans
canal-admin 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
client 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
client-adapter e376a129ed fixed canal-admin vue il y a 5 ans
common 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
dbsync 7b245c5a64 fix #1762 (#1959) il y a 5 ans
deployer 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
docker 46b6528273 fixed tablemeta check il y a 6 ans
driver 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
example 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
filter fadfe1d6ca [maven-release-plugin] prepare for next development iteration il y a 6 ans
images 5588da59b9 Update response time image. il y a 6 ans
instance 8728beb4b6 fixed compile il y a 5 ans
meta 8cb85753bb open the switch to get codecov test coverage (#1671) il y a 6 ans
parse bd974e3da8 upgrade fastjson 1.2.58 il y a 5 ans
prometheus fadfe1d6ca [maven-release-plugin] prepare for next development iteration il y a 6 ans
protocol 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
server 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
sink f04e742f4f #1897 , fix DummyEventStore implements new method (#1932) il y a 5 ans
store bd974e3da8 upgrade fastjson 1.2.58 il y a 5 ans
.codecov.yml 8cb85753bb open the switch to get codecov test coverage (#1671) il y a 6 ans
.gitignore 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator il y a 5 ans
.travis.yml be9813142f remove openjdk12 il y a 5 ans
LICENSE.txt a0defe575b init il y a 10 ans
README.md 8b54b9e596 add python client info il y a 5 ans
RELEASE.txt a0defe575b init il y a 10 ans
codeformat.xml 7ebb3fd1ab fixed code template and format il y a 10 ans
codetemplates.xml 7ebb3fd1ab fixed code template and format il y a 10 ans
logo.png 3b9ff26d1a add logo il y a 6 ans
mvnw 2810e7e815 add mvnw il y a 6 ans
pom.xml bd974e3da8 upgrade fastjson 1.2.58 il y a 5 ans

README.md

build status codecov maven license average time to resolve an issue percentage of issues still open

背景

早期,阿里巴巴 B2B 公司因为存在杭州和美国双机房部署,存在跨机房同步的业务需求 ,主要是基于trigger的方式获取增量变更。从 2010 年开始,公司开始逐步尝试数据库日志解析,获取增量变更进行同步,由此衍生出了增量订阅和消费业务,从此开启一段新纪元。

当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x

基于日志增量订阅和消费的业务包括

  • 数据库镜像
  • 数据库实时备份
  • 索引构建和实时维护(拆分异构索引、倒排索引等)
  • 业务 cache 刷新
  • 带业务逻辑的增量数据处理

项目介绍

名称:canal [kə'næl]

译意: 水道/管道/沟渠

产品定位: 基于数据库增量日志解析,提供增量数据订阅和消费

关键词: MySQL binlog parser / real-time / queue&topic / index build

工作原理

MySQL主备复制原理

  • MySQL master 将数据变更写入二进制日志( binary log, 其中记录叫做二进制日志事件binary log events,可以通过 show binlog events 进行查看)
  • MySQL slave 将 master 的 binary log events 拷贝到它的中继日志(relay log)
  • MySQL slave 重放 relay log 中事件,将数据变更反映它自己的数据

canal 工作原理

  • canal 模拟 MySQL slave 的交互协议,伪装自己为 MySQL slave ,向 MySQL master 发送dump 协议
  • MySQL master 收到 dump 请求,开始推送 binary log 给 slave (即 canal )
  • canal 解析 binary log 对象(原始为 byte 流)

重要版本更新说明

canal 1.1.x 版本(release_note),性能与功能层面有较大的突破,重要提升包括:

文档

多语言

canal 特别设计了 client-server 模式,交互协议使用 protobuf 3.0 , client 端可采用不同语言实现不同的消费逻辑,欢迎大家提交 pull request

canal 作为 MySQL binlog 增量获取和解析工具,可将变更记录投递到 MQ 系统中,比如 Kafka/RocketMQ,可以借助于 MQ 的多语言能力

相关开源

问题反馈

其他资料