0
点赞
收藏
分享

微信扫一扫

kafka分区重建

小桥流水2016 2024-07-24 阅读 19

创建kafka的topic:
./bin/kafka-topics.sh --create --zookeeper 192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --replication-factor 3 --partitions 3 --topic test01

列举kafka的topic:
 ./bin/kafka-topics.sh --zookeeper 192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --list

kafka 修改topic分区数据:
 ./bin/kafka-topics.sh --zookeeper
192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 -alter --partitions 3 --topic test01

数据均衡:
vi sjzn_spark_binlog_order_topic.json
生成主题分配方案:
 ./bin/kafka-reassign-partitions.sh --zookeeper
192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --topics-to-move-json-file sjzn_spark_binlog_order_topic.json --broker-list "0,1,2" --generate Current partition replica assignment

拷贝分配方案到新的json文件中
vi expand-cluster-reassignment.json
执行分配:
./bin/kafka-reassign-partitions.sh --zookeeper
192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --reassignment-json-file expand-cluster-reassignment.json --execute Current partition replica assignment

查看分区状态:
./bin/kafka-reassign-partitions.sh --zookeeper
192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --reassignment-json-file expand-cluster-reassignment.json --verify

单独查看topic分区状态:
 ./bin/kafka-topics.sh --describe --zookeeper 192.168.70.212:2181,192.168.70.213:2181,192.168.70.214:2181 --topic dwd_all_metric

举报

相关推荐

0 条评论