hell_storm2004
hell_storm2004

Reputation: 1605

ZooKeeper Starting on Incorrect Port

I am trying to start a zookeeper server from a a Java code withing a webapp. But somehow I see that it is trying to start on the Tomcat port rather than the port provided in the properties file.

I keep seeing this:

WARN | o.e.j.s.ServletContextHandler@269d82e2{/,null,UNAVAILABLE} contextPath ends with /*


WARN | Empty contextPath
StartZooKeeperServer EXCEPTION: org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
        at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:107)
        at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:138)

But I have the clientPort set in the properties as 2182.

If you need any more information please do let me know.

Upvotes: 1

Views: 1362

Answers (1)

Arvanitis Christos
Arvanitis Christos

Reputation: 267

The problem is not with the Zookeeper server but with the Admin Server.

Admin Server binds by default to port 8080. However, this port is allocated in your system so this exception is thrown.

You can add the following property to your zookeeper configuration:

admin.serverPort=9876 (any port other than 8080)

You can even disable this server if you do not need it using:

admin.enableServer=false

More information on the Zookeeper admin server:

https://zookeeper.apache.org/doc/r3.6.1/zookeeperAdmin.html#sc_adminserver

Upvotes: 2

Related Questions