LoginSignup
0
0

More than 3 years have passed since last update.

docker内のアプリにjmxremoteする

Last updated at Posted at 2020-05-14

絶対に忘れそうなので、備忘録を兼ねて。
spring-boot + docker-compose で試しました。

docker内で動くアプリには下記の設定をしておく

-Djava.rmi.server.hostname=0.0.0.0
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=10080
-Dcom.sun.management.jmxremote.rmi.port=10080
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

10080 port で jmxremote したいので、 docker は -p 10080:10080 とかして起動しておきましょう。

手元のマシンからアプリが動いてるサーバにsocks proxyを張る

ssh -fN -D 7777 接続したいサーバ

jconsoleでつなぐ

jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=7777 service:jmx:rmi:///jndi/rmi://localhost:10080/jmxrmi -J-DsocksNonProxyHosts=

終わり。

【参照】
https://stackoverflow.com/questions/15093376/jconsole-over-ssh-local-port-forwarding
https://shinpei.github.io/blog/2015/03/28/use-jmx-over-ssh

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0