• Kafka常用命令


    Kafka常用命令
    启动Kafka服务kafka-server-start.sh
    ./bin/kafka-server-start.sh config/server.properties

    Topic操作Kafka-topics.sh
    创建Topic
    ./bin/kafka-topics.sh --create --topic test-topic --partitions 2 --replication-factor 1 --zookeeper localhost:2181

    删除Topic
    ./bin/kafka-topics.sh --delete --topic test-topic --zookeeper localhost:2181
    如果要删除topic,需先要在配置里添加delete.topic.enable=true

    显示当前所有Topic
    ./bin/kafka-topics.sh --list --zookeeper localhost:2181

    显示指定Topic详细信息
    ./bin/kafka-topics.sh --describe --topic test-topic --zookeeper localhost:2181

    重新分配分区
    ./bin/kafka-topics.sh --zookeeper localhost:2181 -alter --partitions 3 --topic test-topic

    控制台接收消息
    ./bin/kafka-console-consumer.sh --from-beginning --topic test-topic -zookeeper localhost:2181
     
    控制台发送消息
     ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test-topic
     
    显示Consumer的Group、Topic、分区ID、分区对应已经消费的Offset、logSize大小,Lag以及Owner等信息
    ./bin/kafka-consumer-offset-checker.sh --zookeeper localhost:2181 --topic test-topic --group xb_id --broker-info

    验证日志索引是否正确,或者想从log文件中直接答应消息
    ./kafka-run-class.sh kafka.tools.DumpLogSegments
    ./kafka-run-class.sh kafka.tools.DumpLogSegments /usr/local/kafka/logs/xb_topic-0/0000000000000000000033.log
    ./kafka-run-class.sh kafka.tools.DumpLogSegments --files /usr/local/kafka/logs/xb_topic-0/0000000000000000000033.log --print--data-log

    导出Zookeer中Group相关的偏移量
    有时候我们需要导出某个Consumer group各个分区的偏移量
    ./kafka-run-class.sh kafka.tools.ExportZKOffsets
    ./kafka-run-class.sh kafka.tools.ExportZKOffsets --group xb_id --zkconnect c13-138:2181,c13-139:2181,c13-141:2181 --output-file ~/offset
    vim ~/offset

  • 相关阅读:
    Extjs combobox
    Extjs中全键盘操作,回车跳到下一单元格
    MVC调试时遇到的URL问题
    不用插件 让Firefox 支持网页翻译
    aspNet各种模块介绍
    IntelliJ IDEA 激活
    The method getTextContent() is undefined for the type Node 错误解决
    svn服务器地址变更,客户端更改服务器地址方法
    IntelliJ IDEA中TortoiseSVN修改服务器地址的方法
    修改MyEclipse中的SVN地址
  • 原文地址:https://www.cnblogs.com/fansik/p/8252831.html
Copyright © 2020-2023  润新知