• Kafka 安装配置 windows 下


    Kafka 安装配置 windows 下

    标签(空格分隔): Kafka

    Kafka 内核部分需要安装jdk, zookeeper.

    安装JDK

    安装JDK就不需要讲解了,安装完配置下JAVA_HOME,和Path,将java安装目录和运行文件目录配置下就ok拉。
    安装地址: 下载

    安装 zookeeper

    安装地址:下载
    安装完zookeeper 需要配置如下信息:

    下载后,解压放在目录D:igdata(本文所用的目录)下,关于zookeeper以及kafka的目录,路径中最好不要出现空格,比如D:Program Files,尽量别用,运行脚本时会有问题。

    1.进入zookeeper的相关设置所在的文件目录,例如本文的:D:igdatazookeeper-3.4.10conf
    2.将"zoo_sample.cfg"重命名为"zoo.cfg"
    3.打开zoo.cfg(至于使用什么编辑器,根据自己喜好选即可),找到并编辑:
    dataDir=/tmp/zookeeper to D:/bigdata/zookeeper-3.4.10/data或 D:igdatazookeeper-3.4.10data(路径仅为示例,具体可根据需要配置)
    这里注意,路径要么是"/"分割,要么是转义字符"",这样会生成正确的路径(层级,子目录)。
    4.与配置jre类似,在系统环境变量中添加:
    a.系统变量中添加ZOOKEEPER_HOME=D:igdatazookeeper-3.4.10
    b.编辑系统变量中的path变量,增加%ZOOKEEPER_HOME%in
    5在zoo.cfg文件中修改默认的Zookeeper端口(默认端口2181)

    这是本文最终的zoo.cfg文件的内容:

    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial 
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between 
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    # do not use /tmp for storage, /tmp here is just 
    # example sakes.
    dataDir=D:/bigdata/zookeeper-3.4.10/data
    #dataDir=D:\bigdata\zookeeper-3.4.10\data
    # the port at which the clients will connect
    clientPort=2181
    # the maximum number of client connections.
    # increase this if you need to handle more clients
    #maxClientCnxns=60
    #
    # Be sure to read the maintenance section of the 
    # administrator guide before turning on autopurge.
    #
    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    #
    # The number of snapshots to retain in dataDir
    #autopurge.snapRetainCount=3
    # Purge task interval in hours
    # Set to "0" to disable auto purge feature
    #autopurge.purgeInterval
    

    安装Kafka

    1. 下载地址: 下载
    2. 安装配置:
      要下载Binary downloads这个类型,不要下载源文件,这种方便使用。下载后,解压放在D:igdata目录下。

    ①进入kafka配置文件所在目录,D:igdatakafka_2.11-0.9.0.1config

    ②编辑文件"server.properties",找到并编辑:

    log.dirs=/tmp/kafka-logs to log.dirs=D:/bigdata/kafka_2.11-0.9.0.1/kafka-logs 或者 D:igdatakafka_2.11-0.9.0.1kafka-logs

    同样注意:路径要么是"/"分割,要么是转义字符"",这样会生成正确的路径(层级,子目录)。错误路径情况可自行尝试,文件夹名为这种形式:bigdatakafka_2.11-0.9.0.1kafka-logs

    ③在server.properties文件中,zookeeper.connect=localhost:2181代表kafka所连接的zookeeper所在的服务器IP以及端口,可根据需要更改。本文在同一台机器上使用,故不用修改。

    ④kafka会按照默认配置,在9092端口上运行,并连接zookeeper的默认端口2181。

    运行Kafka

    CMD进入安装目录 输入命令 .inwindowskafka-server-start.bat .configserver.properties 即可运行

    注意:这个里面会报错,报找不到kafka.Kafka类
    需要进入kafka-class-run文件里面改下配置。%ClassPath% 加上双引号"%ClassPath%"

  • 相关阅读:
    预备作业2
    我期待的师生关系
    20162317袁逸灏 第四周实验报告
    《程序设计与数据结构》第4周学习总结
    《程序设计与数据结构》第3周学习总结
    20162317 《程序设计与数据结构》第2周学习总结
    学号20162317《程序设计与数据结构》第1周学习总结
    预备作业03
    预备作业02
    20162317袁逸灏
  • 原文地址:https://www.cnblogs.com/swneng/p/10212460.html
Copyright © 2020-2023  润新知