A method for adding vm parameters when running an jar program

  • 2020-06-12 09:16:49
  • OfStack

Set the vm heap size and configure remote monitoring parameters

The remote port is set to 8999 without username and password authentication. The initial heap memory is 64M, the maximum heap memory is 128M, the new generation is 20M, and the memory of Survivor and Eden is 2:8

java - Djava. rmi. server. hostname = host ip - Dcom. sun. management. jmxremote. port = 8999 - Dcom. sun. management. jmxremote. authenticate = false - Dcom. sun. management. jmxremote. ssl = false jar -- Xms64M - Xmx128M - Xmn20M - XX: SurvivorRatio = 2. / live - scheduled - 0.0.1 - SNAPSHOT. jar

At this point, you can use the jconsole tool for remote monitoring, only need to use the host ip+ port to connect successfully

If a password is required for a remote monitoring connection, the configuration is as follows

java - Djava. rmi. server. hostname = host IP - Dcom. sun. management. jmxremote. port = 8999 - Dcom. sun. management. jmxremote. authenticate = true - Dcom. sun. management. jmxrete. ssl = false - Dcom. sun. management. jmxremote. pwd. file = / data/java/jdk1. 8 / jre/lib/management/jmxremote password - jar - Xms64M - Xmx128M Xmn20M - XX: SurvivorRatio = 2 . / live scheduled - 0.0.1 - SNAPSHOT. jar

And copy one copy of jmxremote.password.template to jre directory under jre/lib/management directory into the directory and name it ES114en.password, then delete all contents of ES116en.password file.

Then configure two users, one for read-only permissions and one for control permissions, and the file contents are as follows

monitorRole password
The controlRole password is then required to connect with the user name and password when remote monitoring occurs.


Related articles: