启动zookeeper报错java.net.ConnectException: Connection refused
程序员文章站
2022-07-07 14:47:38
...
在服务器上启动zookeeper在zookeeper启动时遇到的,输入命令 “ ./zkServer.sh start ” 启动后,以为启动成功,运行项目提供方代码报错java.net.ConnectException: Connection refused
查看状态:
./zkServer.sh status
查看日志:
./zkServer.sh start-foreground
错误信息:
ERROR [main:aaa@qq.com] - Unable to start AdminServer, exiting abnormally
org.apache.zookeeper.server.admin.AdminServer$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
java.net.BindException: Address already in use
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)
Caused by: java.net.BindException: Address already in use
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.open(ServerConnector.java:321)
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:366)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:103)
... 5 more
发现8080端口被占用,查阅Zookeeper的官方文档,发现这是Zookeeper3.5.5的新特性:
Zookeeper AdminServer,默认使用8080端口,它的配置属性如下:
我们可以修改在zoo.cfg中修改AdminServer的端口:
修改完成后,在此启动zookeeper服务器,如下图,即为启动成功:
上一篇: 报错Connection refused: connect
下一篇: java.net.ConnectException:Connection refused (Connection refused)
推荐阅读
-
Nginx中报错:Permission denied与Connection refused的解决
-
android 请求接口报错 org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.90:9090 refused
-
报错Connection refused: connect
-
启动zookeeper报错java.net.ConnectException: Connection refused
-
java.net.ConnectException:Connection refused (Connection refused)
-
homebrew安装报错 - 443 - connection refused
-
Socket通信时报错java.net.ConnectException: Connection refused
-
zookeeper启动时报错:Starting zookeeper ... FAILED TO START
-
ZooKeeper启动报错:My id 3 not in the peer list
-
解决vue net :ERR_CONNECTION_REFUSED报错问题