We have not been able to figure out how to expose JMX ports from multiple containers running a similar process when a common JMX port for the process is mapped to different external ports.
To clarify by example …
A simple Java application is configured to expose its JMX port, with no authentication, using the
following JAVA properties:
-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=%TARGET% (the ip address of exposed VM running the process) -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.rmi.port=3968 -Dcom.sun.management.jmxremote.port=3968 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
This works fine for a single instance of this process running in a container that uses the following
Docker port mapping. We can connect to the port via jconsole and see JMX beans:
There are lots of posts out there that point to the use of the local.only and rmi.port properties
needed to make JMX work at all (took a while to figure this out)
However, if we run a second instance of the process, using the following port mapping,
the JMX data are not accessible. The port does respond, but jconsole cannot connect:
It seems that there must be something else required when the port is mapped to a different
external port, but we have not been able to figure this out. Seems like a pretty serious limitation,
if we want to run an identical process multiple times and just map each instance to a different port.
Any ideas on how to solve this ?
Anyone else run into the same issue ?