C:\WINDOWS\system32>zkserver

C:\WINDOWS\system32>call "D:\Java\jdk"\bin\java "-Dzookeeper.log.dir=D:\zookeeper\zookeeper-3.5.6\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-86188-server-DESKTOP-D1O68NK.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper\zookeeper-3.5.6\bin\..\build\classes;D:\zookeeper\zookeeper-3.5.6\bin\..\build\lib\*;D:\zookeeper\zookeeper-3.5.6\bin\..\*;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\*;D:\zookeeper\zookeeper-3.5.6\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper\zookeeper-3.5.6\bin\..\conf\zoo.cfg"
错误: 找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain

解决方法:

总结:原来从目前的最新版本3.5.5开始,带有bin名称的包才是我们想要的下载可以直接使用的里面有编译后的二进制的包,而之前的普通的tar.gz的包里面是只是源码的包无法直接使用。

所以同学们,如果下载3.5.5以后的版本的Zookeeper安装包,我们乖乖的下载带有bin标识的包就不会有问题了。

成功运行如下:

C:\Windows\System32>zkserver

C:\Windows\System32>call "D:\Java\jdk"\bin\java "-Dzookeeper.log.dir=D:\zookeeper\zookeeper-3.5.6\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-86188-server-DESKTOP-D1O68NK.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper\zookeeper-3.5.6\bin\..\build\classes;D:\zookeeper\zookeeper-3.5.6\bin\..\build\lib\*;D:\zookeeper\zookeeper-3.5.6\bin\..\*;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\*;D:\zookeeper\zookeeper-3.5.6\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper\zookeeper-3.5.6\bin\..\conf\zoo.cfg"
2020-01-06 15:36:58,960 [myid:] - INFO  [main:QuorumPeerConfig@133] - Reading configuration from: D:\zookeeper\zookeeper-3.5.6\bin\..\conf\zoo.cfg
2020-01-06 15:36:58,964 [myid:] - WARN  [main:VerifyingFileFactory@59] - D:zookeeperdata is relative. Prepend .\ to indicate that you're sure!
2020-01-06 15:36:58,970 [myid:] - INFO  [main:QuorumPeerConfig@385] - clientPortAddress is 0.0.0.0/0.0.0.0:2181
2020-01-06 15:36:58,971 [myid:] - INFO  [main:QuorumPeerConfig@389] - secureClientPort is not set
2020-01-06 15:36:58,974 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2020-01-06 15:36:58,974 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2020-01-06 15:36:58,974 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2020-01-06 15:36:58,975 [myid:] - WARN  [main:QuorumPeerMain@125] - Either no config or no quorum defined in config, running  in standalone mode
2020-01-06 15:36:58,992 [myid:] - INFO  [main:ManagedUtil@46] - Log4j found with jmx enabled.
2020-01-06 15:36:59,041 [myid:] - INFO  [main:QuorumPeerConfig@133] - Reading configuration from: D:\zookeeper\zookeeper-3.5.6\bin\..\conf\zoo.cfg
2020-01-06 15:36:59,042 [myid:] - WARN  [main:VerifyingFileFactory@59] - D:zookeeperdata is relative. Prepend .\ to indicate that you're sure!
2020-01-06 15:36:59,042 [myid:] - INFO  [main:QuorumPeerConfig@385] - clientPortAddress is 0.0.0.0/0.0.0.0:2181
2020-01-06 15:36:59,043 [myid:] - INFO  [main:QuorumPeerConfig@389] - secureClientPort is not set
2020-01-06 15:36:59,043 [myid:] - INFO  [main:ZooKeeperServerMain@117] - Starting server
2020-01-06 15:36:59,046 [myid:] - INFO  [main:FileTxnSnapLog@103] - zookeeper.snapshot.trust.empty : false
2020-01-06 15:37:08,095 [myid:] - INFO  [main:Environment@109] - Server environment:zookeeper.version=3.5.6-c11b7e26bc554b8523dc929761dd28808913f091, built on 10/08/2019 20:18 GMT
2020-01-06 15:37:08,097 [myid:] - INFO  [main:Environment@109] - Server environment:host.name=DESKTOP-D1O68NK
2020-01-06 15:37:08,104 [myid:] - INFO  [main:Environment@109] - Server environment:java.version=1.8.0_91
2020-01-06 15:37:08,105 [myid:] - INFO  [main:Environment@109] - Server environment:java.vendor=Oracle Corporation
2020-01-06 15:37:08,106 [myid:] - INFO  [main:Environment@109] - Server environment:java.home=D:\Java\jdk\jre
2020-01-06 15:37:08,107 [myid:] - INFO  [main:Environment@109] - Server environment:java.class.path=D:\zookeeper\zookeeper-3.5.6\bin\..\build\classes;D:\zookeeper\zookeeper-3.5.6\bin\..\build\lib\*;D:\zookeeper\zookeeper-3.5.6\bin\..\*;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\audience-annotations-0.5.0.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\commons-cli-1.2.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jackson-annotations-2.9.10.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jackson-core-2.9.10.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jackson-databind-2.9.10.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\javax.servlet-api-3.1.0.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-http-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-io-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-security-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-server-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-servlet-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jetty-util-9.4.17.v20190418.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\jline-2.11.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\json-simple-1.1.1.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\log4j-1.2.17.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-buffer-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-codec-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-common-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-handler-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-resolver-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-transport-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-transport-native-epoll-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\netty-transport-native-unix-common-4.1.42.Final.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\slf4j-api-1.7.25.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\zookeeper-3.5.6.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\lib\zookeeper-jute-3.5.6.jar;D:\zookeeper\zookeeper-3.5.6\bin\..\conf
2020-01-06 15:37:08,108 [myid:] - INFO  [main:Environment@109] - Server environment:java.library.path=D:\Java\jdk\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;D:\Program Files (x86)\NetSarang\Xshell 6\;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;D:\phpStudy\PHPTutorial\php\php-7.1.13-nts;D:\Program Files\Python\Python37;D:\Java\jdk\bin\;D:\Program Files\TortoiseGit\bin;D:\Program Files\Git\cmd;D:\Anaconda3\condabin;D:\Go\bin;D:\hadoop\hadoop-2.6.5\bin\;D:\scala\bin;D:\scala\bin;D:\scala\jre\bin;D:\hbase\hbase-1.3.5\bin;D:\zookeeper\zookeeper-3.5.6\bin;D:\Anaconda3;D:\Anaconda3\Library\mingw-w64\bin;D:\Anaconda3\Library\usr\bin;D:\Anaconda3\Library\bin;D:\Anaconda3\Scripts;C:\Users\86188\AppData\Local\Microsoft\WindowsApps;D:\Program Files\JetBrains\PyCharm 2019.1.2\bin;D:\Program Files\Docker Toolbox;D:\Program Files\JetBrains\IntelliJ IDEA 2019.1.2\bin;D:\Program Files\Fiddler;D:\Program Files\JetBrains\GoLand 2019.1.3\bin;C:\Users\86188\AppData\Local\BypassRuntm;C:\Users\86188\AppData\Local\Microsoft\WindowsApps;;D:\Program Files\JetBrains\IntelliJ IDEA 2018.3.3\bin;;.
2020-01-06 15:37:08,117 [myid:] - INFO  [main:Environment@109] - Server environment:java.io.tmpdir=C:\Users\86188\AppData\Local\Temp\
2020-01-06 15:37:08,121 [myid:] - INFO  [main:Environment@109] - Server environment:java.compiler=<NA>
2020-01-06 15:37:08,122 [myid:] - INFO  [main:Environment@109] - Server environment:os.name=Windows 10
2020-01-06 15:37:08,123 [myid:] - INFO  [main:Environment@109] - Server environment:os.arch=amd64
2020-01-06 15:37:08,124 [myid:] - INFO  [main:Environment@109] - Server environment:os.version=10.0
2020-01-06 15:37:08,132 [myid:] - INFO  [main:Environment@109] - Server environment:user.name=86188
2020-01-06 15:37:08,133 [myid:] - INFO  [main:Environment@109] - Server environment:user.home=C:\Users\86188
2020-01-06 15:37:08,133 [myid:] - INFO  [main:Environment@109] - Server environment:user.dir=C:\Windows\System32
2020-01-06 15:37:08,135 [myid:] - INFO  [main:Environment@109] - Server environment:os.memory.free=234MB
2020-01-06 15:37:08,135 [myid:] - INFO  [main:Environment@109] - Server environment:os.memory.max=3609MB
2020-01-06 15:37:08,137 [myid:] - INFO  [main:Environment@109] - Server environment:os.memory.total=243MB
2020-01-06 15:37:08,144 [myid:] - INFO  [main:ZooKeeperServer@938] - minSessionTimeout set to 4000
2020-01-06 15:37:08,147 [myid:] - INFO  [main:ZooKeeperServer@947] - maxSessionTimeout set to 40000
2020-01-06 15:37:08,148 [myid:] - INFO  [main:ZooKeeperServer@166] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir D:zookeeperdata\version-2 snapdir D:zookeeperdata\version-2
2020-01-06 15:37:08,185 [myid:] - INFO  [main:Log@193] - Logging initialized @9412ms to org.eclipse.jetty.util.log.Slf4jLog
2020-01-06 15:37:08,305 [myid:] - WARN  [main:ContextHandler@1588] - o.e.j.s.ServletContextHandler@53b32d7{/,null,UNAVAILABLE} contextPath ends with /*
2020-01-06 15:37:08,305 [myid:] - WARN  [main:ContextHandler@1599] - Empty contextPath
2020-01-06 15:37:08,321 [myid:] - INFO  [main:Server@370] - jetty-9.4.17.v20190418; built: 2019-04-18T19:45:35.259Z; git: aa1c656c315c011c01e7b21aabb04066635b9f67; jvm 1.8.0_91-b15
2020-01-06 15:37:08,365 [myid:] - INFO  [main:DefaultSessionIdManager@365] - DefaultSessionIdManager workerName=node0
2020-01-06 15:37:08,366 [myid:] - INFO  [main:DefaultSessionIdManager@370] - No SessionScavenger set, using defaults
2020-01-06 15:37:08,369 [myid:] - INFO  [main:HouseKeeper@149] - node0 Scavenging every 600000ms
2020-01-06 15:37:08,379 [myid:] - INFO  [main:ContextHandler@855] - Started o.e.j.s.ServletContextHandler@53b32d7{/,null,AVAILABLE}
2020-01-06 15:37:08,410 [myid:] - INFO  [main:AbstractConnector@292] - Started ServerConnector@3dd3bcd{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2020-01-06 15:37:08,411 [myid:] - INFO  [main:Server@410] - Started @9644ms
2020-01-06 15:37:08,413 [myid:] - INFO  [main:JettyAdminServer@112] - Started AdminServer on address 0.0.0.0, port 8080 and command URL /commands
2020-01-06 15:37:08,420 [myid:] - INFO  [main:ServerCnxnFactory@135] - Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2020-01-06 15:37:08,423 [myid:] - INFO  [main:NIOServerCnxnFactory@673] - Configuring NIO connection handler with 10s sessionless connection timeout, 2 selector thread(s), 16 worker threads, and 64 kB direct buffers.
2020-01-06 15:37:08,429 [myid:] - INFO  [main:NIOServerCnxnFactory@686] - binding to port 0.0.0.0/0.0.0.0:2181
2020-01-06 15:37:08,441 [myid:] - INFO  [main:ZKDatabase@117] - zookeeper.snapshotSizeFactor = 0.33
2020-01-06 15:37:08,444 [myid:] - INFO  [main:FileTxnSnapLog@384] - Snapshotting: 0x0 to D:zookeeperdata\version-2\snapshot.0
2020-01-06 15:37:08,448 [myid:] - INFO  [main:FileTxnSnapLog@384] - Snapshotting: 0x0 to D:zookeeperdata\version-2\snapshot.0
2020-01-06 15:37:08,460 [myid:] - INFO  [main:ContainerManager@64] - Using checkIntervalMs=60000 maxPerMinute=10000

 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐