2017-09-01 68 views
0

停止的ZooKeeper當我試着用命令「zkServer stop」停止動物園管理員,我得到了以下結果:不能在Windows

C:\zookeeper-3.4.10>call "C:\Program Files\Java\jdk1.8.0_121"\bin\java "-Dzookeeper.log.dir=C:\zookeeper-3.4.10\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "C:\zookeeper-3.4.10\bi 
n\..\build\classes;C:\zookeeper-3.4.10\bin\..\build\lib\*;C:\zookeeper-3.4.10\bin\..\*;C:\zookeeper-3.4.10\bin\..\lib\*;C:\zookeeper-3.4.10\bin\..\conf" org.apache.zookeeper.server.quoru 
m.QuorumPeerMain "C:\zookeeper-3.4.10\bin\..\conf\zoo.cfg" stop 
2017-09-01 13:55:22,070 [myid:] - INFO [main:[email protected]] - autopurge.snapRetainCount set to 3 
2017-09-01 13:55:22,072 [myid:] - INFO [main:[email protected]] - autopurge.purgeInterval set to 0 
2017-09-01 13:55:22,072 [myid:] - INFO [main:[email protected]] - Purge task is not scheduled. 
2017-09-01 13:55:22,072 [myid:] - WARN [main:[email protected]] - Either no config or no quorum defined in config, running in standalone mode 
2017-09-01 13:55:22,145 [myid:] - ERROR [main:[email protected]] - Invalid arguments, exiting abnormally 
java.lang.NumberFormatException: For input string: "C:\zookeeper-3.4.10\bin\..\conf\zoo.cfg" 
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) 
    at java.lang.Integer.parseInt(Integer.java:580) 
    at java.lang.Integer.parseInt(Integer.java:615) 
    at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:59) 
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:84) 
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:53) 
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116) 
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) 
2017-09-01 13:55:22,148 [myid:] - INFO [main:[email protected]] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns] 

我相信我已經開始了動物園管理員,因爲當我試圖啓動一個新的一,它顯示「java.net.BindException: Address already in use: bind

另一個奇怪的問題是,我無法在Windows服務列表中找到Zookeeper。然而,當我試圖通過netstat -and顯示在Windows PowerShell中的所有端口的使用,我發現2181是使用:

Proto Local Address   Foreign Address  State 
    TCP 0.0.0.0:2181   0.0.0.0:0    LISTENING 
[java.exe] 
    TCP [::1]:2181    [::1]:62268   ESTABLISHED 
[java.exe] 
    TCP [::1]:2181    [::1]:62279   ESTABLISHED 
[java.exe] 
    TCP [::1]:2181    [::1]:62280   ESTABLISHED 
[java.exe] 
    TCP [::1]:2181    [::1]:62281   ESTABLISHED 
[java.exe] 
+0

什麼是命令,你」已經用它來啓動它? – user10089632

+0

@ user10089632只是「。\ bin \ zkServer」,但我也試過「。\ bin \ zkServer.conf \ zoo.cfg」 – Spider

+0

很好,然後試着以管理員身份「kill」它 – user10089632

回答

1

它看起來像有一個open bug concerning the start and stop commands in Zookeeper

  • 要啓動飼養員 省略代替start參數並致電bin\zkServer
  • 要停止它,如果你不從任務管理器中看到的過程中,你需要連接到服務器動物園管理員作爲管理員,並執行kill命令 更details here
+0

是的,謝謝!我用「netstat -ano | findstr:2181」和「taskkill/PID typeyourPIDhere/F」殺死了它。請參閱https://stackoverflow.com/questions/39632667/how-to-kill-a-currently-using-port-on-localhost-in-windows – Spider

+0

我會補充一點,做一個更完整的答案 – user10089632