简体   繁体   English

kafka 领导者不可用 - kafka-reassign-partitions

[英]kafka leader unavailable - kafka-reassign-partitions

Following some tutorials / courses about the Apache Kafka I have a question about reassigning the partitions.按照有关 Apache Kafka 的一些教程/课程,我有一个关于重新分配分区的问题。 CLI kafka-reassign-partitions reassigns the leaders and partitions, looks good. CLI kafka-reassign-partitions重新分配kafka-reassign-partitions和partitions,看起来不错。

However it was mentions that this command can be used to in case a partition leader broker is not available to elect another partition leader.然而,有人提到该命令可用于在分区领导代理不可用于选举另一个分区领导的情况下。

Question: If a partition leader broker (say any broker) is not available, shouldn't a new leader be elected automatically?问题:如果分区领导代理(比如任何代理)不可用,是否应该自动选举新的领导? Isn't it responsibility of the controller node?不是控制器节点的责任吗? Or was it just a wrongly intended usage?或者它只是一个错误的预期用途?

You are right, Kafka should take care itself to select a new partition leader.你是对的,Kafka 应该小心选择一个新的分区领导者。 Any in-sync replica can be used as a new partition leader.任何同步副本都可以用作新的分区领导者。 However, it might happen that the partition leader broker died before it was able to replicate all data to its replicas.但是,可能会发生分区领导代理在能够将所有数据复制到其副本之前死亡的情况。 In that case the CLI you mentioned can help.在这种情况下,您提到的 CLI 可以提供帮助。

However, this tool has two main usages (note that Kafka expects a failed broker to be re-started and it will not automatically shift all data from a healthy replication to a running broker):然而,这个工具有两个主要用途(注意 Kafka 期望一个失败的 broker 重新启动,它不会自动将所有数据从一个健康的复制转移到一个正在运行的 broker):

  • imagine you have a cluster with five brokers and you apply a replication factor of three.假设您有一个包含五个代理的集群,并且您应用了 3 的复制因子。 Over time you are creating multiple topics and those topics grow in byte size each individually.随着时间的推移,您将创建多个主题,并且这些主题的字节大小分别增加。 When creating the topic, Kafka does not know how large the topic will get and it selects the leader on a round-robin basis.创建主题时,Kafka 不知道主题会有多大,它会在循环的基础上选择领导者。 To avoid having all the "big" topics on one broker and run out of disk space you can reassing its partitions (including leader and replicas) to other brokers using that tool.为了避免在一个代理上拥有所有“大”主题并用完磁盘空间,您可以使用该工具将其分区(包括领导者和副本)重新分配给其他代理。

  • If you add more brokers to your cluster, Kafka will still stick to the existing brokers for their partition leaders (and replicas).如果您向集群添加更多代理,Kafka 仍将坚持使用现有代理作为其分区领导者(和副本)。 Only newly created topics can make use of the new brokers.只有新创建的主题才能使用新的代理。 Even when you restart all brokers, the partition leaders will stick to their old location.即使您重新启动所有代理,分区领导者也会坚持其旧位置。 The CLI tool helps you to balance out the load accross all (including the new) brokers. CLI 工具可帮助您平衡所有(包括新的)代理的负载。

暂无
暂无

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

相关问题 Kafka主题分区与领导-1 - Kafka topic partitions with leader -1 kafka-reassign-partitions --generate for topic __commit_offsets 给了我奇怪的结果:分区副本只在一个代理上 - kafka-reassign-partitions --generate for topic __commit_offsets gives me strange result: partition replica only on one broker anyway 我可以在 Kafka 上自动重新分配分区吗? - Can I auto-reassign partitions on Kafka? 卡夫卡卡在重新分配分区工具和进度 - Kafka stuck on reassign partitions tool and progress 卡夫卡重新分配分区工作卡在待定状态 - kafka reassign-partitions job stuck in pending 卡夫卡不公平的领导人选举-所有分区的相同领导人 - Unfair Leader election in Kafka - Same leader for all partitions 当节点启动并运行时,Kafka主题具有带有Leader = -1(Kafka Leader Election)的分区 - Kafka topic has partitions with leader=-1 (Kafka Leader Election), while node is up and running 在nodeJS中创建主题时将leader分配给kafka主题的分区 - Assign leader to partitions of kafka topic while creating topics in nodeJS Kafka Consumer 启动错误:无法为分区添加领导者 [calls,0] - NotLeaderForPartitionException - Kafka Consumer startup error: Failed to add leader for partitions [calls,0] - NotLeaderForPartitionException Kafka 生产者错误“1 个分区具有没有匹配侦听器的领导代理” - Kafka producer error “1 partitions have leader brokers without a matching listener”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM