How to Remote Manage » History » Revision 4
« Previous |
Revision 4/7
(diff)
| Next »
Henning Blohm, 08.03.2020 11:21
How to Remote Manage¶
A significant amount of internal state and operations of a z2 system can be accessed via JMX using tools such as jconsole or jvisualvm. In order to access z2 via JMX some JMX related configuration should be applied.
Configuring JMX access in Z2¶
Accessing a Java VM remotely via JMX¶
It should not be necessary, but unfortunately, as JMX in based on RMI, accessing to a Java VM via JMX remotely can be non-trivial.
Here are two practical approaches:
Accessing a Remote JVM via JMX directly¶
The tricky thing about JMX over RMI is that knowing the host name and the JMX port is merely sufficient to request RMI access that then uses a different (random) port and a host name defined by the JMX endpoint. That is, when accessing to the JMX endpoint we get a redirect to a different host and port combination that may not make sense from where we are calling, either because the host name is not resolvable or wrong (e.g. localhost), or because the port is not accessible.
However, the following two system properties can be used to solve these problems:
com.sun.management.jmxremote.rmi.port | Defines the RMI port to use and can be set to be the same as the JMX port |
java.rmi.server.hostname | Defines the RMI host name to use |
TBC
Accessing a Remote JVM via JMX via an SSH tunnel¶
protected, localhost only, no user name required
TBC
Remote Synchronization and Log Streaming¶
Starting with version 2.8, Z2 offers a built-in command line utility to synchronize (with log output) and provide streaming access to the z2 home log. When in Z2_HOME/bin run:
java -cp z.jar com.zfabrik.launch.Manage -?
for the usage:
SYNOPSIS
java -cp z.jar Manage <command> <options>
COMMANDS
sync The sync performs a synchronization of a running (remote) z2 Home.
showlog Continuously stream the z2 Home log of a running z2 Home to the current stderr.
OPTIONS
-url <url>
JMX URL identifying the target z2 Home. Defaults to service:jmx:rmi:///jndi/rmi://localhost:7777/jmxrmi
The URL may be shortened to <host>:<port> (e.g. localhost:7777)
-user <username>
Username used for JMX authentication. Optional.
-pass <password>
Password used for JMX authentication. Optional. Mandatory when a username has been set
-b <n>
Number of lines to read before current (if available) when running showlog.
EXAMPLE
java -cp z.jar com.zfabrik.launch.Manage showlog -url host:7777 -user admin -pass admin
Updated by Henning Blohm almost 5 years ago · 4 revisions