Apache zookeeper ZooKepper无法启动AdminServer,异常退出

Apache zookeeper ZooKepper无法启动AdminServer,异常退出,apache-zookeeper,Apache Zookeeper,我使用的是apache-zookeeper-3.5.5,我想运行zkServer,但出现以下错误: 当我运行zkServer时,无法绑定到8080端口 Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080 at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346) at org.eclipse

我使用的是apache-zookeeper-3.5.5,我想运行zkServer,但出现以下错误:

当我运行zkServer时,无法绑定到8080端口

Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
    at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:346)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.server.Server.doStart(Server.java:396)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:103)
    ... 5 more
Caused by: java.net.BindException: Address already in use: bind
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
        ... 12 more
Unable to start AdminServer, exiting abnormally
我的zoo.cfg文件如下所示:

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=/data
# 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

我不知道我的问题出在哪里?

尝试更改zoo.cfg中的管理端口
admin.serverPort=8020

问题是端口8080可能被主机上的其他应用程序使用(使用
netstat
检查打开的端口)


要解决此问题,请使用“zoo.cfg”文件中的属性
admin.serverPort
设置任何不同的端口:
admin.serverPort=8081
,但请确保未使用示例中的端口8081。

如果您的操作系统基于Unix,此命令将有助于
lsof-i:8080
。在验证不需要后,杀死输出中得到的PID。理想情况下,没有给出“admin.serverPort”行,我必须添加它,但添加后修复了我的问题。