Zookeper服务器不起作用单服务器

问题描述

嘿,我正在尝试使用Zoo keper,但是当我尝试连接到服务器时,却收到此日志

D:\apache-zookeeper-3.6.1\bin>call "C:\Program Files\Java\jdk-14.0.2"\bin\java "-Dzookeeper.log.dir=D:\apache-zookeeper-3.6.1\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-krnim-server-LAPTOP-44Q1S1KH.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\apache-zookeeper-3.6.1\bin\..\build\classes;D:\apache-zookeeper-3.6.1\bin\..\build\lib\*;D:\apache-zookeeper-3.6.1\bin\..\*;D:\apache-zookeeper-3.6.1\bin\..\lib\*;D:\apache-zookeeper-3.6.1\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\apache-zookeeper-3.6.1\bin\..\conf\zoo.cfg" start
2020-08-13 09:12:12,507 [myid:] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2020-08-13 09:12:12,509 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2020-08-13 09:12:12,510 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2020-08-13 09:12:12,513 [myid:] - WARN  [main:QuorumPeerMain@138] - Either no config or no quorum defined in config,running in standalone mode
2020-08-13 09:12:12,516 [myid:] - INFO  [main:ManagedUtil@44] - Log4j 1.2 jmx support found and enabled.
2020-08-13 09:12:12,585 [myid:] - ERROR [main:ZooKeeperServerMain@69] - Invalid arguments,exiting abnormally
java.lang.NumberFormatException: For input string: "D:\apache-zookeeper-3.6.1\bin\..\conf\zoo.cfg"
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
        at java.base/java.lang.Integer.parseInt(Integer.java:652)
        at java.base/java.lang.Integer.parseInt(Integer.java:770)
        at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:78)
        at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:109)
        at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:67)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:140)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:90)
2020-08-13 09:12:12,587 [myid:] - INFO  [main:ZooKeeperServerMain@70] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
2020-08-13 09:12:12,591 [myid:] - INFO  [main:ZKAuditProvider@42] - ZooKeeper audit is disabled.
2020-08-13 09:12:12,592 [myid:] - ERROR [main:ServiceUtils@42] - Exiting JVM with code 2

D:\apache-zookeeper-3.6.1\bin>endlocal

这是我的配置文件:

 The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage,/tmp here is just 
# example sakes.
dataDir=D:\apache-zookeeper-3.6.1-bin\logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

出了什么问题。我搜索了但找不到解决方案。我正在使用Windows。使用cli时我也有问题。我是一个初学者,所以很难理解。

解决方法

我遇到了同样的问题。我对 dataDir 进行了以下更改并解决了错误。

dataDir=path\\to\\data\\directory\\

这可能会解决您的错误。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...