Skip to Content
Kafka权威指南(第2版)
book

Kafka权威指南(第2版)

by Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty
November 2022
Beginner to intermediate
346 pages
11h
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南(第2版)
62
4
的,只要消费者能够以正常的时间间隔发送心跳,它就会被认为还“活着”。
如果消费者在足够长的一段时间内没有发送心跳,那么它的会话就将超时,群组协调器会
认为它已经“死亡”,进而触发再均衡。如果一个消费者发生崩溃并停止读取消息,那么
群组协调器就会在几秒内收不到心跳,它会认为消费者已经“死亡”,进而触发再均衡。
在这几秒时间里,“死掉”的消费者不会读取分区里的消息。在关闭消费者后,协调器会
立即触发一次再均衡,尽量降低处理延迟。本章的后续部分将介绍一些用于控制心跳发送
频率、会话过期时间和调节消费者行为的配置参数。
分配分区是怎样的一个过程
当一个消费者想要加入消费者群组时,它会向群组协调器发送
JoinGroup
请求。第一个加入群组的消费者将成为群组
首领
。首领从群组协调器那里
获取群组的成员列表(列表中包含了所有最近发送过心跳的消费者,它
们被认为还“活着”),并负责为每一个消费者分配分区。它使用实现了
PartitionAssignor
接口的类来决定哪些分区应该被分配给哪个消费者。
Kafka
内置了一些分区分配策略
,后文将深入介绍它们。分区分配完毕之后,
首领会把分区分配信息发送给群组协调器,群组协调器再把这些信息发送给
所有的消费者。每个消费者只能看到自己的分配信息,只有首领会持有所有
消费者及其分区所有权的信息。每次再均衡都会经历这个过程。
4.1.3
 群组固定成员
在默认情况下,消费者的群组成员身份标识是临时的。当一个消费者离开群组时,分配给
它的分区所有权将被撤销;当该消费者重新加入时,将通过再均衡协议为其分配一个新的 ...
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

时间序列分析实战:基于机器学习和统计学

时间序列分析实战:基于机器学习和统计学

Aileen Nielsen
Spark机器学习实战

Spark机器学习实战

Posts & Telecom Press, Siamak Amirghodsi, Meenakshi Rajendran, Broderick Hall, Shuen Mei
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik
Kubernetes编程

Kubernetes编程

Michael Hausenblas, Stefan Schimanski

Publisher Resources

ISBN: 9787115601421