Kafka:The Definitive Guide learning

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

Kafka:The Definitive Guide learning

Producer

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Sending a Message to Kafka

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Sending a Message Asynchronously

Kafka:The Definitive Guide learning

Configuring Producers

Kafka:The Definitive Guide learning
acks =1, all
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Chapter 4

Kafka Consumers: Reading Data from Kafka

Kafka consumers are typically part of a consumer group.

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Rebalance

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Creating a Kafka Consumer

Kafka:The Definitive Guide learning

The Poll Loop

Kafka:The Definitive Guide learning

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

Kafka:The Definitive Guide learning

Commits and Offsets

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Consumer: How Do We Exit

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

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.
Kafka:The Definitive Guide learning

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

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Request Processing

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Fetch Requests

Kafka:The Definitive Guide learning

Physical Storage

The partitions will be stored in the log.dirs.

Partition Allocation

Kafka:The Definitive Guide learning

File Management

Kafka:The Definitive Guide learning
Kafka:The Definitive Guide learning

Indexes

Kafka:The Definitive Guide learning

上一篇:MySQL插入去重命令_INSERT IGNORE INTO


下一篇:【ElasticSearch(十一)进阶】Mapping的查询、创建、修改、删除