使用JConsole链接远程服务器

序章

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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用JAVA jconsole远程连接服务器,需要进行以下步骤: 1. 在服务器上配置JMX端口:在服务器的启动脚本或配置文件中添加`-Dcom.sun.management.jmxremote.port`参数,指定JMX端口号。例如,在WebLogic 12c中,可以修改`$Domain_HOME/bin/setDomainEnv.sh`文件,在其中添加`JAVA_OPTIONS="$JAVA_OPTIONS -Dcom.sun.management.jmxremote.port=9000"`。 2. 配置JMX远程连接的身份验证和安全性:根据需要,可以配置JMX远程连接的身份验证和安全选项。例如,在启动脚本或配置文件中添加`-Dcom.sun.management.jmxremote.authenticate=false`和`-Dcom.sun.management.jmxremote.ssl=false`参数来禁用身份验证和SSL加密。 3. 启动服务器使用适当的命令启动服务器,确保已经包含了上述配置参数。例如,可以使用以下命令启动一个Java应用程序:`nohup java -Djava.rmi.server.hostname=..*.** -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar YourJarFileName.jar`。 4. 打开控制台:在本地计算机上打开命令行窗口,输入`jconsole`命令来启动JConsole工具。 5. 连接远程服务器:在JConsole界面中,按照提示输入服务器的主机名和配置的JMX端口号。如果有身份验证和密码,也需要输入相应的信息。 通过以上步骤,就可以使用JAVA jconsole远程连接到服务器了。请确保服务器上已经正确配置了JMX端口并启动了相应的服务。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [jconsole连接远程服务器](https://blog.csdn.net/qq_37388841/article/details/129717777)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Linux下 通过jconsole远程监控weblogic](https://download.csdn.net/download/weixin_38715094/14051190)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值