__consumer_offsets如何为两个使用者保持偏移量? [英] How does __consumer_offsets keep offset for two consumers?

查看:101
本文介绍了__consumer_offsets如何为两个使用者保持偏移量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像上图一样,如果消费者A从一个分区消费,消费者B从一个消费者组消费同一分区,那么Kafka如何在 __ consumer_offsets 中管理偏移量?

Just like the above image, if Consumer A consumes from a Partition and Consumer B from a Consumer Group consumes from the same Partition, how does Kafka manage offset in __consumer_offsets?

我想知道Kafka如何在 .index .log .timeindex 文件中写入使用者偏移量.

I want to know how Kafka writes consumer offsets in .index, .log, .timeindex files.

推荐答案

可从以下文档引用报价:

Quote from docs that can be found here: https://kafka.apache.org/documentation/#impl_offsettracking

Kafka provides the option to store all the offsets for a given consumer group in a designated broker.

因此,它是针对每个消费者组的,而不是针对每个消费者的.另外,本文可能对您有所帮助: https://medium.com/@ felipedutratine/kafka-consumer-offsets-topic-3d5483cda4a6 如果您从消费者补偿主题中读取,您将收到格式为 [groupId,topicName,partitionNumber] 的数据.

So, it is per consumer group, not per consumer. Also, this article can be helpful for you: https://medium.com/@felipedutratine/kafka-consumer-offsets-topic-3d5483cda4a6 If you read from consumer offsets topic you will receive data in format [groupId,topicName,partitionNumber] .

这篇关于__consumer_offsets如何为两个使用者保持偏移量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆