在Kafka中,使用者在哪个__consumer_offsets分区上提交偏移量?

时间:2019-03-19 13:55:07

标签: apache-kafka

用户应该以某种方式成为主题__consumer_offsets中特定分区的生产者。

__consumer_offsets分区链接到使用者的规则是什么?

消费者实际上可以从不同的经纪人那里消费,而不是每个经纪人都具有相同的__consumer_offsets分区。

1 个答案:

答案 0 :(得分:0)

Kafka stores the information of a topic partition in an internal topic called __consumer_offsets.

Request to read an offset is only served by the leader of a partition and committed offsets are stored on leader.

In-sync replicas also have to be in-sync with the leader partition.so they make the fetch request like from which offset they want to read data from the leader of the partition.

After reading from the leader partition, they also update the offset in their _consumer_offsets partition.

In case,the leader of the partition goes down.When the system comes live, any one of the in-sysc replica will be elected as leader and they have the latest committed offset.

So the assigned consumer to that partition will get the last consumed offset from the latest leader and start reading from that offset.

Hopes, It answers your question.