mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
* optimize YAML config loader (#4332) * fix bug BASE TABLE as table name (#4217) * fix issues#4328 (#4329) * docs: add nodejs canal client support (#4260) Co-authored-by: zhangxunwei <zhangxunwei@dxy.cn> * fix destination not encoded (#4279) * 修复Canal指定时间戳启动失效,总是从最新的点位开始同步问题 (#4348) * 支持用户自定义的CanalAlarmHandler * RowsLogEvent增加对TableMapLogEvent判空检查,防止NPE异常 * 修复Canal指定时间戳启动失效,总是从最新的点位开始同步问题, issue: #4347 Co-authored-by: 云时 <mingya.wmy@alibaba-inc.com> * fixed 4334 , support jdk8/jdk11 * fixed issue #4266 , typo * fixed issue #4243 , support auto register for cluster = null * fixed issue #4225 , support mysql version >= 8.0.26 heartbeat v2 * fixed issue #4308 , support query_log_event for maraiadb 10.10.1 * ignore compression event * support jdk11 * support druid 1.2.12 * fixed mariadb 10.x * sync canal-template.properties * update fastjson & druid version (#4406) * 修复升级2.0.4导致兼容的问题 * update druid & fastjson version * update fastjson version * update druid & fastjson version * meta.dat文件数据丢失 (#4397) * update fastjson & druid version (#4438) * 局部变量线程安全,优先使用StringBuilder替换StringBuffer (#4472) Co-authored-by: 夏亮 <xialiang@newerabc.com> * 1. CanalController stop 需要同时将 embededCanalServer.stop (#4477) 2. ServerRunningMonitor 线程池未正常回收,线程池管理与 start/stop保持一致 * vuln-fix: Use HTTPS instead of HTTP to resolve dependencies (#4437) This fixes a security vulnerability in this project where the `build.gradle` files were configuring Gradle to resolve dependencies over HTTP instead of HTTPS. Weakness: CWE-829: Inclusion of Functionality from Untrusted Control Sphere Severity: High CVSSS: 8.1 Detection: OpenRewrite Reported-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com> Bug-tracker: https://github.com/JLLeitschuh/security-research/issues/9 Co-authored-by: Moderne <team@moderne.io> Co-authored-by: Moderne <team@moderne.io> * fix_ETL同步mysql关键字报错 (#4346) Co-authored-by: foleyang <foleyang@cogobuy.com> * optimize code * use compact BigDecimal * performance optimize , 1. cache string names 2. cache Charset * performance optimize ,cache integer/long valueof * 测试类报错 Co-authored-by: gongchangyou <gongchangyou@gmail.com> Co-authored-by: ChanaLii <316529035@qq.com> Co-authored-by: zhangxunwei <zhangxunweia@gmail.com> Co-authored-by: zhangxunwei <zhangxunwei@dxy.cn> Co-authored-by: tianpeidong <39491687+tianpeidong@users.noreply.github.com> Co-authored-by: dataccs <dataccs@163.com> Co-authored-by: 云时 <mingya.wmy@alibaba-inc.com> Co-authored-by: jianghang.loujh <jianghang.loujh@alibaba-inc.com> Co-authored-by: 温绍锦 <shaojin.wensj@alibaba-inc.com> Co-authored-by: noaso <noasoso@gmail.com> Co-authored-by: HumanPassenger <40585855+HumanPassenger@users.noreply.github.com> Co-authored-by: 夏亮 <xialiang@newerabc.com> Co-authored-by: 华仔 <591327356@qq.com> Co-authored-by: Jonathan Leitschuh <jonathan.leitschuh@gmail.com> Co-authored-by: Moderne <team@moderne.io> Co-authored-by: 杰锅不是锅 <1105568074@qq.com> Co-authored-by: foleyang <foleyang@cogobuy.com>
6.8 KiB
6.8 KiB
简介
canal [kə'næl],译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费
早期阿里巴巴因为杭州和美国双机房部署,存在跨机房同步的业务需求,实现方式主要是基于业务 trigger 获取增量变更。从 2010 年开始,业务逐步尝试数据库日志解析获取增量变更进行同步,由此衍生出了大量的数据库增量订阅和消费业务。
基于日志增量订阅和消费的业务包括
- 数据库镜像
- 数据库实时备份
- 索引构建和实时维护(拆分异构索引、倒排索引等)
- 业务 cache 刷新
- 带业务逻辑的增量数据处理
当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x
工作原理
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),性能与功能层面有较大的突破,重要提升包括:
- 整体性能测试&优化,提升了150%. #726 参考: Performance
- 原生支持prometheus监控 #765 Prometheus QuickStart
- 原生支持kafka消息投递 #695 Canal Kafka/RocketMQ QuickStart
- 原生支持aliyun rds的binlog订阅 (解决自动主备切换/oss binlog离线解析) 参考: Aliyun RDS QuickStart
- 原生支持docker镜像 #801 参考: Docker QuickStart
- canal 1.1.4版本,迎来最重要的WebUI能力,引入canal-admin工程,支持面向WebUI的canal动态管理能力,支持配置、任务、日志等在线白屏运维能力,具体文档:Canal Admin Guide
文档
- Home
- Introduction
- QuickStart
- Canal Admin
- AdminGuide
- ClientExample
- ClientAPI
- Performance
- DevGuide
- BinlogChange(MySQL 5.6)
- BinlogChange(MariaDB)
- TableMetaTSDB
- ReleaseNotes
- Download
- FAQ
多语言
canal 特别设计了 client-server 模式,交互协议使用 protobuf 3.0 , client 端可采用不同语言实现不同的消费逻辑,欢迎大家提交 pull request
- canal java 客户端: https://github.com/alibaba/canal/wiki/ClientExample
- canal c# 客户端: https://github.com/dotnetcore/CanalSharp
- canal go客户端: https://github.com/CanalClient/canal-go
- canal php客户端: https://github.com/xingwenge/canal-php
- canal Python客户端:https://github.com/haozi3156666/canal-python
- canal Rust客户端:https://github.com/laohanlinux/canal-rs
- canal Nodejs客户端:https://github.com/marmot-z/canal-nodejs
canal 作为 MySQL binlog 增量获取和解析工具,可将变更记录投递到 MQ 系统中,比如 Kafka/RocketMQ,可以借助于 MQ 的多语言能力
相关开源&产品
- canal 消费端开源项目: Otter
- 阿里巴巴去 Oracle 数据迁移同步工具: yugong
- 阿里巴巴离线同步开源项目 DataX
- 阿里巴巴数据库连接池开源项目 Druid
- 阿里巴巴实时数据同步工具 DTS
问题反馈
- 报告 issue: github issues

