Skip to Content
Kafka权威指南
book

Kafka权威指南

by Neha Narkhede, Gwen Shapira, Todd Palino
January 2018
Beginner to intermediate
234 pages
7h 8m
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南
6
1
消费者
读取消息。在其他发布与订阅系统中,消费者可能被称为
订阅者
读者
。消费者订
阅一个或多个主题,并按照消息生成的顺序读取它们。消费者通过检查消息的偏移量来区
分已经读取过的消息。
偏移量
是另一种元数据,它是一个不断递增的整数值,在创建消息
时,
Kafka
会把它添加到消息里。在给定的分区里,每个消息的偏移量都是唯一的。消费
者把每个分区最后读取的消息偏移量保存在
Zookeeper
Kafka
上,如果消费者关闭或重
启,它的读取状态不会丢失。
消费者是
消费者群组
的一部分,也就是说,会有一个或多个消费者共同读取一个主题。群
组保证每个分区只能被一个消费者使用。图
1-6
所示的群组中,有
3
个消费者同时读取一
个主题。其中的两个消费者各自读取一个分区,另外一个消费者读取其他两个分区。消费
者与分区之间的映射通常被称为消费者对分区的
所有权关系
通过这种方式,消费者可以消费包含大量消息的主题。而且,如果一个消费者失效,群组
里的其他消费者可以接管失效消费者的工作。第
4
章将详细介绍消费者和消费者群组。
分区0
分区1
分区2
分区3
主题“topicName”
消费者0
消费者1
消费者2
消费者
群组
1-6:消费者群组从主题读取消息
1.2.5
 
broker
和集群
一个独立的
Kafka
服务器被称为
broker
broker
接收来自生产者的消息,为消息设置偏移
量,并提交消息到磁盘保存。
broker
为消费者提供服务,对读取分区的请求作出响应,返
回已经提交到磁盘上的消息。根据特定的硬件及其性能特征,单个
broker
可以轻松处理数 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9787115473271