2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
20 = Apache HBase (TM) Metrics
23 Apache HBase (TM) emits Hadoop link:https://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html[metrics].
27 First read up on Hadoop link:https://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html[metrics].
29 If you are using ganglia, the link:https://wiki.apache.org/hadoop/GangliaMetrics[GangliaMetrics] wiki page is useful read.
31 To have HBase emit metrics, edit `$HBASE_HOME/conf/hadoop-metrics.properties` and enable metric 'contexts' per plugin. As of this writing, hadoop supports *file* and *ganglia* plugins. Yes, the hbase metrics files is named hadoop-metrics rather than _hbase-metrics_ because currently at least the hadoop metrics system has the properties filename hardcoded. Per metrics _context_, comment out the NullContext and enable one or more plugins instead.
33 If you enable the _hbase_ context, on regionservers you'll see total requests since last
34 metric emission, count of regions and storefiles as well as a count of memstore size.
35 On the master, you'll see a count of the cluster's requests.
37 Enabling the _rpc_ context is good if you are interested in seeing
38 metrics on each hbase rpc method invocation (counts and time taken).
40 The _jvm_ context is useful for long-term stats on running hbase jvms -- memory used, thread counts, etc. As of this writing, if more than one jvm is running emitting metrics, at least in ganglia, the stats are aggregated rather than reported per instance.
44 In addition to the standard output contexts supported by the Hadoop
45 metrics package, you can also export HBase metrics via Java Management
46 Extensions (JMX). This will allow viewing HBase stats in JConsole or
49 === Enable HBase stats collection
51 To enable JMX support in HBase, first edit `$HBASE_HOME/conf/hadoop-metrics.properties` to support metrics refreshing. (If you've running 0.94.1 and above, or have already configured `hadoop-metrics.properties` for another output context, you can skip this step).
54 # Configuration of the "hbase" context for null
55 hbase.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
58 # Configuration of the "jvm" context for null
59 jvm.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
62 # Configuration of the "rpc" context for null
63 rpc.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
67 === Setup JMX Remote Access
69 For remote access, you will need to configure JMX remote passwords and access profiles. Create the files:
70 `$HBASE_HOME/conf/jmxremote.passwd` (set permissions
73 monitorRole monitorpass
74 controlRole controlpass
77 `$HBASE_HOME/conf/jmxremote.access`:: +
83 === Configure JMX in HBase startup
85 Finally, edit the `$HBASE_HOME/conf/hbase-env.sh` script to add JMX support:
88 HBASE_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false"
89 HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.passwd"
90 HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access"
92 export HBASE_MASTER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10101"
93 export HBASE_REGIONSERVER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10102"
96 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`* domain in JMX.
99 == Understanding HBase Metrics
101 For more information on understanding HBase metrics, see the link:book.html#hbase_metrics[metrics section] in the Apache HBase Reference Guide.