Remote JMX connection in Red Hat Data Grid 8 (RHDG8)

Solution Verified - Updated

Environment

  • Red Hat Data Grid (RHDG)
    • 8.x

Issue

  • How to connect via JMX to a remote Red Hat Data Grid?
  • Trying to connect to the remote Data Grid instances using service:jmx:remote+http://127.0.0.1:9990 in JConsole like in RHDG 7 doesn't work.

Resolution

To create JMX remote connections, you will need to follow:

  1. Make sure to enable JMX by setting <jmx enabled="true"/> to <cache-container> in your infinispan.xml as described in the RHDG Server Guide documentation

  2. Start the RHDG instance with the JVM com.sun.management.jmxremote related options (like -Dcom.sun.management.jmxremote.port=<port>, -Dcom.sun.management.jmxremote.authenticate=false, and -Dcom.sun.management.jmxremote.ssl=false). For example:

    ${RHDG_HOME}/bin/server.sh -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
    

    Or, adding the JVM com.sun.management.jmxremote related options to $RHDG_HOME/bin/server.conf instead of specifying these to start up command:

    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=9999"
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
    JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
    

    Note: The above example option does not enable authentication and SSL. Enabling remote JMX without authentication and SSL is not secure and is not recommended in any environment (especially the production environment) because disabling authentication and SSL allows unauthorized users to connect to your server and access the data hosted there. See also Content from docs.oracle.com is not included.Java Monitoring and Management Guide's "Monitoring and Management Using JMX Technology" page for details.

    Since RHDG 8.4+, you can also enable JMX by specifying the --jmx <port> option of server.sh. See also Red Hat Data Grid 8.4 Server Guide - Chapter 9. Enabling and configuring Data Grid statistics and JMX monitoring for details.

  3. The above JVM options can expose JMX Remote port and it can be accessible with JMXServiceURL service:jmx:rmi:///jndi/rmi://<hostname>:<port>/jmxrmi.
    For example, if the server's IP address is 192.0.2.10 and the port number 9999 is specified to -Dcom.sun.management.jmxremote.port=<port> option, you can connect the following JMXServiceURL from JConsole (or JMX-based monitoring tool) on the remote host:

    service:jmx:rmi:///jndi/rmi://192.0.2.10:9999/jmxrmi
    

    When you enable authentication, you need to specify the appropriate user and password.

OCP setting - Data Grid Operator/Helm Charts

For RHDG 8 in OCP those JVM values above must be set on the CR, however, there's no way to expose JMX with the Operator as even if user enable it in a custom server configuration, port 9999 will not be exposed at the container level.
For the helm charts user could expose JMX in the server config in the chart values, but user would have to update the templates to expose the port as well as the services if that's how user want to access the port

Deployment MethodComment
Data Grid OperatorCannot be done - port 9999 will not be exposed at the container level.
Helm ChartsUse a template exposing the port as well as the services to access it

Root Cause


Disclaimer: Links contained herein to an external website(s) are provided for convenience only. Red Hat has not reviewed the links and is not responsible for the content or its availability. The inclusion of any link to an external website does not imply endorsement by Red Hat of the website or their entities, products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) the external site or content.


JMX does not come enabled by default in RHDG 8, need to set the properties above. Jmx through http remoting was an JBoss EAP/RHDG 7 feature. Since Red Hat Data Grid 8 is not longer based on JBoss EAP, JMX remoting connections now use the default Content from docs.oracle.com is not included.JMX Java Configurations.

Product(s)
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.