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



  • 相关阅读:
    CentOS7.2中安装MongoDB
    django 面试题
    python pandas库——pivot使用心得
    归并排序
    python实现归并排序,归并排序的详细分析
    二分法查找
    二叉树的遍历
    RabbitMQ(python实现)学习之一:简单两点传输“Hello World”的实现
    邻接表存储图,DFS遍历图的java代码实现
    五、python使用模块
  • 原文地址:https://www.cnblogs.com/pretty-ru/p/10837611.html
Copyright © 2011-2022 走看看