如何在 ubuntu 中将 JMC(Java Mission Control)连接到远程 JVM?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28765144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to connect JMC (Java Mission Control) to remote JVM in ubuntu?
提问by Sireesh Vattikuti
I am able to connect to JMC to the JVM while on the same system. However, I want to monitor a remote server. How do I connect my local JMC to my remote JVM?
我能够在同一系统上将 JMC 连接到 JVM。但是,我想监视远程服务器。如何将本地 JMC 连接到远程 JVM?
采纳答案by Srinivasu
In the server {Ubuntu} Edit the /etc/hosts
file
在服务器 {Ubuntu} 中编辑/etc/hosts
文件
127.0.1.1 server-name
Replace above line with this line
用这一行替换上面的行
<system-ip> server-name
回答by Hirt
It's all described in the documentation:
1. Click Help->Java Mission Control Help.
2. Check the JVM browser help.
文档中都有描述:
1. 单击帮助->Java Mission Control 帮助。
2.查看JVM浏览器帮助。
For more detailed information, check out:
http://docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html
有关更多详细信息,请查看:http:
//docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html
First you need to enable the external JMX agent on the server. You do this by adding the relevant com.sun.management.jmxremote to the command line flags for the server JVM you wish to connect to. Here is a simple example of a set of system properties that can be used. They disable security and authentication, so NEVER use it like this in production:
首先,您需要在服务器上启用外部 JMX 代理。为此,您可以将相关的 com.sun.management.jmxremote 添加到您希望连接到的服务器 JVM 的命令行标志中。这是一组可以使用的系统属性的简单示例。他们禁用安全和身份验证,所以永远不要在生产中使用它:
-Dcom.sun.management.jmxremote.port=7091
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Next you create a custom connection in JMC. You do this by clicking the "Create custom connection" button in the JVM browser:
接下来,您将在 JMC 中创建自定义连接。您可以通过单击 JVM 浏览器中的“创建自定义连接”按钮来执行此操作:
In the upcoming dialog you simply enter the host and port.
在接下来的对话框中,您只需输入主机和端口。
If you run into trouble, first check the last chapter of the documentation included with JMC (Frequently Asked Questions):
如果遇到麻烦,请先查看 JMC 随附文档的最后一章(常见问题):
If that does not help, the JMC Forum has a more extensive FAQ: https://community.oracle.com/message/11182417#11182417.
如果这没有帮助,JMC 论坛有更广泛的常见问题解答:https: //community.oracle.com/message/11182417#11182417。
回答by Hyman
My environment is jboss 7.1 in Linux, was trying to connect JMC to my jboss instance, initially I got problems with connection refused - after a day and half of digging, remote JMC works for me now, with the following configs in standalone.conf:
我的环境是 Linux 中的 jboss 7.1,试图将 JMC 连接到我的 jboss 实例,最初我遇到了连接被拒绝的问题 - 经过一天半的挖掘,远程 JMC 现在对我有用,在standalone.conf 中有以下配置:
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,org.jboss.logmanager"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS"
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/apps/jboss-as-7.1.1.Final/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/apps/jboss-as-7.1.1.Final/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar"
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/apps/jboss-as-7.1.1.Final/modules/org/apache/log4j/main/log4j-1.2.16.jar"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote=true"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=7091"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.rmi.port=7091"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -XX:+UnlockCommercialFeatures"
JAVA_OPTS="$JAVA_OPTS -XX:+FlightRecorder"