zk服务器的zkServer.cmd需要加上
1、无密码访问
set JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=55555 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
2、有密码访问
set JAVA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9008 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=D:/temp/jmxremote.password -Dcom.sun.management.jmxremote.access.file=D:/temp/jmxremote.access
修改执行zkServer.cmd 的执行语句加上JAVA_OPTS,如:
java "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %JAVA_OPTS% %ZOOMAIN% "%ZOOCFG%" %*
在jdk目录下的bin目录找到
jconsole.exe
即可连接上!