• kafka命令大全


    创建主题:

    创建主题(4个分区,2个副本)
    kafka-topics.sh --create --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --replication-factor 2 --partitions 4 --topic test

    查看集群详情:

    kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181

    查看集群中的topic列表:

    kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --list

    查看topic详情:

    kafka-topics.sh --describe --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test

    查看集群中的消费组列表:

    kafka-consumer-groups.sh --bootstrap-server  192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --list

    查看消费组的消费情况:

    kafka-consumer-groups.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --describe --group consumer-group(消费组的名称)

    生产者生产数据:

    kafka-console-producer.sh --broker-list 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test

    消费者消费数据:

    kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --topic test

    kafka-console-consumer.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --from-beginning --topic myz

    新消费者

    kafka-console-consumer.sh --bootstrap-server 192.168.130.37:9092,192.168.130.38:9092,192.168.130.39:9092 --topic test --new-consumer --from-beginning --consumer.config config/consumer.properties

    kafka-simple-consumer-shell.sh --brist localhost:9092 --topic test --partition 0 --offset 1234 --max-messages 10

    分区/扩容

    kafka-topics.sh --zookeeper 192.168.130.37:2181,192.168.130.38:2181,192.168.130.39:2181 --alter --topic topic-name --partitions 2

  • 相关阅读:
    学习 CosmosDB (NoSql)
    <linux-sed> sed基本用法
    grep 正则表达式用引号括起来和元字符加反斜杠转义的测试
    CACTI批量添加linux主机sh脚本
    一个简单的C共享库的创建及Python调用此库的方法
    Linux下的C的开发之GCC的初级使用
    AcitveReocrd事件和关联操作
    Samrty技术的 初步了解
    Ubuntu下配置Tomcat
    在ubuntu中安装jdk
  • 原文地址:https://www.cnblogs.com/yunger/p/12336242.html
Copyright © 2020-2023  润新知