关于我们为什么需要Schema Registry?

参考,

https://www.confluent.io/blog/how-i-learned-to-stop-worrying-and-love-the-schema-part-1/

https://www.confluent.io/blog/schema-registry-kafka-stream-processing-yes-virginia-you-really-need-one/

https://www.confluent.io/blog/stream-data-platform-2/

Use Avro as Your Data Format

We think Avro is the best choice for a number of reasons:

  1. It has a direct mapping to and from JSON
  2. It has a very compact format. The bulk of JSON, repeating every field name with every single record, is what makes JSON inefficient for high-volume usage.
  3. It is very fast.
  4. It has great bindings for a wide variety of programming languages so you can generate Java objects that make working with event data easier, but it does not require code generation so tools can be written generically for any data stream.
  5. It has a rich, extensible schema language defined in pure JSON
  6. It has the best notion of compatibility for evolving your data over time.

One of the critical features of Avro is the ability to define a schema for your data. For example an event that represents the sale of a product might look like this:

{"time": 1424849130111,"customer_id": 1234,"product_id": 5678,"quantity":3,"payment_type": "mastercard"
}

It might have a schema like this that defines these five fields:

{"type": "record","doc":"This event records the sale of a product","name": "ProductSaleEvent","fields" : [{"name":"time", "type":"long", "doc":"The time of the purchase"},{"name":"customer_id", "type":"long", "doc":"The customer"},{"name":"product_id", "type":"long", "doc":"The product"},{"name":"quantity", "type":"int"},{"name":"payment","type":{"type":"enum","name":"payment_types","symbols":["cash","mastercard","visa"]},"doc":"The method of payment"}]
}

Here is how these schemas will be put to use. You will associate a schema like this with each Kafka topic. You can think of the schema much like the schema of a relational database table, giving the requirements for data that is produced into the topic as well as giving instructions on how to interpret data read from the topic.

The schemas end up serving a number of critical purposes:

  1. They let the producers or consumers of data streams know the right fields are need in an event and what type each field is.
  2. They document the usage of the event and the meaning of each field in the “doc” fields.
  3. They protect downstream data consumers from malformed data, as only valid data will be permitted in the topic.

The Need For Schemas

Robustness

One of the primary advantages of this type of architecture where data is modeled as streams is that applications are decoupled.

Clarity and Semantics

Worse, the actual meaning of the data becomes obscure and often misunderstood by different applications because there is no real canonical documentation for the meaning of the fields. One person interprets a field one way and populates it accordingly and another interprets it differently.

Compatibility

Schemas also help solve one of the hardest problems in organization-wide data flow: modeling and handling change in data format. Schema definitions just capture a point in time, but your data needs to evolve with your business and with your code.

Schemas give a mechanism for reasoning about which format changes will be compatible and (hence won’t require reprocessing) and which won’t.

Schemas are a Conversation

However data streams are different; they are a broadcast channel. Unlike an application’s database, the writer of the data is, almost by definition, not the reader. And worse, there are many readers, often in different parts of the organization. These two groups of people, the writers and the readers, need a concrete way to describe the data that will be exchanged between them and schemas provide exactly this.

Schemas Eliminate The Manual Labor of Data Science

It is almost a truism that data science, which I am using as a short-hand here for “putting data to effective use”, is 80% parsing, validation, and low-level data munging.

KIP-69 - Kafka Schema Registry

pending状态,这个KIP估计会被cancel掉

因为confluent.inc已经提供相应的方案,

https://github.com/confluentinc/schema-registry

http://docs.confluent.io/3.0.1/schema-registry/docs/index.html

比较牛逼的是,有人为这个开发了UI,

https://www.landoop.com/blog/2016/08/schema-registry-ui/

本身使用,都是通过http进行Schema的读写,比较简单

设计,

参考, http://docs.confluent.io/3.0.1/schema-registry/docs/design.html

主备架构,通过zk来选主

每个schema需要一个唯一id,这个id也通过zk来保证递增

schema存在kafka的一个特殊的topic中,_schemas,一个单partition的topic

我的理解,在注册和查询schema的时候,是通过local caches进行检索的,kafka的topic可以用于replay来重建caches

Apache Kafka - Schema Registry相关推荐

  1. 【Kafka】Kafka Schema Registry 原理

    1.概述 原文:https://www.dazhuanlan.com/2019/12/10/5deec4add22d4/ Confluent 公司为了能让 Kafka 支持 Avro 序列化,创建了 ...

  2. 【Kafka】Confluent Schema Registry

    原文:https://cloud.tencent.com/developer/article/1336568 1. schema 注册表 无论是使用传统的Avro API自定义序列化类和反序列化类还是 ...

  3. Kafka 的 Confluent Schema Registry安装与使用教程

    1 .Confluent Schema Registry 安装教程 Schema Registry的各个发现行版本的下载链接 上传到linux系统进行解压安装. 本教程使用外部以安装好的Kafka集群 ...

  4. kafka Confluent Schema Registry 简单实践

    解释及目的: 使用传统的Avro API自定义序列化类和反序列化类或者使用Twitter的Bijection类库实现Avro的序列化与反序列化,这两种方法都有一个缺点:在每条Kafka记录里都嵌入了s ...

  5. kafka教程_2018年机器学习趋势与Apache Kafka生态系统结合

    kafka教程 在慕尼黑举行的OOP 2018大会上,我介绍了有关使用Apache Kafka生态系统和诸如TensorFlow,DeepLearning4J或H2O之类的深度学习框架构建可扩展,关键 ...

  6. apache kafka_2018年机器学习趋势与Apache Kafka生态系统相结合

    apache kafka 在慕尼黑举行的OOP 2018大会上,我介绍了有关使用Apache Kafka生态系统和诸如TensorFlow,DeepLearning4J或H2O之类的深度学习框架构建可 ...

  7. 2018年机器学习趋势与Apache Kafka生态系统相结合

    在慕尼黑举行的OOP 2018大会上,我介绍了有关使用Apache Kafka生态系统和诸如TensorFlow,DeepLearning4J或H2O之类的深度学习框架构建可扩展,关键任务微服务的演讲 ...

  8. Apache Kafka流+机器学习(Spark,TensorFlow,H2O.ai)

    我于2017年5月开始在Confluent工作,担任技术传播者,专注于围绕开源框架Apache Kafka的主题. 我认为机器学习是当今最热门的流行语之一,因为它可以在任何行业中增加巨大的商业价值. ...

  9. 结合Apache Kafka生态系统,谈谈2018年机器学习5大趋势

    摘要: 让我们来研究下U`ber和Netflix上的KSQL,ONNX,AutoML和机器学习平台,看看它们之间是如何相互关联的. 在2018慕尼黑OOP会议上,我展示了使用Apache Kafka生 ...

最新文章

  1. jQuery 1.4 版本的十五个新特性-转载
  2. Mysql的sql注入_MySQL SQL注入
  3. python Day6 面向对象学习
  4. java 变长参数 知乎_变长参数探究
  5. 左神算法:复制含有随机指针节点的链表 / 复杂链表的复制(Java版本)
  6. java作业 2.6
  7. 实时数据产品实践——美团大交通战场沙盘
  8. python内存回收垃圾有哪些_[Python之路] 内存管理垃圾回收
  9. f5 web服务器 位置,用Ctrl+F5向Web服务器索要最新鲜的信息!
  10. webform(八)组合查询
  11. 前瞻性研究(Prospective study)
  12. axd与ashx区别
  13. 磁盘被写保护怎么解除?取消写保护状态,只需这几步
  14. 定时任务:数据表设计与实现方案
  15. AI换脸骗过App,林俊杰和我们都怕
  16. 加速更新DNS解析记录的方法
  17. 2022年跨境电商卖家如何在Facebook上做广告【完整指南】
  18. shell脚本中等待上一条命令执行结束在执行下一条。
  19. 微信智慧商圈-java-springBoot实例
  20. 折线迷你图怎么设置_Excel2013如何使用迷你图展示数据?

热门文章

  1. 二叉排序树(BST)构造与应用
  2. PowerShell runspace 的创建,使用和查错
  3. 修改mysql数据库导入大小限制
  4. Hibernate工作原理
  5. 恶意软件、Rootkit和僵尸网络
  6. .NET,你忘记了么?(二)——使用using清理非托管资源
  7. 易语言 精易模块 操作json数据
  8. google nexus 5 刷机 卡刷 救砖教程
  9. SideFX Houdini FX中文版
  10. PhotoGun中文版