微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Kafka:The Definitive Guide learning

Kafka utilizes Zoookeeper for storing Metadata information about the brokers, topics, and partititions.

在这里插入图片描述

Producer

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Sending a Message to Kafka

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Sending a Message Asynchronously

在这里插入图片描述

Configuring Producers

在这里插入图片描述


acks =1, all

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Chapter 4

Kafka Consumers: Reading Data from Kafka

Kafka consumers are typically part of a consumer group.

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Rebalance

在这里插入图片描述


在这里插入图片描述

Creating a Kafka Consumer

在这里插入图片描述

The Poll Loop

在这里插入图片描述

Thread Safety

One consumer per thread is the rule.

It is useful to wrap the consumer logic in its own object and then use Java’s ExecutorService to start multiple threads each with its own consumer.

Configuring Consumers

在这里插入图片描述

Commits and Offsets

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Consumer: How Do We Exit

A


在这里插入图片描述


在这里插入图片描述

Chapter 5:Kafka Internals

Cluster Membership

Every broker has a unique identifier that is either set in the broker configuration file or automatically generated. Every time a broker process starts, it registers itself with its ID in Zookeeper by creating an ephemeral node.

在这里插入图片描述

To summarize, Kafka uses Zookeeper’s ephemeral node feature to elect a controller and to notify the controller when nodes join and leave the cluster. The controller is responsible for electing leaders among the partitions and replicas whenever it notices nodes join and leave the cluster. The controller uses the epoch number to prevent a “split brain” scenario where two nodes believe each is the current controller.

Replication

在这里插入图片描述


在这里插入图片描述

Request Processing

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

Fetch Requests

在这里插入图片描述

Physical Storage

The partitions will be stored in the log.dirs.

Partition Allocation

在这里插入图片描述

File Management

在这里插入图片描述


在这里插入图片描述

Indexes

在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐