- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Created on 12-12-2016 03:33 PM
Many times it is needed to monitor the ambari memory usage. JConsole and JVisualVM are the JDK provided JMX client utilities that can be used for the same. Here in this demo we will see how to monitor ambari server's JVM memory using $JAVA_HOME/bin/jvisualvm (same steps will be applicable for jconsole as well)
Step-1). We will need to add the "com.sun.management.jmxremote" related JVM remoted jmx options to the "/var/lib/ambari-server/ambari-env.sh" as following.
export AMBARI_JVM_ARGS=$AMBARI_JVM_ARGS' -Xms512m -Xmx2048m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=4444 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false'
For more information on JVMs standard jmxremote options please refer to : http://docs.oracle.com/javase/7/docs/technotes/guides/management/agent.html
com.sun.management.jmxremote => Enables the JMX remote agent and local monitoring via a JMX connector published on a private interface used by JConsole and any other local JMX clients that use the Attach API. JConsole can use this connector if it is started by the same user as the user that started the agent. No password or access files are checked for requests coming via this connector.
com.sun.management.jmxremote.port => Enables the JMX remote agent and creates a remote JMX connector to listen through the specified port. By default, the SSL, password, and access file properties are used for this connector. It also enables local monitoring as described for the com.sun.management.jmxremote property.
.
Step-2). Now we will need to restart the ambari server and validate if it has loaded these options properly or not?
# ps -ef | grep AmbariServer root 8576 1 11 14:32 pts/0 00:01:37 /usr/jdk64/jdk1.8.0_60/bin/java -server -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -Dsun.zip.disableMemoryMapping=true -Xms512m -Xmx2048m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=4444 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -cp /etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/share/java/postgresql-jdbc.jar org.apache.ambari.server.controller.AmbariServer
Step-3). Now from a remote host (for example on my MAC/Windows) make sure that the ambari server host and the port 4444 (-Dcom.sun.management.jmxremote.port=4444) is accessible or not?
$ telnet c6401.ambari.apache.org 4444 Trying 192.168.64.101... Connected to c6401.ambari.apache.org. Escape character is '^]'.
Step-4). Now on your MAC Or remote Host open the "$JAVA_HOME/bin/jvisualvm" GUI utility and setup the Remote Host as following:
Now we will need to provide the Remote Host details like port number.
We will need to then right click on the newly added connection and then Add a JMX connection as following:
Now we can use various Tabs of jvisualvm to monitor the Ambari JVM
.
.
.
.