1 <?xml version="1.0" encoding="UTF-8"?>
3 Licensed to the Apache Software Foundation (ASF) under one
4 or more contributor license agreements. See the NOTICE file
5 distributed with this work for additional information
6 regarding copyright ownership. The ASF licenses this file
7 to you under the Apache License, Version 2.0 (the
8 "License"); you may not use this file except in compliance
9 with the License. You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing,
14 software distributed under the License is distributed on an
15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations
20 <document xmlns="http://maven.apache.org/XDOC/2.0"
21 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22 xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
25 Apache HBase (TM) Metrics
30 <section name="Introduction">
32 Apache HBase (TM) emits Hadoop <a href="http://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>.
35 <section name="Setup">
36 <p>First read up on Hadoop <a href="http://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>.
37 If you are using ganglia, the <a href="https://cwiki.apache.org/confluence/display/HADOOP2/GangliaMetrics">GangliaMetrics</a>
38 wiki page is useful read.</p>
39 <p>To have HBase emit metrics, edit <code>$HBASE_HOME/conf/hadoop-metrics.properties</code>
40 and enable metric 'contexts' per plugin. As of this writing, hadoop supports
41 <strong>file</strong> and <strong>ganglia</strong> plugins.
42 Yes, the hbase metrics files is named hadoop-metrics rather than
43 <em>hbase-metrics</em> because currently at least the hadoop metrics system has the
44 properties filename hardcoded. Per metrics <em>context</em>,
45 comment out the NullContext and enable one or more plugins instead.
48 If you enable the <em>hbase</em> context, on regionservers you'll see total requests since last
49 metric emission, count of regions and storefiles as well as a count of memstore size.
50 On the master, you'll see a count of the cluster's requests.
53 Enabling the <em>rpc</em> context is good if you are interested in seeing
54 metrics on each hbase rpc method invocation (counts and time taken).
57 The <em>jvm</em> context is
58 useful for long-term stats on running hbase jvms -- memory used, thread counts, etc.
59 As of this writing, if more than one jvm is running emitting metrics, at least
60 in ganglia, the stats are aggregated rather than reported per instance.
64 <section name="Using with JMX">
66 In addition to the standard output contexts supported by the Hadoop
67 metrics package, you can also export HBase metrics via Java Management
68 Extensions (JMX). This will allow viewing HBase stats in JConsole or
71 <section name="Enable HBase stats collection">
73 To enable JMX support in HBase, first edit
74 <code>$HBASE_HOME/conf/hadoop-metrics.properties</code> to support
75 metrics refreshing. (If you've running 0.94.1 and above, or have already configured
76 <code>hadoop-metrics.properties</code> for another output context,
77 you can skip this step).
80 # Configuration of the "hbase" context for null
81 hbase.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
84 # Configuration of the "jvm" context for null
85 jvm.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
88 # Configuration of the "rpc" context for null
89 rpc.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
93 <section name="Setup JMX remote access">
95 For remote access, you will need to configure JMX remote passwords
96 and access profiles. Create the files:
99 <dt><code>$HBASE_HOME/conf/jmxremote.passwd</code> (set permissions
103 monitorRole monitorpass
104 controlRole controlpass
108 <dt><code>$HBASE_HOME/conf/jmxremote.access</code></dt>
112 controlRole readwrite
117 <section name="Configure JMX in HBase startup">
119 Finally, edit the <code>$HBASE_HOME/conf/hbase-env.sh</code>
120 script to add JMX support:
123 <dt><code>$HBASE_HOME/conf/hbase-env.sh</code></dt>
125 <p>Add the lines:</p>
127 HBASE_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false"
128 HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.passwd"
129 HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access"
131 export HBASE_MASTER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10101"
132 export HBASE_REGIONSERVER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10102"
137 After restarting the processes you want to monitor, you should now be
138 able to run JConsole (included with the JDK since JDK 5.0) to view
139 the statistics via JMX. HBase MBeans are exported under the
140 <strong><code>hadoop</code></strong> domain in JMX.
143 <section name="Understanding HBase Metrics">
145 For more information on understanding HBase metrics, see the <a href="book.html#hbase_metrics">metrics section</a> in the Apache HBase Reference Guide.