docker里面的java进程,如何监控Docker中的java应用程序内存使用情况

I run the java web application on tomcat in the Docker container.

Is there any way to monitor the memory usage of the java application? I try to use jconsole with the process id of the docker, but it tells me Invalidate process id

I also enable JMX in tomcat, but don't know how to bind to it. I can use visualvm from my local to bind the host machine, but can not find way to bind to the docker inner the host.

Is there any good way to achieve this?

Thanks

解决方案

To connect to a java process running in a docker container running in boot2docker with visualvm you can try the following:

Start your java process using the following options:

java -Dcom.sun.management.jmxremote.port= \

-Dcom.sun.management.jmxremote.authenticate=false \

-Dcom.sun.management.jmxremote.ssl=false \

-Dcom.sun.management.jmxremote.rmi.port= \

-Djava.rmi.server.hostname= \

You need to run your image with --expose -p :.

Then "Add JMX Connection" in visualvm with :.

It shouldn't be much different without boot2docker.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值