修改副本数
来源:互联网 发布:阿里云学生机和腾讯云 编辑:程序博客网 时间:2024/04/28 11:21
1、确定需要增加副本的topic列表,确定topic的分区、副本详情信息,编写副本修改计划。例如原topic的partion个数为3,副本数为1
原topic副本分配情况如下
{"version":1,
"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000]},
{"topic":"rangertest","partition":1,"replicas":[10001]},
{"topic":"rangertest","partition":2,"replicas":[10002]}]
}
现需要分区数不变情况下增加副本数为2,现将重新分配后的topic分区、副本配置信息存储为json格式文件,命名为increase-replication-factor.json文件(文件名任意),
{"version":1,
"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000,10001]},
{"topic":"rangertest","partition":1,"replicas":[10001,10000]},
{"topic":"rangertest","partition":2,"replicas":[10002,10001]}]
}
2、执行增加副本数脚本命令、
> bin/kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --reassignment-json-file increase-replication-factor.json --execute
Current partition replica assignment
{"version":1,"partitions":[{"topic":"rangertest","partition":2,"replicas":[10002]},{"topic":"rangertest","partition":1,"replicas":[10001]},{"topic":"rangertest","partition":0,"replicas":[10000]}]}
Save this to use as the --reassignment-json-file option during rollback
Successfully started reassignment of partitions {"version":1,"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000,10001]},{"topic":"rangertest","partition":1,"replicas":[10001,10000]},{"topic":"rangertest","partition":2,"replicas":[10002,10001]}]}
3、脚本验证执行结果
bin/kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --reassignment-json-file increase-replication-factor.json --verify
Status of partition reassignment:
Reassignment of partition [rangertest,0] completed successfully
Reassignment of partition [rangertest,1] completed successfully
Reassignment of partition [rangertest,2] completed successfully
4、手动topic脚本验证也行
bin/kafka-topics.sh --zookeeper localhost:2181/kafka --topic rangertest --describe
Topic:rangertest PartitionCount:3 ReplicationFactor:2 Configs:
Topic: rangertest Partition: 0 Leader: 10000 Replicas: 10000,10001 Isr: 10000,10001
Topic: rangertest Partition: 1 Leader: 10001 Replicas: 10001,10000 Isr: 10001,10000
Topic: rangertest Partition: 2 Leader: 10002 Replicas: 10002,10001 Isr: 10002,10001
原topic副本分配情况如下
{"version":1,
"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000]},
{"topic":"rangertest","partition":1,"replicas":[10001]},
{"topic":"rangertest","partition":2,"replicas":[10002]}]
}
现需要分区数不变情况下增加副本数为2,现将重新分配后的topic分区、副本配置信息存储为json格式文件,命名为increase-replication-factor.json文件(文件名任意),
{"version":1,
"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000,10001]},
{"topic":"rangertest","partition":1,"replicas":[10001,10000]},
{"topic":"rangertest","partition":2,"replicas":[10002,10001]}]
}
2、执行增加副本数脚本命令、
> bin/kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --reassignment-json-file increase-replication-factor.json --execute
Current partition replica assignment
{"version":1,"partitions":[{"topic":"rangertest","partition":2,"replicas":[10002]},{"topic":"rangertest","partition":1,"replicas":[10001]},{"topic":"rangertest","partition":0,"replicas":[10000]}]}
Save this to use as the --reassignment-json-file option during rollback
Successfully started reassignment of partitions {"version":1,"partitions":[{"topic":"rangertest","partition":0,"replicas":[10000,10001]},{"topic":"rangertest","partition":1,"replicas":[10001,10000]},{"topic":"rangertest","partition":2,"replicas":[10002,10001]}]}
3、脚本验证执行结果
bin/kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --reassignment-json-file increase-replication-factor.json --verify
Status of partition reassignment:
Reassignment of partition [rangertest,0] completed successfully
Reassignment of partition [rangertest,1] completed successfully
Reassignment of partition [rangertest,2] completed successfully
4、手动topic脚本验证也行
bin/kafka-topics.sh --zookeeper localhost:2181/kafka --topic rangertest --describe
Topic:rangertest PartitionCount:3 ReplicationFactor:2 Configs:
Topic: rangertest Partition: 0 Leader: 10000 Replicas: 10000,10001 Isr: 10000,10001
Topic: rangertest Partition: 1 Leader: 10001 Replicas: 10001,10000 Isr: 10001,10000
Topic: rangertest Partition: 2 Leader: 10002 Replicas: 10002,10001 Isr: 10002,10001
0 0
- 修改副本数
- 修改topic分区数和副本数
- kafka修改分区和副本数
- Trafodion 使用Hadoop命令修改Trafodion表的副本数
- hadoop副本数设置
- 副本限制修改-M端
- Hadoop集群节点扩展之后,更改HDFS数据副本数
- Hadoop维护实战-设置hdfs副本数 dfs.replication
- es 建索引时指定分片数据和副本数
- mongodb单机修改为副本集的步骤
- 修改mongodb3.0副本集用户密码遇到的坑
- 【MongoDB学习笔记32】MongoDB修改副本集配置
- 修改blog点击数
- 修改文件句柄数
- 修改Oracle连接数
- 修改IIS连接数
- oracle 修改连接数
- 修改文件句柄数
- 在一个千万级的数据库查寻中,如何提高查询效率?
- AndroidStudio导入jar包
- UNITY3D在IOS开发下的反射机制限制
- AndroidStudio Debug断点卡在Waiting For Debugger
- flex项目下的html-template 文件夹的作用
- 修改副本数
- 解决了Flex在tomcat部署下不能显示地图的问题
- RPC原理探究
- 在flex中取得本地路径名
- 转:Flex判断数据类型的几种方法
- arcgis10.1如何注册sde
- 转:Java+blazeds+Flex的例子 .
- <转>使用IdentifyTask查询图层属性
- 转 ArcGIS Runtime 加载SHAPE数据的另一种方式-动态图层 .