{"id":13458820,"url":"https://github.com/alibaba/canal","last_synced_at":"2025-05-12T17:45:53.109Z","repository":{"id":6350421,"uuid":"7587038","full_name":"alibaba/canal","owner":"alibaba","description":"阿里巴巴 MySQL binlog 增量订阅\u0026消费组件 ","archived":false,"fork":false,"pushed_at":"2025-03-19T07:51:32.000Z","size":24135,"stargazers_count":29048,"open_issues_count":1197,"forks_count":7661,"subscribers_count":1176,"default_branch":"master","last_synced_at":"2025-05-05T15:11:27.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alibaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-01-13T10:59:52.000Z","updated_at":"2025-05-05T14:32:10.000Z","dependencies_parsed_at":"2025-04-15T19:35:53.409Z","dependency_job_id":null,"html_url":"https://github.com/alibaba/canal","commit_stats":{"total_commits":1281,"total_committers":230,"mean_commits":5.569565217391304,"dds":0.7462919594067134,"last_synced_commit":"d457cd835ec431d48eced5d8e7c372ebd79a11ce"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fcanal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fcanal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fcanal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alibaba%2Fcanal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alibaba","download_url":"https://codeload.github.com/alibaba/canal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253789811,"owners_count":21964749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T09:00:57.792Z","updated_at":"2025-05-12T17:45:52.349Z","avatar_url":"https://github.com/alibaba.png","language":"Java","readme":"[![build status](https://travis-ci.com/alibaba/canal.svg?branch=master)](https://travis-ci.com/alibaba/canal)\n[![codecov](https://codecov.io/gh/alibaba/canal/branch/master/graph/badge.svg)](https://codecov.io/gh/alibaba/canal)\n![maven](https://img.shields.io/maven-central/v/com.alibaba.otter/canal.svg)\n![license](https://img.shields.io/github/license/alibaba/canal.svg)\n[![average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/canal.svg)](http://isitmaintained.com/project/alibaba/canal \"average time to resolve an issue\")\n[![percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/canal.svg)](http://isitmaintained.com/project/alibaba/canal \"percentage of issues still open\")\n[![Leaderboard](https://img.shields.io/badge/Canal-%E6%9F%A5%E7%9C%8B%E8%B4%A1%E7%8C%AE%E6%8E%92%E8%A1%8C%E6%A6%9C-orange)](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=canal)\n\n\n## 简介\n\n![](https://img-blog.csdnimg.cn/20191104101735947.png)\n\n**canal [kə'næl]**，译意为水道/管道/沟渠，主要用途是基于 MySQL 数据库增量日志解析，提供增量数据订阅和消费\n\n早期阿里巴巴因为杭州和美国双机房部署，存在跨机房同步的业务需求，实现方式主要是基于业务 trigger 获取增量变更。从 2010 年开始，业务逐步尝试数据库日志解析获取增量变更进行同步，由此衍生出了大量的数据库增量订阅和消费业务。\n\n基于日志增量订阅和消费的业务包括\n- 数据库镜像\n- 数据库实时备份\n- 索引构建和实时维护(拆分异构索引、倒排索引等)\n- 业务 cache 刷新\n- 带业务逻辑的增量数据处理\n\n当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x\n\n## 工作原理\n\n#### MySQL主备复制原理\n![](http://dl.iteye.com/upload/attachment/0080/3086/468c1a14-e7ad-3290-9d3d-44ac501a7227.jpg)\n\n- MySQL master 将数据变更写入二进制日志( binary log, 其中记录叫做二进制日志事件binary log events，可以通过 show binlog events 进行查看)\n- MySQL slave 将 master 的 binary log events 拷贝到它的中继日志(relay log)\n- MySQL slave 重放 relay log 中事件，将数据变更反映它自己的数据\n\n#### canal 工作原理\n\n- canal 模拟 MySQL slave 的交互协议，伪装自己为 MySQL slave ，向 MySQL master 发送dump 协议\n- MySQL master 收到 dump 请求，开始推送 binary log 给 slave (即 canal )\n- canal 解析 binary log 对象(原始为 byte 流)\n\n## 重要版本更新说明\n\n1. canal 1.1.x 版本（[release_note](https://github.com/alibaba/canal/releases)）,性能与功能层面有较大的突破,重要提升包括:\n\n- 整体性能测试\u0026优化,提升了150%. #726 参考: [Performance](https://github.com/alibaba/canal/wiki/Performance)\n- 原生支持prometheus监控 #765 [Prometheus QuickStart](https://github.com/alibaba/canal/wiki/Prometheus-QuickStart)\n- 原生支持kafka消息投递 #695 [Canal Kafka/RocketMQ QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart)\n- 原生支持aliyun rds的binlog订阅 (解决自动主备切换/oss binlog离线解析) 参考: [Aliyun RDS QuickStart](https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart)\n- 原生支持docker镜像 #801 参考: [Docker QuickStart](https://github.com/alibaba/canal/wiki/Docker-QuickStart)\n\n2.  canal 1.1.4版本，迎来最重要的WebUI能力，引入canal-admin工程，支持面向WebUI的canal动态管理能力，支持配置、任务、日志等在线白屏运维能力，具体文档：[Canal Admin Guide](https://github.com/alibaba/canal/wiki/Canal-Admin-Guide)\n\n## 文档\n\n- [Home](https://github.com/alibaba/canal/wiki/Home)\n- [Introduction](https://github.com/alibaba/canal/wiki/Introduction)\n- [QuickStart](https://github.com/alibaba/canal/wiki/QuickStart)\n  - [Docker QuickStart](https://github.com/alibaba/canal/wiki/Docker-QuickStart)\n  - [Canal Kafka/RocketMQ QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart\")\n  - [Aliyun RDS for MySQL QuickStart](https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart)\n  - [Prometheus QuickStart](https://github.com/alibaba/canal/wiki/Prometheus-QuickStart)\n- Canal Admin\n  - [Canal Admin QuickStart](https://github.com/alibaba/canal/wiki/Canal-Admin-QuickStart)\n  - [Canal Admin Guide](https://github.com/alibaba/canal/wiki/Canal-Admin-Guide)\n  - [Canal Admin ServerGuide](https://github.com/alibaba/canal/wiki/Canal-Admin-ServerGuide)\n  - [Canal Admin Docker](https://github.com/alibaba/canal/wiki/Canal-Admin-Docker)\n- [AdminGuide](https://github.com/alibaba/canal/wiki/AdminGuide)\n- [ClientExample](https://github.com/alibaba/canal/wiki/ClientExample)\n- [ClientAPI](https://github.com/alibaba/canal/wiki/ClientAPI)\n- [Performance](https://github.com/alibaba/canal/wiki/Performance)\n- [DevGuide](https://github.com/alibaba/canal/wiki/DevGuide)\n- [BinlogChange(MySQL 5.6)](https://github.com/alibaba/canal/wiki/BinlogChange%28mysql5.6%29)\n- [BinlogChange(MariaDB)](https://github.com/alibaba/canal/wiki/BinlogChange%28MariaDB%29)\n- [TableMetaTSDB](https://github.com/alibaba/canal/wiki/TableMetaTSDB)\n- [ReleaseNotes](http://alibaba.github.com/canal/release.html)\n- [Download](https://github.com/alibaba/canal/releases)\n- [FAQ](https://github.com/alibaba/canal/wiki/FAQ)\n\n## 多语言\n\ncanal 特别设计了 client-server 模式，交互协议使用 protobuf 3.0 , client 端可采用不同语言实现不同的消费逻辑，欢迎大家提交 pull request \n  \n- canal java 客户端: [https://github.com/alibaba/canal/wiki/ClientExample](https://github.com/alibaba/canal/wiki/ClientExample)\n- canal c# 客户端: [https://github.com/dotnetcore/CanalSharp](https://github.com/dotnetcore/CanalSharp)\n- canal go客户端: [https://github.com/CanalClient/canal-go](https://github.com/CanalClient/canal-go)\n- canal php客户端: [https://github.com/xingwenge/canal-php](https://github.com/xingwenge/canal-php)\n- canal Python客户端：[https://github.com/haozi3156666/canal-python](https://github.com/haozi3156666/canal-python)\n- canal Rust客户端：[https://github.com/laohanlinux/canal-rs](https://github.com/laohanlinux/canal-rs)\n- canal Nodejs客户端：[https://github.com/marmot-z/canal-nodejs](https://github.com/marmot-z/canal-nodejs)\n\ncanal 作为 MySQL binlog 增量获取和解析工具，可将变更记录投递到 MQ 系统中，比如 Kafka/RocketMQ，可以借助于 MQ 的多语言能力 \n\n- 参考文档: [Canal Kafka/RocketMQ QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart)\n\n## 基于canal开发的工具\n\n-  canal2sql(基于binlog生成SQL) : [https://github.com/zhuchao941/canal2sql]\n\n## 相关开源\u0026产品\n\n- [canal 消费端开源项目: Otter](http://github.com/alibaba/otter)\n- [阿里巴巴去 Oracle 数据迁移同步工具: yugong](http://github.com/alibaba/yugong)\n- [阿里巴巴离线同步开源项目 DataX](https://github.com/alibaba/datax)\n- [阿里巴巴数据库连接池开源项目 Druid](https://github.com/alibaba/druid)\n- [阿里巴巴实时数据同步工具 DTS](https://www.aliyun.com/product/dts)\n\n## 问题反馈\n- 报告 issue: [github issues](https://github.com/alibaba/canal/issues)\n\n本项目的Issues会被同步沉淀至[阿里云开发者社区](https://developer.aliyun.com/ask)\n","funding_links":[],"categories":["Java","Uncategorized","数据库、分布存储相关","Software/System","数据管道","中间件","数据库中间件","Change Data Capture (CDC)"],"sub_categories":["Uncategorized","Develop","Materialize"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fcanal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falibaba%2Fcanal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falibaba%2Fcanal/lists"}