Kafka學習之四 Kafka經常使用命令

Kafka學習之四 Kafka經常使用命令

Kafka經常使用命令json

如下是kafka經常使用命令行總結:  學習

1.查看topic的詳細信息  ui

./kafka-topics.sh -zookeeper 127.0.0.1:2181 -describe -topic testKJ1  spa

二、爲topic增長副本  命令行

./kafka-reassign-partitions.sh -zookeeper 127.0.0.1:2181 -reassignment-json-file json/partitions-to-move.json -execute  server

三、建立topic blog

./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testKJ1  get

四、爲topic增長partition  kafka

./bin/kafka-topics.sh –zookeeper 127.0.0.1:2181 –alter –partitions 20 –topic testKJ1  it

五、kafka生產者客戶端命令  

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

六、kafka消費者客戶端命令  

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

七、kafka服務啓動  

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

八、下線broker  

./kafka-run-class.sh kafka.admin.ShutdownBroker --zookeeper 127.0.0.1:2181 --broker #brokerId# --num.retries 3 --retry.interval.ms 60  

shutdown broker  

九、刪除topic  

./kafka-run-class.sh kafka.admin.DeleteTopicCommand --topic testKJ1 --zookeeper 127.0.0.1:2181  

./kafka-topics.sh --zookeeper localhost:2181 --delete --topic testKJ1  

十、查看consumer組內消費的offset  

./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper localhost:2181 --group test --topic testKJ1

 

學習參考:

http://www.infoq.com/cn/articles/kafka-analysis-part-1

http://flychao88.iteye.com/category/350737

http://shift-alt-ctrl.iteye.com/blog/1930791

http://www.tuicool.com/articles/mErEZn

相關文章
相關標籤/搜索