blob: 20d17b01a06beeff55a9bab57e77d4487c9bc667 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.8.1 from src/site/xdoc/metrics.xml
| Rendered using Apache Maven Fluido Skin 1.7.1-HBase
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Language" content="en" />
<title>Apache HBase &#x2013;
Apache HBase (TM) Metrics
</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.7.1-HBase.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.7.1-HBase.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/github.min.css"/>
<link rel="stylesheet" href="css/site.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
</head>
<body class="topBarEnabled">
<div id="topbar" class="navbar navbar-fixed-top ">
<div class="navbar-inner">
<div class="container">
<a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache HBase Project <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="index.html" title="Overview">Overview</a></li>
<li><a href="https://www.apache.org/licenses/" title="License">License</a></li>
<li><a href="downloads.html" title="Downloads">Downloads</a></li>
<li><a href="https://issues.apache.org/jira/browse/HBASE?report=com.atlassian.jira.plugin.system.project:changelog-panel#selectedTab=com.atlassian.jira.plugin.system.project%3Achangelog-panel" title="Release Notes">Release Notes</a></li>
<li><a href="coc.html" title="Code Of Conduct">Code Of Conduct</a></li>
<li><a href="http://blogs.apache.org/hbase/" title="Blog">Blog</a></li>
<li><a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a></li>
<li><a href="team-list.html" title="Team">Team</a></li>
<li><a href="https://reviews.apache.org/" title="ReviewBoard">ReviewBoard</a></li>
<li><a href="sponsors.html" title="HBase Sponsors">HBase Sponsors</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html" title="Thanks">Thanks</a></li>
<li><a href="poweredbyhbase.html" title="Powered by HBase">Powered by HBase</a></li>
<li><a href="resources.html" title="Other resources">Other resources</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Project Information <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="project-summary.html" title="Project Summary">Project Summary</a></li>
<li><a href="dependency-info.html" title="Dependency Information">Dependency Information</a></li>
<li><a href="source-repository.html" title="Source Repository">Source Repository</a></li>
<li><a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a></li>
<li><a href="dependency-management.html" title="Dependency Management">Dependency Management</a></li>
<li><a href="dependencies.html" title="Dependencies">Dependencies</a></li>
<li><a href="dependency-convergence.html" title="Dependency Convergence">Dependency Convergence</a></li>
<li><a href="plugin-management.html" title="Plugin Management">Plugin Management</a></li>
<li><a href="plugins.html" title="Plugins">Plugins</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation and API <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="book.html" target="_blank" title="Reference Guide">Reference Guide</a></li>
<li><a href="apache_hbase_reference_guide.pdf" target="_blank" title="Reference Guide (PDF)">Reference Guide (PDF)</a></li>
<li><a href="book.html#quickstart" target="_blank" title="Getting Started">Getting Started</a></li>
<li><a href="apidocs/index.html" target="_blank" title="User API">User API</a></li>
<li><a href="testapidocs/index.html" target="_blank" title="User API (Test)">User API (Test)</a></li>
<li><a href="devapidocs/index.html" target="_blank" title="Developer API">Developer API</a></li>
<li><a href="testdevapidocs/index.html" target="_blank" title="Developer API (Test)">Developer API (Test)</a></li>
<li><a href="http://abloz.com/hbase/book.html" target="_blank" title="中文参考指南(单页)">中文参考指南(单页)</a></li>
<li><a href="book.html#faq" target="_blank" title="FAQ">FAQ</a></li>
<li><a href="book.html#other.info" target="_blank" title="Videos/Presentations">Videos/Presentations</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/HADOOP2/Hbase" target="_blank" title="Wiki">Wiki</a></li>
<li><a href="acid-semantics.html" target="_blank" title="ACID Semantics">ACID Semantics</a></li>
<li><a href="book.html#arch.bulk.load" target="_blank" title="Bulk Loads">Bulk Loads</a></li>
<li><a href="metrics.html" target="_blank" title="Metrics">Metrics</a></li>
<li><a href="book.html#replication" target="_blank" title="Cluster replication">Cluster replication</a></li>
<li class="dropdown-submenu">
<a href="" title="1.4 Documentation">1.4 Documentation</a>
<ul class="dropdown-menu">
<li><a href="1.4/book.html" target="_blank" title="Ref Guide">Ref Guide</a></li>
<li><a href="1.4/book.pdf" target="_blank" title="Reference Guide (PDF)">Reference Guide (PDF)</a></li>
<li><a href="1.4/apidocs/index.html" target="_blank" title="User API">User API</a></li>
<li><a href="1.4/devapidocs/index.html" target="_blank" title="Developer API">Developer API</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="" title="2.2 Documentation">2.2 Documentation</a>
<ul class="dropdown-menu">
<li><a href="2.2/book.html" target="_blank" title="Ref Guide">Ref Guide</a></li>
<li><a href="2.2/apache_hbase_reference_guide.pdf" target="_blank" title="Reference Guide (PDF)">Reference Guide (PDF)</a></li>
<li><a href="2.2/apidocs/index.html" target="_blank" title="User API">User API</a></li>
<li><a href="2.2/testapidocs/index.html" target="_blank" title="User API (Test)">User API (Test)</a></li>
<li><a href="2.2/devapidocs/index.html" target="_blank" title="Developer API">Developer API</a></li>
<li><a href="2.2/testdevapidocs/index.html" target="_blank" title="Developer API (Test)">Developer API (Test)</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a href="" title="2.3 Documentation">2.3 Documentation</a>
<ul class="dropdown-menu">
<li><a href="2.3/book.html" target="_blank" title="Ref Guide">Ref Guide</a></li>
<li><a href="2.3/apache_hbase_reference_guide.pdf" target="_blank" title="Reference Guide (PDF)">Reference Guide (PDF)</a></li>
<li><a href="2.3/apidocs/index.html" target="_blank" title="User API">User API</a></li>
<li><a href="2.3/testapidocs/index.html" target="_blank" title="User API (Test)">User API (Test)</a></li>
<li><a href="2.3/devapidocs/index.html" target="_blank" title="Developer API">Developer API</a></li>
<li><a href="2.3/testdevapidocs/index.html" target="_blank" title="Developer API (Test)">Developer API (Test)</a></li>
</ul>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">ASF <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="http://www.apache.org/foundation/" target="_blank" title="Apache Software Foundation">Apache Software Foundation</a></li>
<li><a href="http://www.apache.org/foundation/how-it-works.html" target="_blank" title="How Apache Works">How Apache Works</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html" target="_blank" title="Sponsoring Apache">Sponsoring Apache</a></li>
</ul>
</li>
</ul>
<div id="search-form" class="navbar-search pull-right">
<script type="text/javascript">
var cx = '000385458301414556862:sq1bb0xugjg';
(function() {
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div id="banner">
<div class="pull-left"><a href="./" id="bannerLeft"><img src="" alt=""/></a></div>
<div class="pull-right"><a href="http://hbase.apache.org/" id="bannerRight"><img src="images/hbase_logo_with_orca_large.png" alt="Apache HBase"/></a></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
</ul>
</div>
<div id="bodyColumn" >
<div class="section">
<h2><a name="Introduction"></a>Introduction</h2>
<p>
Apache HBase (TM) emits Hadoop <a class="externalLink" href="http://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>.
</p>
</div>
<div class="section">
<h2><a name="Setup"></a>Setup</h2>
<p>First read up on Hadoop <a class="externalLink" href="http://hadoop.apache.org/core/docs/stable/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>.
If you are using ganglia, the <a class="externalLink" href="https://cwiki.apache.org/confluence/display/HADOOP2/GangliaMetrics">GangliaMetrics</a>
wiki page is useful read.</p>
<p>To have HBase emit metrics, edit <tt>$HBASE_HOME/conf/hadoop-metrics.properties</tt>
and enable metric 'contexts' per plugin. As of this writing, hadoop supports
<b>file</b> and <b>ganglia</b> plugins.
Yes, the hbase metrics files is named hadoop-metrics rather than
<i>hbase-metrics</i> because currently at least the hadoop metrics system has the
properties filename hardcoded. Per metrics <i>context</i>,
comment out the NullContext and enable one or more plugins instead.
</p>
<p>
If you enable the <i>hbase</i> context, on regionservers you'll see total requests since last
metric emission, count of regions and storefiles as well as a count of memstore size.
On the master, you'll see a count of the cluster's requests.
</p>
<p>
Enabling the <i>rpc</i> context is good if you are interested in seeing
metrics on each hbase rpc method invocation (counts and time taken).
</p>
<p>
The <i>jvm</i> 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.
</p>
</div>
<div class="section">
<h2><a name="Using_with_JMX"></a>Using with JMX</h2>
<p>
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.
</p>
<div class="section">
<h2><a name="Enable_HBase_stats_collection"></a>Enable HBase stats collection</h2>
<p>
To enable JMX support in HBase, first edit
<tt>$HBASE_HOME/conf/hadoop-metrics.properties</tt> to support
metrics refreshing. (If you've running 0.94.1 and above, or have already configured
<tt>hadoop-metrics.properties</tt> for another output context,
you can skip this step).
</p>
<div class="source"><pre class="prettyprint">
# Configuration of the &quot;hbase&quot; context for null
hbase.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
hbase.period=60
# Configuration of the &quot;jvm&quot; context for null
jvm.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
jvm.period=60
# Configuration of the &quot;rpc&quot; context for null
rpc.class=org.apache.hadoop.metrics.spi.NullContextWithUpdateThread
rpc.period=60
</pre></div>
</div>
<div class="section">
<h2><a name="Setup_JMX_remote_access"></a>Setup JMX remote access</h2>
<p>
For remote access, you will need to configure JMX remote passwords
and access profiles. Create the files:
</p>
<dl>
<dt><tt>$HBASE_HOME/conf/jmxremote.passwd</tt> (set permissions
to 600)</dt>
<dd>
<div class="source"><pre class="prettyprint">
monitorRole monitorpass
controlRole controlpass
</pre></div>
</dd>
<dt><tt>$HBASE_HOME/conf/jmxremote.access</tt></dt>
<dd>
<div class="source"><pre class="prettyprint">
monitorRole readonly
controlRole readwrite
</pre></div>
</dd>
</dl>
</div>
<div class="section">
<h2><a name="Configure_JMX_in_HBase_startup"></a>Configure JMX in HBase startup</h2>
<p>
Finally, edit the <tt>$HBASE_HOME/conf/hbase-env.sh</tt>
script to add JMX support:
</p>
<dl>
<dt><tt>$HBASE_HOME/conf/hbase-env.sh</tt></dt>
<dd>
<p>Add the lines:</p>
<div class="source"><pre class="prettyprint">
HBASE_JMX_OPTS=&quot;-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false&quot;
HBASE_JMX_OPTS=&quot;$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.passwd&quot;
HBASE_JMX_OPTS=&quot;$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access&quot;
export HBASE_MASTER_OPTS=&quot;$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10101&quot;
export HBASE_REGIONSERVER_OPTS=&quot;$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10102&quot;
</pre></div>
</dd>
</dl>
<p>
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
<b><tt>hadoop</tt></b> domain in JMX.
</p>
</div>
<div class="section">
<h2><a name="Understanding_HBase_Metrics"></a>Understanding HBase Metrics</h2>
<p>
For more information on understanding HBase metrics, see the <a href="book.html#hbase_metrics">metrics section</a> in the Apache HBase Reference Guide.
</p>
</div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container">
<div class="row">
<p>Copyright &copy;2007&#x2013;2020
<a href="https://www.apache.org/">The Apache Software Foundation</a>.
All rights reserved. <li id="publishDate" class="pull-right">Last Published: 2020-09-24</li>
</p>
</div>
<p id="poweredBy" class="pull-right"><a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</p>
</div>
</footer>
</body>
</html>