zoukankan      html  css  js  c++  java
  • Kafka&&Zookeeper基本管理命令

    1. zookeeper管理命令

    #启动zookeeper
    bin/zkServer.sh start(默认以zoo.cfg文件启动)
    
    bin/zkServer.sh start conf/zoo.cfg
    
    #查看状态
    bin/zkServer.sh status
    
    #重新启动
    bin/zkServer.sh restart
    
    #停止zookeeper
    
    bin/zkServer.sh stop
    

    2. kafka管理命令

    #启动kafka
    bin/kafka-server-start.sh config/server.properties &
    
    bin/kafka-server-start.sh -daemon  config/server.properties
    
    #停止kafka
    bin/kafka-server-stop.sh
    
    #生产者
    bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test    
     
    #消费者
    bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic test
    
    # 如果需要从头开始接收数据,需要添加--from-beginning参数
    bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --from-beginning --topic test
    
    #创建topic
    bin/kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic topicA
     
    #查看topic列表
    bin/kafka-topics.sh --list --zookeeper 127.0.0.1:2181
     
    #如果需要查看topic的详细信息,需要使用describe命令
    bin/kafka-topics.sh --describe --zookeeper 127.0.0.1:2181 --topic topicA
     
    #若不指定topic,则查看所有topic
    bin/kafka-topics.sh --describe --zookeeper 127.0.0.1:2181
     
    #删除topic
    bin/kafka-topics.sh --delete --zookeeper 127.0.0.1:2181 --topic topicA
    
  • 相关阅读:
    python 2
    Python 1 practice
    python 1
    Python多线程_笔记
    背景自适应不会随浏览器界面放大速效而改变
    平行四边形定理
    动态规划3(区间+树形)
    素数快速生成
    设CPU共有16根地址线,8根数据线,,,
    贪心+huffman编码+模拟退火+分治
  • 原文地址:https://www.cnblogs.com/yvanme/p/13097640.html
Copyright © 2011-2022 走看看