美文网首页
kafka搭建

kafka搭建

作者: MorningandSun | 来源:发表于2019-07-08 11:21 被阅读0次

    1.包下载
    链接:http://kafka.apache.org/quickstart
    mac 通过homebrew下载会更好
    2.使用步骤
    1.解析到你需要安装的目录

    tar -xzf kafka_2.12-2.2.0.tgz -C /路径(linux)
    2.启动zookeeper
    bin/zookeeper-server-start.sh config/zookeeper.properties
    3.启动kafka
    bin/kafka-server-start.sh config/server.properties
    4.创建topic
    bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic your topic
    5.产生消息
    bin/kafka-console-producer.sh --broker-list localhost:9092 --topic your topic
    6.消费消息
    bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
    7.打印topic
    bin/kafka-topics.sh --list --bootstrap-server localhost:9092

    3.踩坑记录
    1.无法消费和生产的情况,程序无法正常连接kafka的情况。
    (1).你的配置文件中配置的应该是外网ip(只需要配置advtance.licenscer即可)
    2.创建topic时提示exites
    删掉所有的kafaka 文件 重新解压即可。(这里你的topic可能创建到了zookeeper,或者是那里不清楚)
    4.在不清楚是是什么问题的情况下 首先通过测试kafka命令的收发消息,排除问题再进行其他问题的排查。

    相关文章

      网友评论

          本文标题:kafka搭建

          本文链接:https://www.haomeiwen.com/subject/amxohctx.html