蜡毕小鑫
2020-08-10 22:27
采纳率: 0%
浏览 4.1k
已结题

本地安装zookeeper测试时报错 Session 0x0 for server localhost/<unresolved>:2181, unexpected error, closing socket connection and attempting reconnect

问题描述:本地安装(window10系统)zookeeper,启动服务正常 ,如下:


D:\zookeeper-3.4.13\bin>call "D:\Java\jdk-14.0.1"\bin\java "-Dzookeeper.log.dir=D:\zookeeper-3.4.13\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\zookeeper-3.4.13\bin\..\build\classes;D:\zookeeper-3.4.13\bin\..\build\lib\*;D:\zookeeper-3.4.13\bin\..\*;D:\zookeeper-3.4.13\bin\..\lib\*;D:\zookeeper-3.4.13\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.4.13\bin\..\conf\zoo.cfg"
2020-08-10 22:19:40,303 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: D:\zookeeper-3.4.13\bin\..\conf\zoo.cfg
2020-08-10 22:19:40,307 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2020-08-10 22:19:40,308 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2020-08-10 22:19:40,308 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2020-08-10 22:19:40,309 [myid:] - WARN  [main:QuorumPeerMain@116] - Either no config or no quorum defined in config, running  in standalone mode
2020-08-10 22:19:40,380 [myid:] - INFO  [main:QuorumPeerConfig@136] - Reading configuration from: D:\zookeeper-3.4.13\bin\..\conf\zoo.cfg
2020-08-10 22:19:40,380 [myid:] - INFO  [main:ZooKeeperServerMain@98] - Starting server
2020-08-10 22:19:49,449 [myid:] - INFO  [main:Environment@100] - Server environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 04:05 GMT
2020-08-10 22:19:49,449 [myid:] - INFO  [main:Environment@100] - Server environment:host.name=DESKTOP-HLI2FBR
2020-08-10 22:19:49,449 [myid:] - INFO  [main:Environment@100] - Server environment:java.version=14.0.1
2020-08-10 22:19:49,449 [myid:] - INFO  [main:Environment@100] - Server environment:java.vendor=Oracle Corporation
2020-08-10 22:19:49,450 [myid:] - INFO  [main:Environment@100] - Server environment:java.home=D:\Java\jdk-14.0.1
2020-08-10 22:19:49,450 [myid:] - INFO  [main:Environment@100] - Server environment:java.class.path=D:\zookeeper-3.4.13\bin\..\build\classes;D:\zookeeper-3.4.13\bin\..\build\lib\*;D:\zookeeper-3.4.13\bin\..\zookeeper-3.4.13.jar;D:\zookeeper-3.4.13\bin\..\lib\audience-annotations-0.5.0.jar;D:\zookeeper-3.4.13\bin\..\lib\jline-0.9.94.jar;D:\zookeeper-3.4.13\bin\..\lib\log4j-1.2.17.jar;D:\zookeeper-3.4.13\bin\..\lib\netty-3.10.6.Final.jar;D:\zookeeper-3.4.13\bin\..\lib\slf4j-api-1.7.25.jar;D:\zookeeper-3.4.13\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\zookeeper-3.4.13\bin\..\conf
2020-08-10 22:19:49,450 [myid:] - INFO  [main:Environment@100] - Server environment:java.library.path=D:\Java\jdk-14.0.1\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Java\jdk-14.0.1\bin;D:\develop\apache-maven-3.6.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NGX;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Program Files (x86)\MySQL\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Program Files (x86)\Git\cmd;D:\Program Files (x86)\TortoiseGit\bin;D:\Program Files (x86)\VisualSVN Server\bin;D:\Program Files (x86)\TortoiseSVN\bin;C:\Users\BX\AppData\Local\Microsoft\WindowsApps;;D:\Program Files (x86)\Microsoft VS Code\bin;.
2020-08-10 22:19:49,450 [myid:] - INFO  [main:Environment@100] - Server environment:java.io.tmpdir=C:\Users\BX\AppData\Local\Temp\
2020-08-10 22:19:49,451 [myid:] - INFO  [main:Environment@100] - Server environment:java.compiler=<NA>
2020-08-10 22:19:49,451 [myid:] - INFO  [main:Environment@100] - Server environment:os.name=Windows 10
2020-08-10 22:19:49,452 [myid:] - INFO  [main:Environment@100] - Server environment:os.arch=amd64
2020-08-10 22:19:49,452 [myid:] - INFO  [main:Environment@100] - Server environment:os.version=10.0
2020-08-10 22:19:49,452 [myid:] - INFO  [main:Environment@100] - Server environment:user.name=BX
2020-08-10 22:19:49,452 [myid:] - INFO  [main:Environment@100] - Server environment:user.home=C:\Users\BX
2020-08-10 22:19:49,452 [myid:] - INFO  [main:Environment@100] - Server environment:user.dir=D:\zookeeper-3.4.13\bin
2020-08-10 22:19:49,457 [myid:] - INFO  [main:ZooKeeperServer@836] - tickTime set to 2000
2020-08-10 22:19:49,460 [myid:] - INFO  [main:ZooKeeperServer@845] - minSessionTimeout set to -1
2020-08-10 22:19:49,460 [myid:] - INFO  [main:ZooKeeperServer@854] - maxSessionTimeout set to -1
2020-08-10 22:19:49,538 [myid:] - INFO  [main:ServerCnxnFactory@117] - Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2020-08-10 22:19:49,539 [myid:] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181

但是使用zkCli.cmd测试时不断报错,如下:

Connecting to localhost:2181
2020-08-10 22:20:11,192 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 04:05 GMT
2020-08-10 22:20:11,195 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=DESKTOP-HLI2FBR
2020-08-10 22:20:11,195 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=14.0.1
2020-08-10 22:20:11,197 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2020-08-10 22:20:11,197 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=D:\Java\jdk-14.0.1
2020-08-10 22:20:11,197 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=D:\zookeeper-3.4.13\bin\..\build\classes;D:\zookeeper-3.4.13\bin\..\build\lib\*;D:\zookeeper-3.4.13\bin\..\zookeeper-3.4.13.jar;D:\zookeeper-3.4.13\bin\..\lib\audience-annotations-0.5.0.jar;D:\zookeeper-3.4.13\bin\..\lib\jline-0.9.94.jar;D:\zookeeper-3.4.13\bin\..\lib\log4j-1.2.17.jar;D:\zookeeper-3.4.13\bin\..\lib\netty-3.10.6.Final.jar;D:\zookeeper-3.4.13\bin\..\lib\slf4j-api-1.7.25.jar;D:\zookeeper-3.4.13\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\zookeeper-3.4.13\bin\..\conf
2020-08-10 22:20:11,198 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=D:\Java\jdk-14.0.1\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Java\jdk-14.0.1\bin;D:\develop\apache-maven-3.6.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NGX;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Program Files (x86)\MySQL\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Program Files (x86)\Git\cmd;D:\Program Files (x86)\TortoiseGit\bin;D:\Program Files (x86)\VisualSVN Server\bin;D:\Program Files (x86)\TortoiseSVN\bin;C:\Users\BX\AppData\Local\Microsoft\WindowsApps;;D:\Program Files (x86)\Microsoft VS Code\bin;.
2020-08-10 22:20:11,198 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=C:\Users\BX\AppData\Local\Temp\
2020-08-10 22:20:11,198 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2020-08-10 22:20:11,198 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Windows 10
2020-08-10 22:20:11,198 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2020-08-10 22:20:11,199 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=10.0
2020-08-10 22:20:11,199 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=BX
2020-08-10 22:20:11,199 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=C:\Users\BX
2020-08-10 22:20:11,199 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=D:\zookeeper-3.4.13\bin
2020-08-10 22:20:11,200 [myid:] - INFO  [main:ZooKeeper@442] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@1b40d5f0
Welcome to ZooKeeper!
2020-08-10 22:20:11,286 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1029] - Opening socket connection to server localhost/<unresolved>:2181. Will not attempt to authenticate using SASL (unknown error)
2020-08-10 22:20:11,291 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1168] - Session 0x0 for server localhost/<unresolved>:2181, unexpected error, closing socket connection and attempting reconnect
java.nio.channels.UnresolvedAddressException
        at java.base/sun.nio.ch.Net.checkAddress(Net.java:139)
        at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:727)
        at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:741)
        at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
        at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
        at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)
JLine support is enabled

请问大神如何解决?

3条回答 默认 最新

相关推荐 更多相似问题