集群中有多少个 Kafka 控制器,控制器的用途是什么? [英] How many Kafka controllers are there in a cluster and what is the purpose of a controller?

查看:22
本文介绍了集群中有多少个 Kafka 控制器,控制器的用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Kafka 集群中的 Kafka 控制器负责管理分区领导和复制.

The Kafka controller in a Kafka cluster is in charge of managing partition leaders and replication.

如果一个 Kafka 集群中有 100 个 broker,那么控制器是否只是一个 Kafka broker?那么在 100 个经纪人中,控制者是领导者吗?

If there are 100 brokers in a Kafka cluster, is the controller just one Kafka broker? So out of the 100 brokers, is the controller the leader?

您如何知道哪个经纪人是控制者?

How would you know which broker is the controller?

Kafka Controller 的管理是否对 Kafka 系统管理至关重要?

Is the management of the Kafka Controller critical to Kafka system management?

推荐答案

在 Kafka 集群中,单个 Broker 作为活动控制器,负责分区和副本的状态管理.因此,在您的情况下,如果您有一个包含 100 个代理的集群,其中一个将充当控制器.

Within a Kafka cluster, a single broker serves as the active controller which is responsible for state management of partitions and replicas. So in your case, if you have a cluster with 100 brokers, one of them will act as the controller.

关于集群控制器职责的更多细节可以在这里找到.

More details regarding the responsibilities of a cluster controller can be found here.

为了找到哪个broker是集群的控制器,你首先需要通过ZK CLI连接到Zookeeper:

In order to find which broker is the controller of a cluster you first need to connect to Zookeeper through ZK CLI:

./bin/zkCli.sh -server localhost:2181 

然后get控制器

[zk: localhost:2181(CONNECTED) 0] get /controller

输出应如下所示:

{"version":1,"brokerid":100,"timestamp":"1506423376977"}
cZxid = 0x191
ctime = Tue Sep 26 12:56:16 CEST 2017
mZxid = 0x191
mtime = Tue Sep 26 12:56:16 CEST 2017
pZxid = 0x191
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x15ebdd241840002
dataLength = 56
numChildren = 0

<小时>

Zookeeper 是 Kafka 集群状态的存储.它用于在开始时或当前控制器崩溃时进行控制器选举.当主题的分区领导代理失败/崩溃时,控制器还负责告诉其他副本成为分区领导.


Zookeeper is the storage of the state of a Kafka cluster. It is used for the controller election either in the very beginning or when the current controller crashes. The controller is also responsible for telling other replicas to become partition leaders when the partition leader broker of a topic fails/crashes.

这篇关于集群中有多少个 Kafka 控制器,控制器的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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