博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Custom partition assignment and migration kafka集群扩充迁移指定partition
阅读量:4982 次
发布时间:2019-06-12

本文共 1992 字,大约阅读时间需要 6 分钟。

The partition reassignment tool can also be used to selectively move replicas of a partition to a specific set of brokers. When used in this manner, it is assumed that the user knows the reassignment plan and does not require the tool to generate a candidate reassignment, effectively skipping the --generate step and moving straight to the --execute step

For instance, the following example moves partition 0 of topic foo1 to brokers 5,6 and partition 1 of topic foo2 to brokers 2,3:

The first step is to hand craft the custom reassignment plan in a json file:

1
2
>
cat
custom-reassignment.json
{
"version"
:1,
"partitions"
:[{
"topic"
:
"foo1"
,
"partition"
:0,
"replicas"
:[5,6]},{
"topic"
:
"foo2"
,
"partition"
:1,
"replicas"
:[2,3]}]}

Then, use the json file with the --execute option to start the reassignment process:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
> bin
/kafka-reassign-partitions
.sh --zookeeper localhost:2181 --reassignment-json-
file
custom-reassignment.json --execute
Current partition replica assignment
 
{
"version"
:1,
"partitions"
:[{
"topic"
:
"foo1"
,
"partition"
:0,
"replicas"
:[1,2]},
              
{
"topic"
:
"foo2"
,
"partition"
:1,
"replicas"
:[3,4]}]
}
 
Save this to use as the --reassignment-json-
file
option during rollback
Successfully started reassignment of partitions
{
"version"
:1,
"partitions"
:[{
"topic"
:
"foo1"
,
"partition"
:0,
"replicas"
:[5,6]},
              
{
"topic"
:
"foo2"
,
"partition"
:1,
"replicas"
:[2,3]}]
}

The --verify option can be used with the tool to check the status of the partition reassignment. Note that the same expand-cluster-reassignment.json (used with the --execute option) should be used with the --verify option:

1
2
3
4
> bin
/kafka-reassign-partitions
.sh --zookeeper localhost:2181 --reassignment-json-
file
custom-reassignment.json --verify
Status of partition reassignment:
Reassignment of partition [foo1,0] completed successfully
Reassignment of partition [foo2,1] completed successfully

转载于:https://www.cnblogs.com/felixzh/p/8038827.html

你可能感兴趣的文章
输出日期
查看>>
hibernate中实体与数据库中属性对应的类型
查看>>
多线程池以及futures python新的线程包
查看>>
3389无法连接的5种原因分析
查看>>
C++拾遗(三)关于复合类型
查看>>
理解mvc
查看>>
WCF入门简单教程(图文) VS2010版
查看>>
jQuery EasyUI API 中文文档 - ComboBox组合框
查看>>
“ORA-12545: 因目标主机或对象不存在,连接失败”怎么办?
查看>>
DataList数据绑定的一个简单代码
查看>>
新闻页面的链接可以简单地实现了
查看>>
Internal关键字
查看>>
HIS项目框架搭建流程
查看>>
Access Control
查看>>
使用mpvue开发小程序教程(一)
查看>>
NOIP2013普及组 -SilverN
查看>>
substring和substr小结
查看>>
onbeforeunload与onunload事件
查看>>
android端的的网络访问
查看>>
escape()、encodeURI()、encodeURIComponent()区别详解
查看>>