本文介绍了Kafka 中的消费者组协调员和消费者组负责人有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到提到了 Kafka 消费者组协调员和消费者组领导...

I see references to Kafka Consumer Group Coordinators and Consumer Group Leaders...

  1. 有什么区别?

  1. What is the difference?

将集团管理分成两组不同的职责有什么好处?

What is the benefit from separating group management into two different sets of responsibilities?

推荐答案

1.有什么区别?

消费者组协调员是经纪人之一,而组长是消费者组中的消费者之一.

1. What is the difference?

The consumer group coordinator is one of the brokers while the group leader is one of the consumer in a consumer group.

组协调器只不过是从消费者组的所有消费者接收心跳(或轮询消息)的代理之一.每个消费者组都有一个组协调器.如果消费者停止发送心跳,协调器将触发重新平衡.

The group coordinator is nothing but one of the brokers which receives heartbeats (or polling for messages) from all consumers of a consumer group. Every consumer group has a group coordinator. If a consumer stops sending heartbeats, the coordinator will trigger a rebalance.

它为您提供更灵活/可扩展的分配策略,而无需重新启动代理.

It gives you more flexible/extensible assignment policies without rebooting the broker.

这种分离的关键在于组长负责计算整个组的分配.

The key point of this separation is that group leader is responsible for computing the assignments for the whole group.

这意味着可以在消费者上配置此分配策略(请参阅partition.assignment.strategy 消费者配置参数).

It means that this assignment strategy can be configured on a consumer (see partition.assignment.strategy consumer config parameter).

如果分区分配由消费者组协调员处理,则无法在不重启代理的情况下配置自定义分配策略.

If a partitions assignment was handled by a consumer group coordinator, it would be impossible to configure a custom assignment strategy without rebooting the broker.

更多细节参见Kafka Client-side Assignment提案.

来自Kafka The Definitive指南"[纳尔赫德、夏皮拉和帕利诺,2017 年]:

当消费者想要加入消费者组时,它会发送一个JoinGroup向小组协调员提出要求.第一个加入群组的消费者成为小组的领导.领导者收到所有来自组协调员的组中的消费者(这将包括最近发送心跳的所有消费者,因此被认为是活着的),它负责分配一个子集每个消费者的分区.它使用了一个实现PartitionAssignor 接口来决定哪些分区应该是由哪个消费者处理.

[...] 在决定​​分区分配后,消费者领导者发送发送给 GroupCoordinator 的分配列表向所有消费者提供信息.每个消费者只看到自己的分配 - 领导者是唯一拥有完整的客户端进程组中的消费者列表及其分配.这个流程每次重新平衡发生时重复.

[...] After deciding on the partition assignment, the consumer leader sendsthe list of assignments to the GroupCoordinator which sends thisinformation to all the consumers. Each consumer only sees his ownassignment - the leader is the only client process that has the fulllist of consumers in the group and their assignments. This processrepeats every time a rebalance happens.

这篇关于Kafka 中的消费者组协调员和消费者组负责人有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 02:57