zoukankan      html  css  js  c++  java
  • Kafka常用命令

    1.topic相关
    1.1 查看kafka集群的所有topic

    ./bin/kafka-topics.sh --list --zookeeper localhost:2181

    1.2 创建名称为topic_test的topic,patitions为1个,副本为1个

    .bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --patitions 1 --topic topic_test

    1.3 为topic_test添加patition为10

    .bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic topic_test --partitions 10

    1.4 删除名称为topic_test的topic(只删除zookeeper内的元素,消失文件须手动删除)

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

    1.5 查看topic为topic_test的详细信息

    .bin/kafka-topics.sh --zookeeper localhost:2181 -describe -topic topic_test

    2.consumer相关

    2.1 查看所有consumer的group

    .bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list

    2.2 查看group为group_test消费的机器以及partition

    ./bin/kafka-consumer-groups.sh --describe --group group_test --bootstrap-server localhost:9092

    3.控制台相关

     3.1 控制台向topic_test发送数据

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

    3.2 控制台接收topic_test数据

    .bin/kafka-console-consumer.sh --bootstrap-server localhost:9002 --topic topic_test --from-beginning

    4.服务相关

     4.1 启动zookeeper服务

    ./bin/zookeeper-server-start.sh -daemon ../config/zookeeper.properties

    4.2. 启动kafka服务

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

    4.3 查看服务启动

    ps -ef | grep kafka



  • 相关阅读:
    iis aspx常见错误 没有对“C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files”的写访问权限。
    Windows 下 Apache HTTP Server 安装、配置以及与 Tomcat 的整合(附图)
    Xstudio+Bugzilla
    测试管理工具列表大全
    bitmap详细介绍
    Android学习绘制图形
    PorterDuff.Mode
    盒模型及文本溢出
    css属性继承
    CSS层叠样式
  • 原文地址:https://www.cnblogs.com/pretty-ru/p/10837611.html
Copyright © 2011-2022 走看看