为什么与Amazon EC2的JMX连接失败? [英] Why does JMX connection to Amazon EC2 fail?

查看:99
本文介绍了为什么与Amazon EC2的JMX连接失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Amazon EC2实例上运行的一项服务上设置了JMX,但它无法正常运行.我正在使用VisualVM进行连接,经过短暂的等待后,它因超时而失败.似乎由于缺少响应数据或滞后而导致失败.我检查了是否在安全组中启用了JMX端口,并尝试使用未启用JMX的其他端口以及在安全组设置中未启用的端口,并且两者均立即失败,因此外观有所不同.我的EC2实例和桌面都安装了Ubuntu 12.04和JDK 7.

I set up JMX on one of services running on Amazon EC2 instance but it doesn't work properly. I'm using VisualVM to connect and after short period of pending it fails with timeout. Looks like it fails because of missing response data or lags. I checked that JMX port is enabled in security group and also tried with different port with no JMX enabled and also with port not enabled in security group settings and both fails immediately, so it looks different. My EC2 instance and desktop both have Ubuntu 12.04 and JDK 7 installed.

事实证明,由于SSL连接是安全的,所以端口没有意义.我有一个私钥,不知道如何在JConsole或VisualVM中使用它.

It turns out ports don't make sense since connection is SSL secured. I have a private key and have no idea how to use it with JConsole or VisualVM.

推荐答案

这对我有用.在服务器上设置JMX选项:

This works for me. Set the JMX options on your server:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=<some port>
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=localhost

打开SSH隧道:

ssh -i /path/to/key -D <some port> username@public_dns_address

启动VisualVM:

Start VisualVM:

jvisualvm -J-Dnetbeans.system_socks_proxy=localhost:<some port> -J-Djava.net.useSystemProxies=true

将远程连接添加到服务器.使用您为JMX指定的端口添加JMX连接.

Add a remote connection to the server. Add a JMX connection using the port you've specified for JMX.

为清楚起见,在上述所有三种情况下,都应使用相同的端口.

To be clear, in all three cases above, should be the same port.

这篇关于为什么与Amazon EC2的JMX连接失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆