ZooKepper Unable to start AdminServer, exiting abnormally
Asked Answered
S

1

5

I'm using apache-zookeeper-3.5.5 and I want to run zkServer but I get the below error:

When I run the zkServer failed to bind to 8080 port.

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

My zoo.cfg file in like here:

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

I don't know what is my problem?

Smolt answered 25/6, 2019 at 6:23 Comment(1)
This command will help lsof -i :8080 if your OS is Unix based. Kill the PID that you get in output after you verify is not needed.Accession
L
27

The problem is that the port 8080 is probably used by other application on your host (use netstat to check the opened ports).

To fix the issue use the property admin.serverPort in the "zoo.cfg" file to set any different port: admin.serverPort=8081 but be sure that the port 8081 in the example is not used.

Liv answered 25/10, 2019 at 11:43 Comment(1)
ideally the line "admin.serverPort" was not given, I had to add it but after adding it fixed issue for me.Fated

© 2022 - 2024 — McMap. All rights reserved.