zoukankan      html  css  js  c++  java
  • Kafka学习之四 Kafka常用命令

    Kafka常用命令

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

    1.查看topic的详细信息  

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

    2、为topic增加副本  

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

    3、创建topic 

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

    4、为topic增加partition  

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

    5、kafka生产者客户端命令  

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

    6、kafka消费者客户端命令  

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

    7、kafka服务启动  

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

    8、下线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  

    9、删除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  

    10、查看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

     

  • 相关阅读:
    Exercise02_09
    Exercise02_05
    Exercise02_01
    Exercise02_03
    Exercise02_07
    web.xml配置详解
    面对不成功的人生
    请不以结婚为目的的恋爱吧
    年轻人能为世界做点什么
    不作就不会活
  • 原文地址:https://www.cnblogs.com/heidsoft/p/7697965.html
Copyright © 2011-2022 走看看