zookeeper-NIOServerCnxn @ 383]-导致会话0x0关闭的异常:Len错误1195725856

时间:2019-04-18 18:27:37

标签: apache-zookeeper java-11

我正在尝试在Windows中安装Zookeeper。无论我在zookeeper + Kafka - Unable to create data directory中遵循哪个建议,我都会遇到以下错误提示。

我以管理员身份运行它,并且尝试了所有这些选项:

#dataDir=/tmp/zookeeper
#dataDir=:\zookeeper-3.4.14\
#dataDir=C:\\_d\\WSs\\kafka\\zookeeper-3.4.14\\data
#dataDir=:\\\\zookeeper\\\\data
dataDir=C:\\_d\\WSs\\kafka\\zookeeper-3.4.14

我认为这无关紧要,但让我在这里添加:我有Java 11。

任何知道为什么会发生的想法都会受到赞赏。

完整日志

C:\Windows\system32>zkserver

C:\Windows\system32>call "C:\Program Files\Java\jdk-11.0.2"\bin\java "-Dzookeeper.log.dir=C:\_d\WSs\kafka\zookeeper-3.4.14\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\build\classes;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\build\lib\*;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\*;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\*;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\conf\zoo.cfg"
2019-04-18 15:17:42,629 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\conf\zoo.cfg
2019-04-18 15:17:42,644 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2019-04-18 15:17:42,644 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2019-04-18 15:17:42,644 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2019-04-18 15:17:42,644 [myid:] - WARN  [main:QuorumPeerMain@116] - Either no config or no quorum defined in config, running  in standalone mode
2019-04-18 15:17:42,769 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\conf\zoo.cfg
2019-04-18 15:17:42,769 [myid:] - INFO  [main:ZooKeeperServerMain@98] - Starting server
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.14-4c25d480e66aadd371de8bd2fd8da255ac140bcf, built on 03/06/2019 16:18 GMT
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=DESKTOP-AKCNE7F
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=11.0.2
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=C:\Program Files\Java\jdk-11.0.2
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\build\classes;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\build\lib\*;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\zookeeper-3.4.14.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\audience-annotations-0.5.0.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\jline-0.9.94.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\log4j-1.2.17.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\netty-3.10.6.Final.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\slf4j-api-1.7.25.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\lib\slf4j-log4j12-1.7.25.jar;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\..\conf
2019-04-18 15:17:47,344 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=C:\Program Files\Java\jdk-11.0.2\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;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;C:\Program Files\Java\jdk-11.0.2\bin;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;C:\_d\tools\apache-maven-3.6.0\bin;C:\_d\WSs\kafka\zookeeper-3.4.14\bin\;C:\Users\jimis\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\jimis\AppData\Local\Programs\Python\Python37-32\;C:\Users\jimis\AppData\Local\Microsoft\WindowsApps;.
2019-04-18 15:17:47,360 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=C:\Users\jimis\AppData\Local\Temp\
2019-04-18 15:17:47,360 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2019-04-18 15:17:47,360 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Windows 10
2019-04-18 15:17:47,360 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2019-04-18 15:17:47,376 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=10.0
2019-04-18 15:17:47,376 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=jimis
2019-04-18 15:17:47,376 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=C:\Users\jimis
2019-04-18 15:17:47,376 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=C:\Windows\system32
2019-04-18 15:17:47,391 [myid:] - INFO  [main:ZooKeeperServer@836] - tickTime set to 2000
2019-04-18 15:17:47,391 [myid:] - INFO  [main:ZooKeeperServer@845] - minSessionTimeout set to -1
2019-04-18 15:17:47,391 [myid:] - INFO  [main:ZooKeeperServer@854] - maxSessionTimeout set to -1
2019-04-18 15:17:47,782 [myid:] - INFO  [main:ServerCnxnFactory@117] - Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2019-04-18 15:17:47,797 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181
2019-04-18 15:18:00,365 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@222] - Accepted socket connection from /127.0.0.1:54057
2019-04-18 15:18:00,375 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@222] - Accepted socket connection from /127.0.0.1:54058
2019-04-18 15:18:00,378 [myid:] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@383] - Exception causing close of session 0x0: Len error 1195725856
2019-04-18 15:18:00,379 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /127.0.0.1:54057 (no session established for client)

***已编辑

enter image description here

***已编辑

enter image description here

***我的问题的答案是“您可以忽略在curl 127.0.0.1:port时出现错误的事实。Kafka仍在工作。

enter image description here

1 个答案:

答案 0 :(得分:2)

您是否要对Zookeeper客户端端口执行“ HTTP GET”操作?

因此错误来自 NIOServerCnxn.java:readLength ,它期望使用4个字母的命令或缓冲区,其中前4个字节代表大小。

十六进制数字1195725856为0x47455420,以ASCII表示为“ GET”。

因此,当您尝试对2181端口执行HTTP GET时,会导致错误消息。

  $ curl http://0.0.0.0:2181/
curl:(52)来自服务器的空回复
$ sudo tail /var/log/zookeeper/zookeeper.out
...
2019-04-19 12:56:25,303 [myid:3]-信息[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory @ 215]-已接受
2019-04-19 12:56:25,304 [myid:3]-警告[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn @ 383]-导致会话0x0关闭的异常:Len错误1195725856
2019-04-19 12:56:25,304 [myid:3]-信息[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn @ 1040]-客户端/127.0.0.1:33011的套接字连接已关闭(否为客户建立的会话)
 

可以安全地忽略此 WARN 消息,因为ZooKeeper只会关闭 curl 响应所隐含的客户端会话。