jconsole 和jvisualVM 監控遠程 spring boot程序

 

 

監控java 程序 增長啓動參數 java

java  \spring

-Djava.rmi.server.hostname=192.168.2.39 \服務器

-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=1099 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar /root/app/data-test-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev  >nohup 2>&1 & app

 

因爲啓動參數過長,咱們能夠定義系統環境變量來表示 在/etc/profile 最後一行增長 命令行

export JAVA_OPTS='-Djava.rmi.server.hostname=192.168.2.39 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false'server

而後 source /etc/profile 是文件生效。blog

啓動時咱們就能夠用  nohup java $JAVA_OPTS -jar /root/app/data-center-0.0.1-SNAPSHOT.jar --spring.profiles.active=dev  >nohup 2>&1 & 這個腳本。 進程

 

 

JMX端口爲1099 ;ssl

若是不設置服務器主機名 -Djava.rmi.server.hostname 到時候可能連不上。rem

1.在本機命令行輸入jconsole命令調出界面

在遠程進程中 輸入 主機名:端口號便可

 

 2.jvisualvm 首先創建遠程鏈接,在新建好的遠程鏈接右擊,建立jmx鏈接

相關文章
相關標籤/搜索