微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Kafka基本使用二

查看topic列表
bin/kafka-topics.sh --bootstrap-server localhost:9093 --list
创建topic
bin/kafka-topics.sh --create --zookeeper sf01.tendcloud.com:2181 --replication-factor 2 --partitions 2 --topic fl0316
查看offset
bin/kafka-run-class.sh kafka.tools.GetoffsetShell --broker-list localhost:9093 --topic fl0316
查看分区详情
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic fl0316
生产数据
bin/kafka-console-producer.sh --broker-list localhost:9093 --topic fl0316
消费数据
bin/kafka-console-consumer.sh --bootstrap-server localhost:9093 --consumer-property group.id=fl0315-c --topic fl0316
新增topic的partitions
bin/kafka-topics.sh --alter --zookeeper localhost:2181 --partitions 5 --topic fl0316
自动分区
bin/kafka-reassign-partitions.sh --zookeeper localhost:2181 --topics-to-move-json-file topic-to-move.json --broker-list “0,1,2,3” --generate
执行分区
bin/kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file p.json --execute
确认分区信息
bin/kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file p.json --verify
删除topic
bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic fl0316

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐