How do i enable remote jmx with port in zookeeper

2020-07-18 08:03发布

Here my zkServer.cmd file :

@echo off


setlocal
call "%~dp0zkEnv.cmd"

set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain

echo on

call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*

endlocal

3条回答
Deceive 欺骗
2楼-- · 2020-07-18 08:38

The skServer.sh script will run the zkEnv.sh script which in-turn will look for a script '../conf/zookeeper-env.sh'

create a file on the conf folder called zookeeper-env.sh

Paste this into the file and restart Zookeeper:

JMXLOCALONLY=false
JMXDISABLE=false
JMXPORT=4048
JMXAUTH=false
JMXSSL=false
查看更多
在下西门庆
3楼-- · 2020-07-18 08:45

ADD org.apache.zookeeper.server.quorum.QuorumPeerMain in server-start.

The class org.apache.zookeeper.server.quorum.QuorumPeerMain will start a JMX manageable ZooKeeper server. This class registers the proper MBeans during initalization to support JMX monitoring and management of the instance.

查看更多
劫难
4楼-- · 2020-07-18 08:56

First obtain the hostname (or reachable IP eg. lan/public/NAT address):

hostname -i
# or find ip
ip a

next add following options to ZOOMAIN (assumed hostname my.remoteconsole.org and desired port 8989)

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.port=8989
-Djava.rmi.server.hostname=my.remoteconsole.org

More details about available options in java docs (http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html).

查看更多
登录 后发表回答