kafka常用命令

1.kafka啟動(dòng): ./kafka-server-start.sh ../config/server.properties &

2.創(chuàng)建topic: ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic tes

3.查看kafka的topic:./kafka-topics.sh --zookeeper master:2181 --list

4.查看kafka某個(gè)topic下partition信息: ./kafka-topics.sh --describe --zookeeper master:2181 --topic test-topic

5.查看kafka的指定topic: ./kafka-topics.sh --zookeeper master:2181 --describe --topic yq20171220

6.控制臺(tái)向kafka生產(chǎn)數(shù)據(jù): ./kafka-console-producer.sh --broker-list master:9092 --topic jason_20180519

7.控制臺(tái)消費(fèi)kafka的數(shù)據(jù): ./kafka-console-consumer.sh --zookeeper storm1:2181 --topic jason_20180519 --from-beginning

8.查看topic下某分區(qū)偏移量的最小值: ./kafka-run-class.sh kafka.tools.GetOffsetShell --topic test-topic --time -1 --broker-list master:9092 --partitions 0

9.增加topic的partition:/kafka-topics.sh --alter --topic jason_20180519 --zookeeper 10.200.10.24:2181,10.200.10.26:2181,10.200.10.29:2181 --partitions 5

10.刪除topic,慎用,只會(huì)刪除zookeeper中的元數(shù)據(jù),消息文件須手動(dòng)刪除: ./kafka-run-class.sh kafka.admin.DeleteTopicCommand --zookeeper master:2181 --topic yq20171220

11.徹底刪除topic: rmr /brokers/topics/【topic name】即可

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容