如何从在docker容器中运行的进程访问JMX(Java Beans) [英] How to access JMX (Java Beans) from a process running in docker container

查看:772
本文介绍了如何从在docker容器中运行的进程访问JMX(Java Beans)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Docker运行进程时,为什么连接到JMX端口(使用JConsole)非常困难。

Why is it so hard to connect to a JMX port (using JConsole), when a process is run using Docker.

当然,我将将JMX端口暴露给主机,甚至使用 Sun特定选项 Java流程(遵循 http://ptmccarthy.github .io / 2014/07/24 / remote-jmx-with-docker / )。

Of course I have exposed the JMX port to the host, and even used Sun specific options while running the Java process (following the instructions from http://ptmccarthy.github.io/2014/07/24/remote-jmx-with-docker/ ).

我可以telnet到主机ip和暴露的JMX端口,这表示它是可访问的。但是我无法找出一种方法来使用JConsole并连接到在容器中运行的JMX服务。

I am able to telnet to the host ip and the exposed JMX port, which tells that it is accessible. But I can't figure out a way to use JConsole and connect to the JMX service running in the container.

-Djava.rmi.server.hostname=$JMX_HOSTNAME
-Dcom.sun.management.jmxremote.port=$JMX_PORT
-Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT


推荐答案

你目前看起来正确。至少尝试让它工作,我会尝试禁用auth& SSL。然后,一旦你得到它的工作,考虑重新启用任何您需要的安全性:

What you currently have looks correct. To at least try and get it working, i'd try disabling auth & ssl. Then, once you get it working, think about re-enabling any security you require:

-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

这篇关于如何从在docker容器中运行的进程访问JMX(Java Beans)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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