简体   繁体   English

卡夫卡经纪人是否存储元数据?

[英]Does Kafka broker store metadata?

Does Kafka broker store metadata which producer API uses (eg which partitions are leader for a topic etc.)? Kafka代理是否存储生产者API使用的元数据(例如,哪个分区是主题的领导者等)? As per my understanding this metadata is stored in Zookeeper , is it correct? 据我了解,该元数据存储在Zookeeper中,是否正确? If it is true then how Brokers are updated by Zookeeper with latest information? 如果是这样,那么Zookeeper如何使用最新信息来更新Brokers?

Kafka is a distributed system and is built to use Zookeeper which is responsible for controller election, topic configuration, clustering etc. Kafka是一个分布式系统,旨在使用Zookeeper进行管理,该控制器负责控制器的选择,主题配置,集群等。

More precisely, Zookeeper initiates controller election. 更准确地说,Zookeeper发起控制器选举。 The controller broker is a single broker in the Kafka cluster which takes care of leader broker and followers for every partition. 控制器经纪人是Kafka集群中的单个经纪人,负责每个分区的领导者经纪人和关注者。 When a particular broker is taken down, the controller lets other replicas know (in order to handle partition leaders etc). 当某个特定的代理被删除时,控制器会告知其他副本(以便处理分区领导者等)。 Moreover, when the controller fails then Zookeeper initiates new elections in order to elect the new broker which will act as the controller. 此外,当控制者发生故障时,Zookeeper会发起新的选举,以选举将充当控制者的新经纪人。

Furthermore, Zookeeper knows which brokers are part of the Kafka cluster and which are still alive. 此外,Zookeeper知道哪些经纪人是Kafka集群的一部分,哪些经纪人还活着。 Similarly, it is also aware of topic-specific information such as which topics exist, how many partitions each has, where are the replicas and so on. 同样,它也知道特定于主题的信息,例如存在哪些主题,每个主题有多少分区,副本在哪里等。

Zookeeper also stores information regarding quotas and ACLs, ie what volume of data each client is allowed to consume/produce and also, who is allowed to consume or produce from a particular topic. Zookeeper还存储有关配额和ACL的信息,即每个客户端被允许消费/产生的数据量,以及允许谁从特定主题消费或产生的数据量。

All Kafka brokers can answer a metadata request that describes the current state of the cluster: what topics there are, which partitions those topics have, which broker is the leader for those partitions etc. 所有Kafka代理都可以回答描述集群当前状态的元数据请求:存在哪些主题,这些主题具有哪些分区,哪个代理是这些分区的领导者等。

ZooKeeper is responsible for: ZooKeeper负责:

  • Electing a controller broker - and making sure there is only one 选择控制经纪人-确保只有一个经纪人
  • Cluster membership - allowing brokers to join a cluster 集群成员资格-允许代理加入集群
  • Topic configuration - which topics exist, how many partitions each has, where are the replicas, who is the preferred leader, what configuration overrides are set for each topic 主题配置-存在哪些主题,每个主题有多少个分区,副本在哪里,谁是首选领导者,为每个主题设置了哪些配置替代
  • Quotas - how much data is each client allowed to read and write 配额-每个客户端允许读写多少数据
  • ACLs - who is allowed to read and write to which topic ACL-允许谁读写主题

There is regular communication between Kafka and ZooKeeper such that ZooKeeper knows a Kafka broker is still alive (ZooKeeper heartbeat mechanism) and also in response to events such as a topic being created or a replica falling out of sync for a topic-partition. Kafka和ZooKeeper之间定期进行通信,以使ZooKeeper知道Kafka代理仍处于活动状态(ZooKeeper心跳机制),并且还响应诸如主题正在创建或副本因主题分区不同步而发生的事件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM