kafka replication tools

news/2024/6/18 1:50:47 标签: kafka, replication

kafka工具

 

replication tool工作步骤(异步过程,执行完1就结束):

1.更新zk上的/admin/preferred_replica_election节点,内容为副本的几个位置(不包含已经奔溃的leader)

 

2.controller中的zk的listener读取topic partition的副本的几个位置

 

3.controller获取每个topic partition的副本的几个replica中的第一个,作为referred replica;

  如果这个preferred replica不是leader且在isr中,则controller发出request到这个preferred replica的broker,通知其作为topic partition的leader

  

  

bin/kafka-preferred-replica-election.sh --zookeeper localhost:81821/kafka-zk --path-to-json-file topicPartitionList.json

 

topicPartitionList.json格式为:

{

 "partitions":

  [

    {"topic": "topic1", "partition": "0"},

    {"topic": "topic1", "partition": "1"},

    {"topic": "topic1", "partition": "2"},

 

    {"topic": "topic2", "partition": "0"},

    {"topic": "topic2", "partition": "1"},

  ]

}

 

FAQ

What happens if the preferred replica is not in the ISR?

The controller will fail to move the leadership to the preferred replica if it is not in the ISR. This is to ensure that there is no dataloss. When the replica becomes "in-sync" with the leader, the tool can be run again to move the leader.

则移动失败,避免数据丢失

 

How to find if all the partitions have been moved to the "preferred replica" after running the tool?

ListTopicCommand is an excellent tool that provides an overview of all the topic partitions in the cluster. For each topic partition, it displays the leader, assigned replicas and current "in-sync" replica set. If the leader and the first replica in the assigned replica set are the same then the Preferred replica leader election" tool succeeded. If not, the tool failed and may have to be run again.

跟isr的第一个replica相同


http://www.niftyadmin.cn/n/1694128.html

相关文章

Maven和Gradle对比(转载)

转载出处:http://www.cnblogs.com/huang0925 Java世界中主要有三大构建工具:Ant、Maven和Gradle。经过几年的发展,Ant几乎销声匿迹、Maven也日薄西山,而Gradle的发展则如日中天。笔者有幸见证了Maven的没落和Gradle的兴起。Mav…

vue安装

1、node -v2、npm -v3、npm cache clean 【报err了,没管】4、cnpm -v 【貌似没有什么作用】5、npm config set proxy null【貌似没有什么作用】 又从头开始了1、打开c盘 c:2、npm config set proxy null【执行了两次】3、npm install -g cnpm --registryhttps://reg…

SVN中trunk,branches,tags用法详解(转载)

转载出处:http://www.cnblogs.com/dafozhang/archive/2012/06/28/2567769.html Subversion是一个自由开源的版本控制系统。在Subversion管理下,文件和目录可以超越时空。Subversion将文件存放在中心版本库里,这个版本库很像一个普通的文件服务…

kafka topic命令

kafka topic可以定制执行brokerid和partition的topic,还有增加partition kafka topic Create, delete, describe, or change a topic. Option Description ------ …

【Java知识点专项练习】之 Java鲁棒性的特点

Java鲁棒性的特点如下: Java在编译和运行程序时都要对可能出现的问题进行检查,以防止错误的产生。Java编译器可以查出许多其他语言运行时才能发现的错误。Java不支持指针操作,大大减少了错误发生的可能性。Java具有异常处理的功能&#xff0c…

Spring Boot Common application properties(转载)

转自官方文档:http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html 版本:1.5.4.RELEASE # # COMMON SPRING BOOT PROPERTIES # # This sample file is provided as a guideline. Do NOT copy it in its…

Confluence 6 使用 LDAP 授权连接一个内部目录 - 服务器设置

名字(Name) 名字的描述将会帮助你在目录中识别。例如: Internal directory with LDAP AuthenticationCorporate LDAP for Authentication Only目录类型(Directory Type) 选择你希望连接的 LDAP 目录类型。如果你添加一…

英特尔发布一季度财报:关键数据中心业务未达预期

近日,电脑芯片巨头英特尔发布了一季度财报。虽然利润指标表现正常,但是由于重要的数据中心业务增长不及预期,导致英特尔股价大跌了3%。 据美国财经新闻网站CNBC报道,在盈利方面,英特尔一季度每股盈利为66美分&#xff…