Index: src/docs/src/documentation/content/xdocs/metrics.xml =================================================================== --- src/docs/src/documentation/content/xdocs/metrics.xml (revision 799135) +++ src/docs/src/documentation/content/xdocs/metrics.xml (working copy) @@ -63,5 +63,118 @@ in ganglia, the stats are aggregated rather than reported per instance.

+ +
+ Using with JMX +

+ In addition to the standard output contexts supported by the Hadoop + metrics package, you can also export HBase metrics via Java Management + Extensions (JMX). This will allow viewing HBase stats in JConsole or + any other JMX client. +

+
+ Enable HBase stats collection +

+ To enable JMX support in HBase, first edit + $HBASE_HOME/conf/hadoop-metrics.properties to support + metrics refreshing. (If you've already configured + hadoop-metrics.properties for another output context, + you can skip this step). +

+ +# Configuration of the "hbase" context for null +hbase.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +hbase.period=60 + +# Configuration of the "jvm" context for null +jvm.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +jvm.period=60 + +# Configuration of the "rpc" context for null +rpc.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread +rpc.period=60 + +
+
+ Setup JMX remote access +

+ For remote access, you will need to configure JMX remote passwords + and access profiles. Create the files: +

+
+
$HBASE_HOME/conf/jmxremote.passwd (set permissions + to 600)
+
+ +monitorRole monitorpass +controlRole controlpass + +
+ +
$HBASE_HOME/conf/jmxremote.access
+
+ +monitorRole readonly +controlRole readwrite + +
+
+
+
+ Configure JMX in HBase startup +

+ Finally, edit the $HBASE_HOME/conf/hbase-env.sh and + $HBASE_HOME/bin/hbase scripts for JMX support: +

+
+
$HBASE_HOME/conf/hbase-env.sh
+
+

Add the lines:

+ +JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false" +JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.passwd" +JMX_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access" + +export HBASE_MASTER_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.port=10101" +export HBASE_REGIONSERVER_OPTS="$JMX_OPTS -Dcom.sun.management.jmxremote.port=10102" + +
+
$HBASE_HOME/bin/hbase
+
+

Towards the end of the script, replace the lines:

+ + # figure out which class to run +if [ "$COMMAND" = "shell" ] ; then + CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb" +elif [ "$COMMAND" = "master" ] ; then + CLASS='org.apache.hadoop.hbase.master.HMaster' +elif [ "$COMMAND" = "regionserver" ] ; then + CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer' + +

+ with the lines: (adding the "HBASE_OPTS=..." lines for "master" and + "regionserver" commands) +

+ + # figure out which class to run +if [ "$COMMAND" = "shell" ] ; then + CLASS="org.jruby.Main ${HBASE_HOME}/bin/hirb.rb" +elif [ "$COMMAND" = "master" ] ; then + CLASS='org.apache.hadoop.hbase.master.HMaster' + HBASE_OPTS="$HBASE_OPTS $HBASE_MASTER_OPTS" +elif [ "$COMMAND" = "regionserver" ] ; then + CLASS='org.apache.hadoop.hbase.regionserver.HRegionServer' + HBASE_OPTS="$HBASE_OPTS $HBASE_REGIONSERVER_OPTS" + +
+
+

+ After restarting the processes you want to monitor, you should now be + able to run JConsole (included with the JDK since JDK 5.0) to view + the statistics via JMX. HBase MBeans are exported under the + hadoop.dfs domain in JMX. +

+
+