我在Docker容器中的tomcat上运行java web应用程序.
有没有办法监视java应用程序的内存使用情况?我尝试使用jconsole
docker的进程ID,但它告诉我Invalidate process id
我也在tomcat中启用JMX,但不知道如何绑定它.我可以使用visualvm
我的本地绑定主机,但找不到绑定到主机内部的docker的方法.
有没有什么好办法实现这个目标?
谢谢
我从以下答案中获取了 JVM 参数列表/sf/answers/2457628211/:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Run Code Online (Sandbox Code Playgroud)
我想在 docker-compose 中运行它们。
这是我尝试过的:
environment:
- JAVA_TOOL_OPTIONS="-Dcom.sun.management.jmxremote"
- JAVA_TOOL_OPTIONS="-Dcom.sun.management.jmxremote.port=9010"
- JAVA_TOOL_OPTIONS="-Dcom.sun.management.jmxremote.local.only=false"
- JAVA_TOOL_OPTIONS="-Dcom.sun.management.jmxremote.authenticate=false"
- JAVA_TOOL_OPTIONS="-Dcom.sun.management.jmxremote.ssl=false"
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
我该怎么做?