码迷,mamicode.com
首页 > 其他好文 > 详细

Zookeeper3.5及以上启动时8080端口被占用

时间:2020-12-15 12:55:12      阅读:9      评论:0      收藏:0      [点我收藏+]

标签:logs   erp   ace   origin   下载   mil   启动   disable   radmin   

今天闲来无事,学习Zookeeper,下载了Zookeeper的最新版本3.5。启动以后显示:

ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.5.4-beta/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

以为启动成功,然后连接时报错,查看后台进程,没有Zookeeper进程。

查看zookeeper的日志文件:

2018-06-29 01:36:01,142 [myid:] - ERROR [main:ZooKeeperServerMain@79] - 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

发现8080端口被占用,通过查阅Zookeeper3.5的官方文档,发现这是Zookeeper3.5的新特性:

The AdminServer
New in 3.5.0: The AdminServer is an embedded Jetty server that provides an HTTP interface to the four letter word commands. By default, the server is started on port 8080, and commands are issued by going to the URL "/commands/[command name]", e.g., http://localhost:8080/commands/stat. The command response is returned as JSON. Unlike the original protocol, commands are not restricted to four-letter names, and commands can have multiple names; for instance, "stmk" can also be referred to as "set_trace_mask". To view a list of all available commands, point a browser to the URL /commands (e.g., http://localhost:8080/commands). See the AdminServer configuration options for how to change the port and URLs.

这是Zookeeper AdminServer,默认使用8080端口,它的配置属性如下:

New in 3.5.0: The following options are used to configure the AdminServer.

admin.enableServer : (Java system property: zookeeper.admin.enableServer) Set to "false" to disable the AdminServer. By default the AdminServer is enabled.

admin.serverAddress : (Java system property: zookeeper.admin.serverAddress) The address the embedded Jetty server listens on. Defaults to 0.0.0.0.

admin.serverPort : (Java system property: zookeeper.admin.serverPort) The port the embedded Jetty server listens on. Defaults to 8080.

admin.idleTimeout : (Java system property: zookeeper.admin.idleTimeout) Set the maximum idle time in milliseconds that a connection can wait before sending or receiving data. Defaults to 30000 ms.

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中修改AdminServer的端口:

admin.serverPort=8888

保存后,再次启动,Zookeeper启动成功。

站在巨人肩膀上摘苹果

https://www.cnblogs.com/boboooo/p/9242088.html

https://zookeeper.apache.org/doc/r3.6.2/zookeeperAdmin.html

Zookeeper3.5及以上启动时8080端口被占用

标签:logs   erp   ace   origin   下载   mil   启动   disable   radmin   

原文地址:https://www.cnblogs.com/eternityz/p/14113740.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!