Windows平台整合SpringBoot+KAFKA__环境配置部分
程序员文章站
2022-03-21 17:09:07
项目需要,需要整合 SpringBoot+KAFKA 我调查了一下,发现Linux中,要先装zoomkeeper,再装KAFKA,如 https://blog.csdn.net/zhangcongyi420/article/details/88674491 我CA,我的机器搞不动,而且要搞的话,也要 ......
项目需要,需要整合 springboot+kafka
我调查了一下,发现linux中,要先装zoomkeeper,再装kafka,如 https://blog.csdn.net/zhangcongyi420/article/details/88674491
我ca,我的机器搞不动,而且要搞的话,也要搞好几个虚机一起弄个大数据平台环境,太麻烦,正考虑着呢,看到了下面
https://www.jianshu.com/p/5da86afed228
不错哦,试试
下载了zoopkeeper
apache-zookeeper-3.5.6-bin.tar.gz
保存到本地
d:\apache-zookeeper-3.5.6
按照网上的配置说明,我先配置在自己的zoomkeeper中
datadir=d:\\apache-zookeeper-3.5.6\\data
然后执行 zkserver
报错
c:\users\administrator>call "-dzookeeper.log.dir=d:\apache-zookeeper-3.5.6\bin\ ..\logs" "-dzookeeper.root.logger=info,console" "-dzookeeper.log.file=zookeeper- administrator-server-gaole.log" "-xx:+heapdumponoutofmemoryerror" "-xx:onoutofme moryerror=cmd /c taskkill /pid %%p /t /f" -cp "d:\apache-zookeeper-3.5.6\bin\..\ build\classes;d:\apache-zookeeper-3.5.6\bin\..\build\lib\*;d:\apache-zookeeper-3 .5.6\bin\..\*;d:\apache-zookeeper-3.5.6\bin\..\lib\*;d:\apache-zookeeper-3.5.6\b in\..\conf" org.apache.zookeeper.server.quorum.quorumpeermain "d:\apache-zookeep er-3.5.6\bin\..\conf\zoo.cfg" 文件名、目录名或卷标语法不正确。
上面有个 java_home报错引起了我的注意,不管怎么样,估计这个家伙要找java_home的,先满足它再说,毕竟我机器上装的开发环境都有自己的jdk,预先装的jdk无所谓给谁用
设置好java_home后,再执行 zkserver ,目测应该是过了;
2020-01-03 17:10:56,545 [myid:] - info [main:environment@109] - server environm ent:java.io.tmpdir=c:\users\admini~1\appdata\local\temp\ 2020-01-03 17:10:56,547 [myid:] - info [main:environment@109] - server environm ent:java.compiler=<na> 2020-01-03 17:10:56,547 [myid:] - info [main:environment@109] - server environm ent:os.name=windows 7 2020-01-03 17:10:56,548 [myid:] - info [main:environment@109] - server environm ent:os.arch=amd64 2020-01-03 17:10:56,548 [myid:] - info [main:environment@109] - server environm ent:os.version=6.1 2020-01-03 17:10:56,549 [myid:] - info [main:environment@109] - server environm ent:user.name=administrator 2020-01-03 17:10:56,549 [myid:] - info [main:environment@109] - server environm ent:user.home=c:\users\administrator 2020-01-03 17:10:56,550 [myid:] - info [main:environment@109] - server environm ent:user.dir=c:\users\administrator 2020-01-03 17:10:56,550 [myid:] - info [main:environment@109] - server environm ent:os.memory.free=114mb 2020-01-03 17:10:56,551 [myid:] - info [main:environment@109] - server environm ent:os.memory.max=1801mb 2020-01-03 17:10:56,552 [myid:] - info [main:environment@109] - server environm ent:os.memory.total=123mb 2020-01-03 17:10:56,555 [myid:] - info [main:zookeeperserver@938] - minsessiont imeout set to 4000 2020-01-03 17:10:56,555 [myid:] - info [main:zookeeperserver@947] - maxsessiont imeout set to 40000 2020-01-03 17:10:56,557 [myid:] - info [main:zookeeperserver@166] - created ser ver with ticktime 2000 minsessiontimeout 4000 maxsessiontimeout 40000 datadir d: apache-zookeeper-3.5.6data\version-2 snapdir d:apache-zookeeper-3.5.6data\versio n-2 2020-01-03 17:10:56,605 [myid:] - info [main:log@193] - logging initialized @63 1ms to org.eclipse.jetty.util.log.slf4jlog 2020-01-03 17:10:56,816 [myid:] - warn [main:contexthandler@1588] - o.e.j.s.ser vletcontexthandler@53b32d7{/,null,unavailable} contextpath ends with /* 2020-01-03 17:10:56,817 [myid:] - warn [main:contexthandler@1599] - empty conte xtpath 2020-01-03 17:10:56,834 [myid:] - info [main:server@370] - jetty-9.4.17.v201904 18; built: 2019-04-18t19:45:35.259z; git: aa1c656c315c011c01e7b21aabb04066635b9f 67; jvm 1.8.0_60-b27 2020-01-03 17:10:56,900 [myid:] - info [main:defaultsessionidmanager@365] - def aultsessionidmanager workername=node0 2020-01-03 17:10:56,901 [myid:] - info [main:defaultsessionidmanager@370] - no sessionscavenger set, using defaults 2020-01-03 17:10:56,906 [myid:] - info [main:housekeeper@149] - node0 scavengin g every 600000ms 2020-01-03 17:10:56,922 [myid:] - info [main:contexthandler@855] - started o.e. j.s.servletcontexthandler@53b32d7{/,null,available} 2020-01-03 17:10:56,959 [myid:] - info [main:abstractconnector@292] - started s erverconnector@3dd3bcd{http/1.1,[http/1.1]}{0.0.0.0:8080} 2020-01-03 17:10:56,960 [myid:] - info [main:server@410] - started @996ms 2020-01-03 17:10:56,960 [myid:] - info [main:jettyadminserver@112] - started ad minserver on address 0.0.0.0, port 8080 and command url /commands 2020-01-03 17:10:56,973 [myid:] - info [main:servercnxnfactory@135] - using org .apache.zookeeper.server.nioservercnxnfactory as server connection factory 2020-01-03 17:10:56,988 [myid:] - info [main:nioservercnxnfactory@673] - config uring nio connection handler with 10s sessionless connection timeout, 1 selector thread(s), 8 worker threads, and 64 kb direct buffers. 2020-01-03 17:10:56,992 [myid:] - info [main:nioservercnxnfactory@686] - bindin g to port 0.0.0.0/0.0.0.0:2181 2020-01-03 17:10:57,012 [myid:] - info [main:zkdatabase@117] - zookeeper.snapsh otsizefactor = 0.33 2020-01-03 17:10:57,017 [myid:] - info [main:filetxnsnaplog@384] - snapshotting : 0x0 to d:apache-zookeeper-3.5.6data\version-2\snapshot.0 2020-01-03 17:10:57,036 [myid:] - info [main:filetxnsnaplog@384] - snapshotting : 0x0 to d:apache-zookeeper-3.5.6data\version-2\snapshot.0 2020-01-03 17:10:57,058 [myid:] - info [main:containermanager@64] - using check intervalms=60000 maxperminute=10000
周末休息,暂停更新;
周一过来,接着搞kafka
按照此文描述,开始去下载一个kafka_2.12-2.4.0
然后修改配置文件,*惯,先备份,备份之后开始修改 server.properties
按照网上的说明,操作成功;启动kafka,一切正常;
with path version 1 (kafka.coordinator.transaction.produceridmanager) [2020-01-06 10:49:10,027] info [transactioncoordinator id=0] starting up. (kafka .coordinator.transaction.transactioncoordinator) [2020-01-06 10:49:10,031] info [transaction marker channel manager 0]: starting (kafka.coordinator.transaction.transactionmarkerchannelmanager) [2020-01-06 10:49:10,032] info [transactioncoordinator id=0] startup complete. ( kafka.coordinator.transaction.transactioncoordinator) [2020-01-06 10:49:10,086] info [expirationreaper-0-alteracls]: starting (kafka.s erver.delayedoperationpurgatory$expiredoperationreaper) [2020-01-06 10:49:10,172] info [/config/changes-event-process-thread]: starting (kafka.common.zknodechangenotificationlistener$changeeventprocessthread) [2020-01-06 10:49:10,265] info [socketserver brokerid=0] started data-plane proc essors for 1 acceptors (kafka.network.socketserver) [2020-01-06 10:49:10,280] info kafka version: 2.4.0 (org.apache.kafka.common.uti ls.appinfoparser) [2020-01-06 10:49:10,281] info kafka commitid: 77a89fcf8d7fa018 (org.apache.kafk a.common.utils.appinfoparser) [2020-01-06 10:49:10,282] info kafka starttimems: 1578278950272 (org.apache.kafk a.common.utils.appinfoparser) [2020-01-06 10:49:10,286] info [kafkaserver id=0] started (kafka.server.kafkaser ver)
注意:不要关了这个窗口,启用kafka前请确保zookeeper实例已经准备好并开始运行
按照文章介绍,依次设定topic,创建生产者、消费者,测试
测试成功,完成kafka的安装及配置;