jConsole 사용하기
jConsole은 간단하게 JVM상의 Thread, Heap Memory 및 VM 정보을 모니터링하기 위한 툴이다. 기본적으로 JDK 1.5에서 제공하고 있으면 JMX를 기반으로 동작한다. JDK 1.5에서는 JMX를 표준으로 제공하여 모니터링이나 관리가 가능하도록 하였다.
관련 사이트
http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html
http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html
jConsole 사용법
원격 모니터링을 활성화하기 위해서 JDK 의 JMX 관련설정을 해주어야 한다.
Jconsole은 JDK5 이후 버전만 가능하기 때문에 JDK 1.5를 설치해야 한다.
-
“JAVA_HOME/jre/lib/management/” 폴더에 있는 “jmxremote.password.template” 파일을 복사해서 “jmxremote.password” 파일을 만든다.
-
“jmxremote.password” 파일을 열고 밑의 계정들에 달린 주석(#)을 제거하여 저장한다.
monitorRole QED
controlRole R&D -
“jmxremote.password” 파일을 읽기전용으로 만든다.
chmod 444 jmxremote.password -
JDK 옵션을 추가한다. 추가하는 방법은 아래와 같이 2가지 방법이 있다.
-
모든 JVM에 반영할 경우 : “management.properties” 파일에 아래설정을 추가하면 해당 JDK로 실행되는 모든 프로그램에 해당 JMX 옵션이 디폴트로 일괄 적용된다.
com.sun.management.jmxremote
com.sun.management.jmxremote.port=8999
com.sun.management.jmxremote.ssl=false -
해당 JVM에만 반영할 경우 : 자바를 실행할 때 아래와 같이 JVM 인자를 추가한다.
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=[passwordFilePath]/jmxremote.password
-
-
해당 Application을 실행한다.
-
jconsole 실행
-
User Name 과 Password는 jmxremote.password에서 정의한 것을 사용하면 된다.
-
모니터링 권한으로 실행할 때는
UserName : monitorRole
Password : QED -
콘트롤 권한으로 실행할 때는
UserName : controlRole
Password : R&D

-
-
jconcole 이 실행된 화면

-
메모리 상황 보기

-
Thread 상황 보기

-
로드된 클래스 보기

-
Bean을 찾고 속성을 수정할 수 있다.

-
VM 정보 및 운영체계 정보 표시
