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

yinxiu d2f98cda87 remove duplicate code 9 years ago
client 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
common 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
dbsync 44f2b74862 fixed issue #130 , support mysql5.6 time2/timestamp2/datetime2 javaType 9 years ago
deployer 9164fe4ca7 make canal server become a single instance 9 years ago
driver 197a1446b7 fix not skip filter and read the error data 10 years ago
example b16f4844a1 fixed a hard coded mysql host ip address 10 years ago
filter 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
instance ed74d934d3 add setAlarmHandler for otter 9 years ago
meta 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
parse d2f98cda87 remove duplicate code 9 years ago
protocol 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
server 7b29828f60 add AbstractCanalInstance and remove duplicate code 9 years ago
sink 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
store 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago
.gitignore a0defe575b init 10 years ago
LICENSE.txt a0defe575b init 10 years ago
README.md 4459b8acdf Update README.md 10 years ago
RELEASE.txt a0defe575b init 10 years ago
codeformat.xml 7ebb3fd1ab fixed code template and format 10 years ago
codetemplates.xml 7ebb3fd1ab fixed code template and format 10 years ago
pom.xml 9956b3557f [maven-release-plugin] prepare for next development iteration 10 years ago

README.md

<div class="iteye-blog-content-contain">

最新更新

  1. canal QQ讨论群已经建立,群号:161559791 ,欢迎加入进行技术讨论。
  2. canal消费端项目开源: Otter(分布式数据库同步系统),地址:https://github.com/alibaba/otter

背景

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

ps. 目前内部版本已经支持mysql和oracle部分版本的日志解析,当前的canal开源版本支持5.6及以下的版本(阿里内部mysql 5.6.10, mysql 5.5.18和5.1.40/48)

基于日志增量订阅&消费支持的业务:

  1. 数据库镜像
  2. 数据库实时备份
  3. 多级索引 (卖家和买家各自分库索引)
  4. search build
  5. 业务cache刷新
  6. 价格变化等重要业务消息

项目介绍

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

译意: 水道/管道/沟渠

语言: 纯java开发

定位: 基于数据库增量日志解析,提供增量数据订阅&消费,目前主要支持了mysql

关键词: mysql binlog parser / real-time / queue&topic

工作原理

mysql主备复制实现


从上层来看,复制分成三步:

  1. master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,binary log events,可以通过show binlog events进行查看);
  2. slave将master的binary log events拷贝到它的中继日志(relay log);
  3. slave重做中继日志中的事件,将改变反映它自己的数据。

canal的工作原理:

原理相对比较简单:

  1. canal模拟mysql slave的交互协议,伪装自己为mysql slave,向mysql master发送dump协议
  2. mysql master收到dump请求,开始推送binary log给slave(也就是canal)
  3. canal解析binary log对象(原始为byte流)

相关文档

See the wiki page for : wiki文档

wiki文档列表

相关资料:

问题反馈

  1. qq交流群: 161559791
  2. 邮件交流: jianghang115@gmail.com
  3. 新浪微博: agapple0002
  4. 报告issue:issues