美文网首页
kafka常用命令

kafka常用命令

作者: 4ea0af17fd67 | 来源:发表于2020-02-08 09:21 被阅读0次

以下是kafka常用命令行总结:

1.查看topic的详细信息

./kafka-topics.sh -zookeeper127.0.0.1:2181 -describe -topic test

2、为topic增加副本

./kafka-reassign-partitions.sh -zookeeper127.0.0.1:2181-reassignment-json-file json/partitions-to-move.json -execute

3、创建topic

./kafka-topics.sh --create --zookeeper localhost:2181--replication-factor1--partitions1--topic test

4、为topic增加partition

./bin/kafka-topics.sh –zookeeper127.0.0.1:2181–alter –partitions20–topic test

5、kafka生产者客户端命令

./kafka-console-producer.sh --broker-list localhost:9092--topic test

6、kafka消费者客户端命令

./kafka-console-consumer.sh -zookeeper localhost:2181--from-beginning --topic test

7、kafka服务启动

./kafka-server-start.sh -daemon ../config/server.properties

8、下线broker

./kafka-run-class.sh kafka.admin.ShutdownBroker --zookeeper127.0.0.1:2181--broker #brokerId# --num.retries3--retry.interval.ms60

shutdown broker

9、删除topic

./kafka-run-class.sh kafka.admin.DeleteTopicCommand --topic testKJ1 --zookeeper127.0.0.1:2181

相关文章

网友评论

      本文标题:kafka常用命令

      本文链接:https://www.haomeiwen.com/subject/bvwbxhtx.html