Reputation: 10668
When enabling JMX remote connection, I saw these two properties, java.rmi.server.hostname and com.sun.management.jmxremote.host. What the differences between these two?
Upvotes: 3
Views: 1910
Reputation: 2055
The initial connection from the client (e.g. jconsole
or visualvm
) is established to com.sun.management.jmxremote.host
on port
com.sun.management.jmxremote.port
. Then the connecting client obtains com.sun.management.jmxremote.rmi.port
(it is dynamically assigned by Java from a pool of unused ports if not explicitly specified) and further communication and data exchange goes over Java RMI connecting to java.rmi.server.hostname
on port com.sun.management.jmxremote.rmi.port
.
If you don't use JMX authentication or SSL I'd recommend configuring both hosts as localhost (see configuration example below).
java.rmi.server.hostname=127.0.0.1
com.sun.management.jmxremote
com.sun.management.jmxremote.port=9091
com.sun.management.jmxremote.host=127.0.0.1
com.sun.management.jmxremote.rmi.port=9092
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.authenticate=false
You can connect to such process either from the same machine or via SSH with port forwarding e.g.
ssh user@host -L 9091:localhost:9091 -L 9092:localhost:9092
Upvotes: 3