文章目录
序章
JConsole连接remote服务,需要配置如下参数:
-Djava.rmi.server.hostname=168.172.10.13 #远程服务器ip,即本机ip
-Dcom.sun.management.jmxremote #允许JMX远程调用
-Dcom.sun.management.jmxremote.port=8888 #jmx 端口号
-Dcom.sun.management.jmxremote.ssl=false # 是否开启ssl
-Dcom.sun.management.jmxremote.authenticate=false #是否需要身份认证
下面详细介绍每个参数的含义
com.sun.management.jmxremote
Earlier while starting the Java VM or Java application, you set the following property to allow the JMX client access to a local Java VM
com.sun.management.jmxremote
设置com.sun.management.jmxremote
启动参数,表示允许JMX Client访问本地的JVM
java.rmi.server.hostname
For remote stubs to be associated with a specific interface address, the java.rmi.server.hostname system property must be set to IP address of that interface.
设置java.rmi.server.hostname
参数为IP地址,使得远程存根地址和JConsole Client中的接口地址相关联。
com.sun.management.jmxremote.port
Where, portNum is the port number to enable JMX RMI connections. Ensure that you specify an unused port number. In addition to publishing an RMI connector for local access, setting this property publishes an additional RMI connector in a private read- only registry at the specified port using the name, jmxrmi. The port number to which the RMI connector will be bound using the system property:
com.sun.management.jmxremote.rmi.port
设置com.sun.management.jmxremote.port
启动参数,表示处理JMX remote链接的端口号。
com.sun.management.jmxremote.ssl
com.sun.management.jmxremote.authenticate
Disabling Security
To disable both password authentication and SSL (namely to disable all security), you should set the following system properties when you start the Java VM:
com.sun.management.jmxremote.authenticate=false com.sun.management.jmxremote.ssl=false
安全认证相关,设置为false表示禁用相关认证,分别是SSL认证和身份认证。
使用JConsole链接远程服务器步骤
一、携带上述的启动参数,启动远程服务
启动项目
[root@host root]# java -Djava.rmi.server.hostname=xx.xx.xx.xx -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar test.jar
二、启动本地JConsole程序
三、链接远程服务端
四、执行监测