GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - armandxu/canal: 阿里巴巴 MySQL binlog 增量订阅&消费组件

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

1,464 Commits
1,464 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/ISSUE_TEMPLATE
.github/ISSUE_TEMPLATE
 
 
.mvn/wrapper
.mvn/wrapper
 
 
admin
admin
 
 
client-adapter
client-adapter
 
 
client
client
 
 
common
common
 
 
connector
connector
 
 
dbsync
dbsync
 
 
deployer
deployer
 
 
docker
docker
 
 
driver
driver
 
 
example
example
 
 
filter
filter
 
 
images
images
 
 
instance
instance
 
 
meta
meta
 
 
parse
parse
 
 
prometheus
prometheus
 
 
protocol
protocol
 
 
server
server
 
 
sink
sink
 
 
store
store
 
 
.codecov.yml
.codecov.yml
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
RELEASE.txt
RELEASE.txt
 
 
codeformat.xml
codeformat.xml
 
 
codetemplates.xml
codetemplates.xml
 
 
logo.png
logo.png
 
 
mvnw
mvnw
 
 
pom.xml
pom.xml
 
 

Repository files navigation

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

简介

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 流)

重要版本更新说明

  1. 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
  1. canal 1.1.4版本,迎来最重要的WebUI能力,引入canal-admin工程,支持面向WebUI的canal动态管理能力,支持配置、任务、日志等在线白屏运维能力,具体文档:Canal Admin Guide

文档

  • Home
  • Introduction
  • QuickStart
    • Docker QuickStart
    • Canal Kafka/RocketMQ QuickStart
    • Aliyun RDS for MySQL QuickStart
    • Prometheus QuickStart
  • Canal Admin
    • Canal Admin QuickStart
    • Canal Admin Guide
    • Canal Admin ServerGuide
    • Canal Admin Docker
  • 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 作为 MySQL binlog 增量获取和解析工具,可将变更记录投递到 MQ 系统中,比如 Kafka/RocketMQ,可以借助于 MQ 的多语言能力

  • 参考文档: Canal Kafka/RocketMQ QuickStart

相关开源&产品

  • canal 消费端开源项目: Otter
  • 阿里巴巴去 Oracle 数据迁移同步工具: yugong
  • 阿里巴巴离线同步开源项目 DataX
  • 阿里巴巴数据库连接池开源项目 Druid
  • 阿里巴巴实时数据同步工具 DTS

问题反馈

  • 报告 issue: github issues

About

阿里巴巴 MySQL binlog 增量订阅&消费组件

Resources

Readme
Apache-2.0 license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.