zoukankan      html  css  js  c++  java
  • Windows 安装Kafka

    Windows 7 安装Apache kafka_2.11-0.9.0.1

       

    下载所需文件

    Zookeeper: http://www.apache.org/dyn/closer.cgi/zookeeper/

    Kafka :http://kafka.apache.org/downloads.html

       

       

    安装Zookeeper

    • 进入zookeeper设置目录,E:softelkzookeeper-3.4.8conf
    • 将"zoo_sample.cfg" 复制一份,重命名为"zoo.cfg"
    • 打开并编辑 并编辑dataDir=/tmp/zookeeper为指定目录为E:/soft/elk/zookeeper-3.4.8/data
    • 编辑环境变量,Path加 E:softelkzookeeper-3.4.8in
    • 运行cmd,输入zkserver ,成功如下

       

       

    安装Kafka

    打开CMD 到E:softelkkafka_2.11-0.9.0.1这个路径下

    输入binwindowskafka-server-start.bat configserver.properties

       

       

    现在Kafka已经准备好并开始运行,可以创建主题来存储消息了

       

    创建主题

    输入

    kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test1

       

       

    创建ProducerConsumer来测试服务器。

       

    输入

    kafka-console-producer.bat --broker-list localhost:9092 --topic test1

       

       

    再打开一个cmd,输入

    kafka-console-consumer.bat --zookeeper localhost:2181 --topic test1

       

       

       

    在producer命令行中任意输入内容,回车;在其他consumer命令行中能看到相应消息

       

       

       

       

       

       

       

       

  • 相关阅读:
    七夕祭
    Running Median
    电影Cinema
    Best Cow Fences
    Sumdiv
    Tallest Cow
    激光炸弹
    Strange Towers of Hanoi
    Gerald and Giant Chess
    CF24D Broken robot
  • 原文地址:https://www.cnblogs.com/liuyuhua/p/5329926.html
Copyright © 2011-2022 走看看