码迷,mamicode.com
首页 > 其他好文 > 详细

kafka命令大全

时间:2020-02-20 16:55:38      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:simple   set   rap   sim   keep   ica   prope   replicat   OLE   

创建主题:

创建主题(4个分区,2个副本)
kafka-topics.sh --create --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --replication-factor 2 --partitions 4 --topic test

查看集群详情:

kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181

查看集群中的topic列表:

kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --list

查看topic详情:

kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test

查看集群中的消费组列表:

kafka-consumer-groups.sh --bootstrap-server  192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --list

查看消费组的消费情况:

kafka-consumer-groups.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --describe --group consumer-group(消费组的名称)

生产者生产数据:

kafka-console-producer.sh --broker-list 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test

消费者消费数据:

kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test

kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --from-beginning --topic myz

新消费者

kafka-console-consumer.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test --new-consumer --from-beginning --consumer.config config/consumer.properties

kafka-simple-consumer-shell.sh --brist localhost:9092 --topic test --partition 0 --offset 1234 --max-messages 10

分区/扩容

kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --alter --topic topic-name --partitions 2

 

kafka命令大全

标签:simple   set   rap   sim   keep   ica   prope   replicat   OLE   

原文地址:https://www.cnblogs.com/yunger/p/12336242.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!