'jvisualvm'에 해당되는 글 1건

  1. 2014.07.31 TOMCAT Jconsole와 Jvisualvm을 이용한 JMX 모니터링 셋팅
Programming/JAVA2014.07.31 16:06

서버 환경

CentOS 6.5

TOMCAT 7

java version "1.7.0_55"


1. 간단하게 vi catalina.sh 또는 vi setenv.sh 설정함

----------------------------------------

CATALINA_OPTS="$CATALINA_OPTS

-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx 

-Dcom.sun.management.jmxremote

-Dcom.sun.management.jmxremote.port=9080

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

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

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

----------------------------------------


2. 인증 방식 넣기 (설정시 access,password파일 추가등록)

------------------------------------------------

CATALINA_OPTS="$CATALINA_OPTS

-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx 

-Dcom.sun.management.jmxremote

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

-Dcom.sun.management.jmxremote.port=9080

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

-Dcom.sun.management.jmxremote.authenticate=true

-Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access

-Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password

------------------------------------------------


※ 계정등록 ( 구글링해보니까 LDAP 연동 방법도 있는 듯 필요시 구글링해볼것!! )

https://code.google.com/p/tungsten-replicator/source/browse/trunk/commons/conf/sample.jmxremote.access?spec=svn1148&r=1148


vi jmxremote.access ( 계정에 맞게 readonly 또는 readwrite )

------------------------------------------------

admin readwrite \

      create javax.management.moitor.*,javax.management.timer.* \

      unregister

------------------------------------------------


vi jmxremote.password

------------------------------------------------

admin password

------------------------------------------------




3. 에러발생시 처리 방안

※ Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: dev-was01: dev-was01: Name or service not known

 => vi /etc/hosts 아래 host 추가하면됨

     127.0.0.1   localhost dev-was01

※ shutdown시 Error: Exception thrown by the agent : java.lang.NullPointerException

 => CATALINA_OPTS 아닌 JAVA_OPTS 에 넣으면 Exception 에러발생


※ catalina-jmx-remote.jar 필요시 톰캣사이트에서 다운르도 후 lib폴더에 넣기!

 => http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.53/bin/extras/




4. Apache 메뉴얼 listener was configured in server.xml 추가하는 방법


URL : http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html

AttributeDescription
rmiRegistryPortPlatform

The port to be used by the JMX/RMI registry for the Platform MBeans. This replaces the use of thecom.sun.management.jmxremote.port system property that should not be set when using this listener.

rmiServerPortPlatform

The port to be used by the Platform JMX/RMI server.

rmiBindAddress

The address of the interface to be used by JMX/RMI server. This option is incompatible with setting the system propertycom.sun.management.jmxremote.ssl to true.

useLocalPorts

Should any clients using these ports be forced to use local ports to connect to the the JMX/RMI server. This is useful when tunnelling connections over SSH or similar. Defaults to false.

Using file-based Authentication and Authorisation

If this listener was configured in server.xml as:

  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
          rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />

with the following system properties set (e.g. in setenv.sh):

  -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
  -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
  -Dcom.sun.management.jmxremote.ssl=false

$CATALINA_BASE/conf/jmxremote.password containing:

admin letmein

$CATALINA_BASE/conf/jmxremote.access containing:

admin readwrite

then opening ports 10001 (RMI Registry) and 10002 (JMX/RMI Server) in your firewall would enable jconsole to connect to a Tomcat instance running behind a firewall using a connection string of the form:

service:jmx:rmi://<hostname>:10002/jndi/rmi://<hostname>:10001/jmxrmi

with a user name of admin and a password of letmein.



Posted by 시니^^

티스토리 툴바