zoukankan      html  css  js  c++  java
  • kafka指令

    后台形式启动kafka

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

    查询当前所有 topic 

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

    创建生产者

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

    启动消费者

     ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testkafka --from-beginning

    完美

    转载:

    https://www.orchome.com/454

    问题汇总:

    1.

    在做kafka测试的时候,使用命令bin/kafka-console-consumer.sh --zookeeper 192.168.0.140:2181,192.168.0.141:2181 --topic test --from-beginning启动消费者,发现一只报错consumer zookeeper is not a recognized option,搜索了半天,一只没有解决,最后,换了一个低版本的kakfa,发现在启动的时候说使用 --zookeeper是一个过时的方法,此时,才知道原来在最新的版本中,这种启动方式已经被删除了,
    最后附上0.90版本之后启动消费者的方法: bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
    2.
     WARN [Consumer clientId=consumer-1, groupId=console-consumer-77498] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
    说明broker挂掉了,在zookeeper上可以查看当前运行的broker数量
    在zkCli.sh打开命令行后,ls /brokers/ids查看当前运行的broker数量
    为什么会发生这个问题,因为meta.properties(在tmp或者logs目录下)跟service.properties(在config目录下)中的brokerid不一致造成的。
    部分资料直接复制网络中其他文章,仅供个人参考学习
  • 相关阅读:
    NIO与普通IO文件读写性能对比
    JAVA学习.java.sql.date 与java.util.date以及gettime()方法的分析
    软件工程之软件设计
    ubuntu下管理android手机
    AFNetworking2.0 NSHipster翻译
    【Jsoup爬取网页内容】
    IOS 表视图UITableView 束NSBundle
    如何将位图格式图片文件(.bmp)生成geotiff格式图片?
    opencv3 使用glob遍历并修改文件名
    Ubuntu clion下载及激活
  • 原文地址:https://www.cnblogs.com/decq/p/11992751.html
Copyright © 2011-2022 走看看