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

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值