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

时间:2025-04-19 19:42:31

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

[root@localhost zookeeper-3.8.0]# ./bin/ status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.8.0/bin/…/conf/
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:@86] - Unable to start AdminServer, exiting abnormally
$AdminServerException: Problem starting AdminServer on address 0.0.0.0, port 8080 and command URL /commands
	at (:194)
	at (:155)
	at (:113)
	at (:68)
	at (:141)
	at (:91)
Caused by: : Failed to bind to /0.0.0.0:8080
	at (:349)
	at (:310)
	at (:80)
	at (:234)
	at (:73)
	at (:401)
	at (:73)
	at (:185)
	... 5 common frames omitted
Caused by: : Address already in use
	at .bind0(Native Method)
	at (:433)
	at (:425)
	at (:223)
	at (:74)
	at (:344)
	... 12 common frames omitted
Unable to start AdminServer, exiting abnormally

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


(Java system property: )

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


(Java system property: )

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


(Java system property: )

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

于是,我在中加了=8765

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