mq中間件-kafka常用命令

啓動:

sh /home/software/kafkaserver/kafka1/bin/kafka-server-start.sh -daemon /home/software/kafkaserver/kafka1/config/server.properties

創建topic

sh /home/software/kafkaserver/kafka1/bin/kafka-topics.sh --create --zookeeper 192.168.0.26:2181 --replication-factor 1 --partitions 1 --topic test

查詢topic:

sh /home/software/kafkaserver/kafka1/bin/kafka-topics.sh --list --zookeeper localhost:2181
sh /home/software/kafkaserver/kafka1/bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test6

修改topic分區

sh /home/software/kafkaserver/kafka1/bin/kafka-topics.sh --alter --zookeeper localhost:2181 --partitions 1 --topic test6

查看分區

sh /home/software/kafkaserver/kafka1/bin/kafka-topics.sh --zookeeper localhost:2181 --topic test6 --describe

消費

sh /home/software/kafkaserver/kafka1/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --offset 693628

sh /home/software/kafkaserver/kafka1/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

刪除topic:

1 ./kafka-topics.sh --delete --zookeeper localhost:2181 --topic test6
2 刪除kafka存儲目錄(server.properties文件log.dirs配置,默認爲"/tmp/kafka-logs")相關topic目錄刪除zookeeper "/brokers/topics/"目錄下相關topic節點

查看消費進度:

./kafka-consumer-groups.sh --zookeeper localhost:9091 --describe --group testgrp

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章