kafka-topics.sh –describe 显示了什么?

huangapple go评论83阅读模式
英文:

What is kafka-topics.sh --describe showing me?

问题

我可以解释一下kafka-topics.sh --describe显示的内容:

  • Leader: 这是指向第3个 broker,而不是第3个分区 [2]。
  • Replicas: 这是指向经纪人:分区。
  • Isr: 这是指向经纪人:分区。

如果有人能解释一下A、B、C、D列代表什么,我会非常感激。kafka-topics.sh –describe 显示了什么?

英文:

Can you explain what kafka-topics.sh --describe is showing? me
I am following a tutorial video and also was reading the Apache documentation but I need a little more clarify as to what I'm looking at for the following columns in this graphic.

Leader: Is this pointing to the 3rd broker or is this pointing to the 3rd partition [2]?

Replicas: Is this pointing to brokers:partitions?

Isr: Is this pointing to brokers:partitions?

I would greatly appreciate it if someone explains what the columns A, B , C, D are.kafka-topics.sh –describe 显示了什么?

答案1

得分: 9

主题名称:"install_test2"

有4个分区(分区0、分区1、分区2、分区3),此主题的复制因子为2。这意味着您的主题中的数据将以冗余方式存储在2个代理中。在Kafka中,每个分区都有一个领导者,所有来自生产者和消费者的请求都会发送到领导者。

**领导者列(图像中的B列)**显示了每个分区的领导者的代理ID。 (Kafka均匀分配分区领导权以实现负载均衡)

**复制品列(图像中的C列)**显示了每个分区复制数据的代理ID。第一个ID表示首选领导者。这意味着Kafka将尝试将此代理作为分区的领导者。

**ISR(图像中的D列)**表示处于同步复制状态的副本。在Kafka中,当消息发送到主题分区时(首先,消息被接收并存储在领导者中),如果您的复制因子大于1,则复制代理会发送获取请求,并将此数据复制到其他代理。如果跟随者(副本)代理不远远落后于领导者(在下文中有解释),则处于同步状态。如果分区领导者失败,Kafka会选择ISR作为故障转移的新领导者。

根据Kafka文档:

配置参数replica.lag.time.max.ms现在不仅指的是自上次从副本获取请求以来的时间,还指的是副本最后一次追赶的时间。在replica.lag.time.max.ms内仍在从领导者获取消息但未追赶到最新消息的副本将被视为不同步。

英文:

Topic name: "install_test2"

4 partitions (partition 0, partition 1, partition 2, partition 3) and your replication factor for this topic is 2. It means that data in your topic will be stored (replicated) in 2 brokers for redundancy. In Kafka every partition has a leader and all the requests from producers and consumers are sent to the leader.

Leader column (column B in your image) shows broker ids of the leader for each partition. (Kafka evenly distributes partition leadership between brokers for load balancing)

Replicas column (column C in your image) shows ids of brokers that replicates data for each partition. The first id represents preferred leader. It means Kafka will try to make this broker leader of partition.

ISR (column D in your image) means in-sync-replica. In Kafka when a message is sent to a topic-partition (firstly message is received and stored in leader) and if you have replication factor greater than 1, then replica broker(s) send fetch request and this data is replicated to other broker(s). A follower (replica) broker is in-sync if it is not far behind the leader (explained in below). If a partition leader fails, Kafka chooses an ISR as the new leader for failover.

From Kafka docs:

> Configuration parameter replica.lag.time.max.ms now refers not just to
> the time passed since last fetch request from replica, but also to
> time since the replica last caught up. Replicas that are still
> fetching messages from leaders but did not catch up to the latest
> messages in replica.lag.time.max.ms will be considered out of sync.

huangapple
  • 本文由 发表于 2020年1月7日 02:44:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/59617341.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定