关于zookeeper启动不了,需要配置admin.serverPort的记录

18 篇文章 0 订阅
6 篇文章 0 订阅
本文讲述了作者在升级Zookeeper 3.8.0过程中遇到的问题,重点在于解决AdminServer启动失败,通过调整admin.serverPort配置并启用自定义端口,成功启动Zookeeper的过程。
摘要由CSDN通过智能技术生成

最近学习的微服务需要用到zookeeper,索性今天重新安装了zookeeper-3.8.0想再找找感觉。以前3.6.X版本无脑安装完成,设定好zoo.cfg就可启动,谁知道3.8.0不能无脑了,需要脑子拿出来活动一下了。
zookeeper-3.8.0安装完成一直启动不了:

[root@localhost zookeeper-3.8.0]# ./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.8.0/bin/…/conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Error contacting service. It is probably not running.

首先查看了下安装根路径下的logs目录里的out日志,发现:

2022-05-15 00:09:22,833 [myid:1] - ERROR [main:o.a.z.s.ZooKeeperServerMain@86] - 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
	at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:194)
	at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:155)
	at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:113)
	at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:68)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:141)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91)
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at org.eclipse.jetty.server.Server.doStart(Server.java:401)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
	at org.apache.zookeeper.server.admin.JettyAdminServer.start(JettyAdminServer.java:185)
	... 5 common frames omitted
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.openAcceptChannel(ServerConnector.java:344)
	... 12 common frames omitted
Unable to start AdminServer, exiting abnormally

一眼看到 端口:8080我就嘀咕了下,难不成,zookeeper自己配启动容器了?找了下网上的资料发现,果真!zookeeper还真的自己搞了一个简易应用服务器。看一下zookeeper的lib目录,出现了一些jetty的jar,官方文档中也出现了关于Admin的配置项,

admin.enableServer
(Java system property: zookeeper.admin.enableServer)

Set to "false" to disable the AdminServer. By default the AdminServer is enabled.

admin.serverPort
(Java system property: zookeeper.admin.serverPort)

The port the embedded Jetty server listens on. Defaults to 8080.

admin.commandURL
(Java system property: zookeeper.admin.commandURL)

The URL for listing and issuing commands relative to the root URL. Defaults to "/commands".

于是,我在zoo.cfg中加了admin.serverPort=8765

启动!
记录完毕,开搞微服务!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值