How do i enable remote jmx with port in zookeeper zkServer.cmd

☆樱花仙子☆ 提交于 2020-01-13 04:14:10

问题


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

回答1:


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).




回答2:


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:


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.



来源:https://stackoverflow.com/questions/41457491/how-do-i-enable-remote-jmx-with-port-in-zookeeper-zkserver-cmd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!