kafka Reassign Partitions Tool
kafka 0.8增加了重新分配partition功能,进行扩容,增加减少replica,移动partition
kafka-reassign-partitions.sh脚本
Option Description
------ -----------
--broker-list <brokerlist> The list of brokers to which the
partitions need to be reassigned in
the form "0,1,2". This is required
if --topics-to-move-json-file is
used to generate reassignment
configuration
--execute Kick off the reassignment as specified
by the --reassignment-json-file
option.
--generate Generate a candidate partition
reassignment configuration. Note
that this only generates a candidate
assignment, it does not execute it.
--reassignment-json-file <manual The JSON file with the partition
assignment json file path> reassignment configurationThe format
to use is -
{"partitions":
[{"topic": "foo",
"partition": 1,
"replicas": [1,2,3] }],
"version":1
}
--topics-to-move-json-file <topics to Generate a reassignment configuration
reassign json file path> to move the partitions of the
specified topics to the list of
brokers specified by the --broker-
list option. The format to use is -
{"topics":
[{"topic": "foo"},{"topic": "foo1"}],
"version":1
}
--verify Verify if the reassignment completed
as specified by the --reassignment-
json-file option.
--zookeeper <urls> REQUIRED: The connection string for
the zookeeper connection in the form
host:port. Multiple URLS can be
given to allow fail-over.
narkhed$ cat partitions-to-move.json
{"partitions":
[{"topic": "foo",
"partition": 1,
"replicas": [1,2,3] }],
"version":1
}
bin/kafka-reassign-partitions.sh --topics-to-move-json-file dirk_topic_move.json --zookeeper host34/kafka-dirktest --broker-list "0341,0361" --generate
生成将topic dirkzhang放到341和361上的json,用json执行execute就可以了
Current partition replica assignment
{"version":1,"partitions":[{"topic":"dirkzhang","partition":6,"replicas":[361,371]},{"topic":"dirkzhang","partition":0,"replicas":[361,371]},{"topic":"dirkzhang","partition":5,"replicas":[341,371]},{"topic":"dirkzhang","partition":4,"replicas":[371,361]},{"topic":"dirkzhang","partition":3,"replicas":[361,341]},{"topic":"dirkzhang","partition":7,"replicas":[371,341]},{"topic":"dirkzhang","partition":1,"replicas":[371,341]},{"topic":"dirkzhang","partition":2,"replicas":[341,361]}]}
Proposed partition reassignment configuration
{"version":1,"partitions":[{"topic":"dirkzhang","partition":6,"replicas":[361,341]},{"topic":"dirkzhang","partition":5,"replicas":[341,361]},{"topic":"dirkzhang","partition":0,"replicas":[361,341]},{"topic":"dirkzhang","partition":4,"replicas":[361,341]},{"topic":"dirkzhang","partition":3,"replicas":[341,361]},{"topic":"dirkzhang","partition":1,"replicas":[341,361]},{"topic":"dirkzhang","partition":7,"replicas":[341,361]},{"topic":"dirkzhang","partition":2,"replicas":[361,341]}]}
-----------------------------------------------------------------
bin/kafka-reassign-partitions.sh --zookeeper host34/kafka-dirktest --reassignment-json-file dirk_move_partition.json --execute
将partition0,1的replica放到341,371上(brokerid前边不能有零,是int)
dirk_move_partition.json:
{"version":1,"partitions":
[{"topic":"dirkzhang",
"partition":0,
"replicas":[341,371]
},
{"topic":"dirkzhang",
"partition":1,
"replicas":[341,371]
}]
}
------------------------------------------------
用verify检查是否迁移成功
bin/kafka-reassign-partitions.sh --reassignment-json-file dirk_move_partition.json --zookeeper host34/kafka-dirktest --verify
Status of partition reassignment:
Reassignment of partition [dirkzhang,1] completed successfully
----------------------------------------------------
收集replica迁移,选leader的日志
bin/kafka-run-class.sh kafka.tools.StateChangeLogMerger
--end-time <end timestamp in the The latest timestamp of state change
format java.text. log entries to be merged (default:
SimpleDateFormat@f17a63e7> 9999-12-31 23:59:59,999)
--logs <file1,file2,...> Comma separated list of state change
logs or a regex for the log file
names
--logs-regex <for example: /tmp/state- Regex to match the state change log
change.log*> files to be merged
--partitions <0,1,2,...> Comma separated list of partition ids
whose state change logs should be
merged
--start-time <start timestamp in the The earliest timestamp of state change
format java.text. log entries to be merged (default:
SimpleDateFormat@f17a63e7> 0000-00-00 00:00:00,000)
--topic <topic> The topic whose state change logs
should be merged
bin/kafka-run-class.sh kafka.tools.StateChangeLogMerger --topic dirkzhang --partition 0,1,2 --start-time "2015-07-02 00:00:00,000" --end-time "2015-07-03 00:00:00,000" --logs /data/kafka_2.10-0.8.2.1/logs/state-change.log
kafka Reassign Partitions Tool相关推荐
- Kafka学习之Replication tools之Reassign Partitions Tool
原文链接:https://cwiki.apache.org/confluence/display/KAFKA/Replication+tools#Replicationtools-6.Reassign ...
- kafka reassign 限速_RabbitMQ 与 Kafka 的技术差异以及使用注意点
导言 作为一个有丰富经验的微服务系统架构师,经常有人问我,"应该选择RabbitMQ还是Kafka?".基于某些原因, 许多开发者会把这两种技术当做等价的来看待.的确,在一些案例场 ...
- kafka reassign 限速_RabbitMQ 七战 Kafka,差异立现!
Python实战社群 Java实战社群 长按识别下方二维码,按需求添加 扫码关注添加客服 进Python社群▲ 扫码关注添加客服 进Java社群▲ 作者丨王欢 链接丨分布式实验室(ID:dockero ...
- kafka reassign 限速_简单明了,Kafka与MQ的区别
作为消息队列来说,企业中选择mq的还是多数,因为像Rabbit,Rocket等mq中间件都属于很成熟的产品,性能一般但可靠性较强, 而kafka原本设计的初衷是日志统计分析,现在基于大数据的背景下也可 ...
- kafka reassign 限速_车主无忧:为什么放弃开源Kafka?
简介:通过迁移到商业版本的 Kafka,车主无忧的系统稳定性得到了大幅提升,消息无丢失,生产与消费端的抖动明显好转,整个消息集群平稳运行,有效地支持了业务的快速发展. 车主无忧是属于广州小迈网络科技公 ...
- kafka reassign 限速_高速限速有了新规矩!公路限速标志设计规范即将施行
重要通知 2020/10/11高速公路 国家交通运输部6月底发布<公路限速标志设计规范>,详细规定了公路限速路段划分.限速值论证.限速方式选取等内容,并将自2020年11月1日起施行. 当 ...
- kafka reassign 限速_为什么德国的高速就能不限速?
很多朋友都听说过"德国高速不限速"这一说法,希望有朝一日去欧洲旅行时能够体验一下在高速公路上每小时狂飙200公里的刺激.那么德国的高速公路究竟是不是像传说中的那样不限速呢? 已经在 ...
- Kafka High Availability (下)
摘要 本文在上篇文章基础上,更加深入讲解了Kafka的HA机制,主要阐述了HA相关各种场景,如Broker failover,Controller failover,Topic创建/删除,Broker ...
- Kafka设计解析(三):Kafka High Availability (下)--转
原文地址:http://www.infoq.com/cn/articles/kafka-analysis-part-3?utm_source=infoq&utm_campaign=user_p ...
最新文章
- python查看包的安装路径_查看python包的安装路径,检查安装路径设置。Python包的Python来自,从中,检测...
- linux命令之diff,whereis,locate,pwd,cat,grep,touch,find
- NewLife.Net——管道处理器解决粘包
- [转]JavaScript面向对象的特性
- RHEL5+Postfix+MySql+IMAP+MailDrop+ExtMail(5)
- 单例模式、使用getInstance()方法的原因及作用
- 闲谈: 测试报告的插入图片
- 【Flume】Flume简单介绍
- as工程放到源码编译_「Do.016」AndroidStudio不用编译,阅读Android源码
- kvm : virsh create *** 报错处理
- Eclipse、STS 常用设置、操作 与 常用快捷键
- 中兴连专利也不申请了?
- python网络编程第三版网盘_Python网络编程(socketserver、TFTP云盘、HTTPServer服务器模型)...
- 聊聊spring data jpa的JpaQueryLookupStrategy
- MATLAB处理txt文档数据——以处理pscad输出数据为例
- 经典游戏制作教程[zz]
- 信息系统项目管理师必背核心考点(四)UML类与类之间的关系
- 展锐android r kernel 快速编译
- python爬虫——百度贴吧图片爬取 小项目
- [转载]推荐:互联网思维必读十本书