使用JConsole链接远程服务器

本文详细介绍了如何通过配置特定的启动参数,如com.sun.management.jmxremote等,使用JConsole进行远程服务器监控。包括远程服务启动参数设置、本地JConsole程序启动及远程服务连接步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

序章

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程序
在这里插入图片描述

三、链接远程服务端
在这里插入图片描述
四、执行监测
在这里插入图片描述

参考:
Java Platform Management Guide

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值