1.Java进程启动新增如下参数

java 
-Djava.rmi.server.hostname=118.89.68.13  #远程服务器ip,即本机ip
-Dcom.sun.management.jmxremote #允许JMX远程调用
-Dcom.sun.management.jmxremote.port=12345  #自定义jmx 端口号
-Dcom.sun.management.jmxremote.ssl=false  # 是否需要ssl 安全连接方式
-Dcom.sun.management.jmxremote.authenticate=false #是否需要秘钥
 -jar App.jar 

 

2.连接

jconsole.exe在jdk的bin目录下

 

如果此配置项设置为false,则不用输入用户名和密码可以直接连接

-Dcom.sun.management.jmxremote.authenticate=false #是否需要秘钥

 

 

 

 

3.带认证的连接

3.1 修改启动参数,将此项改为true其他不变

-Dcom.sun.management.jmxremote.authenticate=true

 

3.2 修改服务器上配置文件jmxremote.access,新增需要连接的用户

 

3.3 在相同目录下新增配置文件jmxremote.password,从jmxremote.password.template拷贝而来

 

3.4 同样的方式连接,不过要加用户名和密码

posted on 2021-07-20 12:13  ScoutDu  阅读(536)  评论(0编辑  收藏  举报