Windows平台整合SpringBoot+KAFKA__环境配置部分

2020-01-06 08:20:34来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

Windows平台整合SpringBoot+KAFKA__环境配置部分

项目需要,需要整合 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的安装及配置;


原文链接:https://www.cnblogs.com/alexgl2008/p/12145712.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:我的Java语言学习日志1_&quot;简单的银行管理系统实现&quot;

下一篇:JavaWeb学习——了解HTML