Kafka消费者中groupid和consumerid的区别 [英] difference between groupid and consumerid in Kafka consumer

查看:129
本文介绍了Kafka消费者中groupid和consumerid的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到消费者配置有两个 ID.一个是 group.id(强制),第二个是 consumer.id(非强制).

I noticed that the Consumer configuration has two IDs. One is group.id (mandatory) and second one is consumer.id (not Mandatory).

这两个 ID 有什么区别?

What is the difference between these 2 IDs?

推荐答案

Consumers Groups 是一种 Kafka 抽象,支持点对点和发布/订阅消息传递.消费者可以通过将其 group.id 设置为 group_1 来加入消费者组(假设为 group_1).消费者组也是一种支持数据并行消费的方式,即同一消费者组的不同消费者并行消费来自不同分区的数据.

Consumers groups is a Kafka abstraction that enables supporting both point-to-point and publish/subscribe messaging. A consumer can join a consumer group (let us say group_1) by setting its group.id to group_1. Consumer groups is also a way of supporting parallel consumption of the data i.e. different consumers of the same consumer group consume data in parallel from different partitions.

除了 group.id 之外,每个消费者还使用 consumer.id 向 Kafka 代理标识自己.Kafka 使用它来识别特定消费者组的当前 ACTIVE 消费者.

In addition to group.id, each consumer also identifies itself to the Kafka broker using consumer.id. This is used by Kafka to identify the currently ACTIVE consumers of a particular consumer group.

阅读本文档了解更多详情.

这篇关于Kafka消费者中groupid和consumerid的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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