首页 > 系统服务 > 详细

linux单机kafka配置

时间:2019-12-18 00:11:57      阅读:92      评论:0      收藏:0      [点我收藏+]

华为仓库下载kafka zookeeper
https://mirrors.huaweicloud.com/apache/kafka

zookeeper相关:

  • 解压:tar -zxvf zookeeper-3.4.10.tar.gz
  • 创建文件夹:mkdir -vp /usr/local/kafka
  • 切换到conf目录下: cd zookeeper-3.4.10/conf/
  • 修改zoo.cfg   cp zoo_sample.cfg zoo.cfg

    tickTime=2000
    initLimit=10
    syncLimit=5
    dataDir=/usr/local/zookeeper/data
    clientPort=2181

  • zookeeper环境变量vi /etc/profile

    export ZOOKEEPER_HOME=/usr/local/zookeeper/zookeeper-3.4.10
    export PATH=.:$ZOOKEEPER_HOME/bin:$JAVA_HOME/bin:$PATH
启动:sh zkServer.sh start
关闭:sh zkServer.sh stop

说明:zookeeper为什么需要配置环境变量,因为zookeeper不需要自己启动。kafka配置的时候会配置zookeeper,到时候会在kafka中启动zookeeper。

 

kafka相关

tar -zxvf kafka_2.12-1.0.0.tgz
kafka/kafka_2.12-1.0.0/config文件夹下面修改四个配置文件:
配置server.properties:
broker.id=0
port=9092
host.name=localhost
/usr/local/kafka/kafka_2.12-1.0.0/log (文件夹路径可能导致问题)
配置zookeeper.properties:
dataDir=/usr/local/kafka/kafka_2.12-1.0.0/zookeeper/data 
clientPort=2181
host.name=localhost
maxClientCnxns=0
配置producer.properties:
zookeeper.connect=localhost:2181
配置consumer.properties:
zookeeper.connect=localhost:2181

启动zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties
启动kafka
bin/kafka-server-start.sh config/server.properties

linux单机kafka配置

原文:https://www.cnblogs.com/windy13/p/12057456.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!