简体   繁体   English

来自不同组的Kafka消费者来自不同的主题分区

[英]Kafka Consumer from different group consuming from different partition of Topic

I have a scenario where I have deployed 4 instances of Kafka Consumer on different nodes. 我有一个场景,其中我在不同的节点上部署了4个Kafka Consumer实例。 My topic has 4 partitions. 我的主题有4个分区。 Now, I want to configure the Consumers in such a way that they all fetch from different partitions of the topic. 现在,我要配置使用者,使它们都从主题的不同分区获取。

I know for a fact that if the Consumers are from the same consumer group, they ensure that the partitions are split equally. 我知道一个事实,即如果使用者来自相同的使用者组,他们将确保分区被平均分配。 But in my case, they are not in the same group. 但就我而言,它们不在同一个组中。

In order to achieve what you want you need the consumers being in the same consumer group. 为了实现您想要的目标,您需要将消费者置于同一个消费者组中。 Only in this case a "competing consumer" pattern is applied : each consumer receives 1 partition from the 4, so you have 4 consumers each one reading from 1 partition and receiving messages for that partitions. 仅在这种情况下,才应用“竞争使用者”模式:每个使用者从4个中接收1个分区,因此您有4个使用者,每个使用者从1个分区中读取并接收该分区的消息。 When consumers are part of different consumer groups, each consumer will be assigned to all 4 partitions receiving messages from all of them in a publish/subscribe way. 当使用者属于不同使用者组的一部分时,会将每个使用者分配到所有4个分区,以发布/订阅的方式从所有分区接收消息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从两个不同分区(相同主题)消费的单个 Kafka 消费者如何跟踪每个分区偏移量? - How does a single Kafka consumer, consuming from two different partitions (same topic), keeps track of each partition offset? Spark Kafka Consumer不使用主题消息 - Spark Kafka Consumer not consuming messages from topic Kafka控制台使用者未从主题中使用 - Kafka console consumer not consuming from topic 2 个具有相同组 ID 的不同消费者应用程序实例使用来自同一主题的消息 - 2 different consumer application instances with the same group id consuming messages from the same topic 单个Kafka使用者同时使用来自两个不同集群的消息 - Single Kafka consumer consuming messages from two different cluster simultaneously 如何找到消费者组从kafka主题消费数据的开始时间 - How to Find Starting time of consuming data from a kafka topic by the consumer group 同一消费者组内具有不同分区数量的不同 kafka 主题 - Different kafka topic with different amount of partitions within the same consumer group 同一个消费者组中的多个Kafka Consumer如何从topic中的一个partition读取消息? - How multiple Kafka Consumers in the same consumer group read messages from one partition in the topic? 卡夫卡消费群未从单个分区读取 - Kafka consumer group not reading from a single partition Spring 主题空闲时从消费者组中删除 Kafka 消费者 - Spring Kafka consumer removed from consumer group when topic idle
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM