Why?

关系型数据库仍然作为主要的primary data store的方案 
Relational Databases have been around for a long time and have become a trusted storage medium for all of a company's data. 
传统的数据仓库的ETL和OLAP方案 
Data is pulled off this primary data store, transformed, and then stored in a secondary data store, such as a data warehouse. 
The industry typically uses ETL to run nightly jobs to give executives a view of the previous day's, week's, month's, year's business performance.

OLTP (Online Transaction Processing) vs. OLAP (Online Analytic Processing) : 
This differentiates between their uses -- OLTP for primary data serving, OLAP for analytic processing of a modified copy of the primary data.

BUT, 近来产生大量near-real-time data needs 
At LinkedIn, it also feeds real-time search indexes, real-time network graph indexes, cache coherency, Database Read Replicas, etc... These are examples of LinkedIn's near-real-time data needs.

对于这样的需求, ETL和OLAP无法满足实时性 
我们讨论的是, 怎么把数据从Primay data store以near-real-time搬到另一个地方处理的问题?

How?

Linkedin Databus, 可以让变更事件的延长达到微秒级,每台服务器每秒可以处理数千次数据吞吐变更事件,同时还支持无限回溯能力和丰富的变更订阅功能

如何获取变更?

处理这种需求有两种常用方式:

应用驱动双向写:这种模式下,应用层同时向数据库和另一个消息系统发起写操作。这种实现看起来简单,因为可以控制向数据库写的应用代码。但是,它会引入一致性问题,因为没有复杂的协调协议(比如两阶段提交协议或者paxos算法),所以当出现问题时,很难保证数据库和消息系统完全处于相同的锁定状态。两个系统需要精确完成同样的写操作,并以同样的顺序完成序列化。如果写操作是有条件的或是有部分更新的语义,那么事情就会变得更麻烦。

数据库日志挖掘:将数据库作为唯一真实数据来源,并将变更从事务或提交日志中提取出来。这可以解决一致性问题,但是很难实现,因为 Oracle和MySQL这样的数据库有私有的交易日志格式和复制冗余解决方案,难以保证版本升级之后的可用性。由于要解决的是处理应用代码发起的数据变更,然后写入到另一个数据库中,冗余系统就得是用户层面的,而且要与来源无关。对于快速变化的技术公司,这种与数据来源的独立性非常重要,可以避免应用栈的技术锁定,或是绑死在二进制格式上。

如果要求不是很严格, 采用第一种方法也是可以接受的, 在存DB成功后, 再写pub-sub system

如何微秒级的传递变更?

Relays, 中继

中继就是Memory buffer, 仍然是空间换时间的策略, 如果需要速度足够快, 就需要Relay足够多, 离client足够近, 因为client从Relay memory buffer中取数据的速度是无法优化的. 如何组织Relay集群, 有如下两种方式,

Databus Relay will pull the recently committed transactions from the source Database (e.g. Oracle, MySQL, etc...) (Step 1). 
The Relay will deserialize this data into a compact form (Avro etc...) and store the result in a circular in-memory buffer.

Clients (subscribers) listening for events will pull recent online changes as they appear in the Relay (Step 2).

Bootstrap component is also listening to on-line changes as they appear in the Relay.(Step 3)

  
首先, 为了保证效率需要把变更数据转化为比较高效的格式(如Avro), 并且放到circular in-memory buffer 
然后, Client(subscribers)侦听并从Relay的memory buffer中把更新数据Pull过去, 不能使用Push模式, 因为不同的分析效率可能有很大区别. 
在Relay, 数据是放在memory buffer中的, memory是有限的, 所以采用circular方式 
问题是, 每个client的要求是不一样的, 你无法知道什么时候数据真正失效, 所以必须有方法来保存历史数据, 那就是Bootstrap

用户有两种情况会用到Bootstrap,

1. Slow client, 需要的数据在relay中已经被覆盖, 所以需要去Bootstrap里面取

 
2. New client, 需要取所有的历史数据, Bootstrap之所以得名

Databus' Bootstrap

One of the most innovative features of Databus is its Bootstrap component. 
Data Change Capture systems have existed for a long time (e.g. Oracle Streams). However, all of these systems put load on the primary data store when a consumer falls behind.

Bootstrapping a brand new consumer is another problem. It typically involves a very manual process -- i.e. restore the previous night's snapshot on a temporary Oracle instance, transform the data and transfer it to the consumer, then apply changes since the snapshot, etc...

Databus's Bootstrap component handles both of the above use-cases in a seamless, automated fashion.

Databus最具创新的是Bootstrap, 因为虽然Data Change Capture一直存在, 但是如同第一版Databus, 有个比较严重的问题是 
Relay只能buffer最新的数据, 对于老数据, Relay会作为proxy从primary data store直接取数据, 然后返回给client 
所以对于slow client, 这样会大大增加primary data store的负担.

同时对于new client, 如果需要获取全部数据, 是很麻烦的, very manual process 
而Bootstrap可以完全seamless的解决上面所有的问题, 确实算是创新

How Does Databus' Bootstrap Component Work?

Bootstrap把更新不断的读到Log storage里面, 然后再批量的导入Snapshot Storage中 
这样设计出于效率考虑, 对于Snapshot可以使用Raw Files实现, 而Log storage需要不断更新, 需要使用类似DB取实现. 

The Databus Bootstrap component is made up of 2 types of storage, 
Log Storage serves Consolidated Deltas 
Snapshot Storage serves Consistent Snapshots

1. As shown earlier, the Bootstrap component listens for online changes as they occur in the Relay. A LogWriter appends these changes to Log Storage.

2. A Log Applier applies recent operations in Log Storage to Snapshot Storage

3. If a new subscriber connects to Databus, the subscriber will bootstrap from the Bootstrap Server running inside the Bootstrap component

4. The client will first get a Consistent Snapshot from Snapshot Storage

5. The client will then get outstanding Consolidated Deltas from Log Storage

6. Once the client has caught up to within the Relay's in-memory buffer window, the client will switch to reading from the Relay

和Kafka有什么区别

Where as DataBus is used for Database change capture and replication, Kafka is used for application-level data streams

在linkedin自己的架构中, 他们的关系是这样的 
就现在状态而言, databus更侧重于DB的change capture, 并且完全基于memory应该latency更优秀些 
对于其他场景, Kafka更通用一些...

Github

https://github.com/linkedin/databus

LinkedIn: Creating a Low Latency Change Data Capture System with Databus

http://highscalability.com/blog/2012/3/19/linkedin-creating-a-low-latency-change-data-capture-system-w.html

Databus: LinkedIn's Change Data Capture Pipeline SOCC 2012

http://www.slideshare.net/ShirshankaDas/databus-socc-2012

LinkedIn Data Infrastructure (QCon London 2012)

http://www.slideshare.net/r39132/linkedin-data-infrastructure-qcon-london-2012

本文章摘自博客园,原文发布日期:2013-03-05

Linkedin Databus相关推荐

  1. linkedin databus介绍——监听数据库变化,有新数据到来时通知其他消费者app,新数据存在内存里,多份快照...

    概要结构如下图. 图中显示:Search Index和Read Replicas等系统是Databus的消费者.当主OLTP数据库发生写操作时,连接其上的中继系统会将数据拉到中继中.签入在Search ...

  2. 一款低延迟的分布式数据库同步系统--databus

    每次看到马路对面摩托罗拉的大牌子,都想起谷歌125亿美元收购摩托罗拉移动,后来又以29亿美元卖给联想的事情.谷歌所做的决策都比较考虑长远利益,在这串交易中,谷歌获得了摩托罗拉最有价值的几千项专利,稳健 ...

  3. databus mysql搭建_databus bootstrap 部署

    databus 分为 relay bootstrap-producer(bst-producer) bootstrap-server(bst-server) client,他们之间的关系可以去网上找 ...

  4. Oracle数据同步解决方案之databus

    [list][*][b]概述[/b][/list] 目前了解到基于Oracle的开源数据同步项目有yugong.databus.SymmetricDS,之前尝试了yugong,很容易上手.使用时需要注 ...

  5. DataBus(数据同步组件)

    DataBus(数据同步组件) github: https://github.com/linkedin/databus/wiki Databus是一个低延迟.可靠的.支持事务的.保持一致性的数据变更抓 ...

  6. java databus_linkedin 的 databus 部署

    1. 下载源码 复制 ojdbc.jar 到相应的文件夹 git clone https://github.com/linkedin/databus/ sandbox-repo/com/oracle/ ...

  7. Databus架构分析

    1. 简介 Databus是一个低延迟.可靠的.支持事务的.保持一致性的数据变更抓取系统.由LinkedIn于2013年开源.Databus通过挖掘数据库日志的方式,将数据库变更实时.可靠的从数据库拉 ...

  8. Databus 调研测试

    1. 简介 Databus是一个低延迟.可靠的.支持事务的.保持一致性的数据变更抓取系统.由LinkedIn于2013年开源.Databus通过挖掘数据库日志的方式,将数据库变更实时.可靠的从数据库拉 ...

  9. databus安装 for mysql

    一.前提工作 安装mysql(5.5版本),5.7的版本我试了,接收不到binlog,原因后续在排查.参看:mac用brew 安装mysql5.5 安装gradle(4.7版本).因为databus源 ...

最新文章

  1. 对java支持并发的理解_Java并发知识(1)
  2. SpringMVC 返回json的两种方式
  3. 计算机启动过程-阮一峰
  4. Hadoop 面试,来看这篇就够了
  5. Interrupted Exception异常可能没你想的那么简单!
  6. 3. 什么是icmp?icmp与ip的关系_公共关系与人际交往能力自主模式课程相关
  7. 图像检索:图像相似性度量
  8. Vmware虚拟机宕机问题处理
  9. 成为JavaGC专家Part I — 深入浅出Java垃圾回收机制
  10. 手机java jdk环境配置文件_JDK怎么安装与配置环境变量
  11. 如何利用番茄工作法提高学习和工作的效率
  12. 32位和64位操作系统及软件的区别
  13. IDE(ATA)硬盘,SATA硬盘,SCSI硬盘和SAS硬盘的比较
  14. 陀螺仪偏航角的夹角计算方法
  15. cpptraj的常用命令
  16. visio画图-----如何克服两箭头交叉变形 及 箭头自动重绘?
  17. windows下bat文件打开目录
  18. spine 导出纹理_Spine( 动画制作软件 )中文版分享
  19. 安恒信息HWS计划2021硬件冬令营 物联网安全课堂笔记 2021.1.10
  20. 图片加载框架Glide使用详解

热门文章

  1. 软件架构模式之分层模式
  2. 计算机硬件长什么样,明天电脑长啥样?看未来硬件发展趋势
  3. 工作流-bpmn流程图说明
  4. 编程语言的终结者:SL (smart language)
  5. python beep函数_Python 播放声音 音频与beep
  6. linux看目录容量,linux_查看磁盘与目录容量
  7. 事务隔离级别浅析---一致和原子的区别
  8. openwrt添加新平台支持
  9. 《工作赢在心态》读书笔记
  10. 一个简易的下拉刷新松耦合实践