kafka源码环境搭建

Kafka 专栏收录该内容
3 篇文章 0 订阅
kafka源码环境搭建
基于
    JDK 1.8.0_161
    kafka-0.10.0.1
    scala-2.12.6
    zookeeper-3.4.12
    gradle-4.5
开发工具 IDEA 2018.1.5

1.首先需要依次配置环境变量
    JDK 1.8.0_161、kafka-0.10.0.1、scala-2.12.6、zookeeper-3.4.12、gradle-4.5
2.启动zookeeper
    首先拷贝一份%ZOOKEEPER_HOME%\conf\zoo_sample.cfg 修改为zoo.cfg,修改zoo.cfg里面的dataDir=/tmp/zookeeper日志存储目录
    执行 zkserver

C:\Users\chenjianfei>zkserver

C:\Users\chenjianfei>call "D:\jdk1.8.0_161"\bin\java "-Dzookeeper.log.dir=D:\zookeeper-3.4.12\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\zookeeper-3.4.12\bin\..\build\classes;D:\zookeeper-3.4.12\bin\..\build\lib\*;D:\zookeeper-3.4.12\bin\..\*;D:\zookeeper-3.4.12\bin\..\lib\*;D:\zookeeper-3.4.12\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.4.12\bin\..\conf\zoo.cfg"
2018-07-07 10:25:49,583 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: D:\zookeeper-3.4.12\bin\..\conf\zoo.cfg
2018-07-07 10:25:49,583 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-07-07 10:25:49,583 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-07-07 10:25:49,583 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-07-07 10:25:49,583 [myid:] - WARN  [main:QuorumPeerMain@116] - Either no config or no quorum defined in config, running  in standalone mode
2018-07-07 10:25:49,645 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: D:\zookeeper-3.4.12\bin\..\conf\zoo.cfg
2018-07-07 10:25:49,645 [myid:] - INFO  [main:ZooKeeperServerMain@98] - Starting server
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=DESKTOP-6FVEB35
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=1.8.0_161
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=D:\jdk1.8.0_161\jre
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=D:\zookeeper-3.4.12\bin\..\build\classes;D:\zookeeper-3.4.12\bin\..\build\lib\*;D:\zookeeper-3.4.12\bin\..\zookeeper-3.4.12.jar;D:\zookeeper-3.4.12\bin\..\lib\audience-annotations-0.5.0.jar;D:\zookeeper-3.4.12\bin\..\lib\jline-0.9.94.jar;D:\zookeeper-3.4.12\bin\..\lib\log4j-1.2.17.jar;D:\zookeeper-3.4.12\bin\..\lib\netty-3.10.6.Final.jar;D:\zookeeper-3.4.12\bin\..\lib\slf4j-api-1.7.25.jar;D:\zookeeper-3.4.12\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\zookeeper-3.4.12\bin\..\conf
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=D:\jdk1.8.0_161\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\app\chenjianfei\product\11.2.0\client_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;D:\jdk1.8.0_161\bin;D:\apache-maven-3.5.2\bin;D:\Git\cmd;D:\gradle-4.5\bin;D:\scala-2.12.6\bin;D:\zookeeper-3.4.12\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\chenjianfei\AppData\Local\Microsoft\WindowsApps;;.
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=C:\Users\CHENJI~1\AppData\Local\Temp\
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Windows 10
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=10.0
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=chenjianfei
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=C:\Users\chenjianfei
2018-07-07 10:25:58,833 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=C:\Users\chenjianfei
2018-07-07 10:25:58,833 [myid:] - INFO  [main:ZooKeeperServer@835] - tickTime set to 2000
2018-07-07 10:25:58,833 [myid:] - INFO  [main:ZooKeeperServer@844] - minSessionTimeout set to -1
2018-07-07 10:25:58,833 [myid:] - INFO  [main:ZooKeeperServer@853] - maxSessionTimeout set to -1
2018-07-07 10:25:59,067 [myid:] - INFO  [main:ServerCnxnFactory@117] - Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2018-07-07 10:25:59,067 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181

3.IDEA 安装scala插件


4.指定gradle插件位置

5.IDEA导入kafka源码

    import 项目->选择gradle 完成


6.kafka服务启动准备

7.创建kafka producer启动准备

8.创建kafka consumer启动准备

9.依次启动

    kafka->producer->consumer

10.在producer控制台输入hello kafka,可以在consumer接收到hello kafka




  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 撸撸猫 设计师:马嘣嘣 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值