Zookeeper打开额外的随机高端口

goqiplq2  于 2022-12-09  发布在  Apache
关注(0)|答案(2)|浏览(156)

我看到在每个节点上,zookeeper打开了一个随机的高端口,监听所有接口。我如何禁用它?
下面是我的zoo.cfg文件

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/var/lib/zookeeper
# Place the dataLogDir to a separate physical disc for better performance
# dataLogDir=/disk2/zookeeper

admin.enableServer=false
autopurge.snapRetainCount=3
autopurge.purgeInterval=1
standaloneEnabled=false

# the port at which the clients will connect
clientPort=2181
clientPortAddress=192.168.0.102

# specify all zookeeper servers
# The fist port is used by followers to connect to the leader
# The second one is used for leader election
server.1=192.168.0.101:2888:3888
server.2=192.168.0.102:2888:3888
server.3=192.168.0.10:2888:3888

snapCount=100000

下面是netstat显示的内容:

tcp6       0      0 192.168.0.102:3888      :::*                    LISTEN      21444/java              
tcp6       0      0 :::42433                :::*                    LISTEN      21444/java          
tcp6       0      0 192.168.0.102:2181      :::*                    LISTEN      21444/java

因为我不知道一旦zookeeper启动后会选择什么端口,所以我不能设置防火墙。
Zookeeper的版本是:3.6.2

s71maibg

s71maibg2#

在我的情况下,它是jmx端口,Zookeeper将默认打开jmx。
检查zookeeper进程是否包含-Dcom.sun.management.jmxremote属性。

相关问题