| <!DOCTYPE html> |
| <!-- |
| | Generated by Apache Maven Doxia Site Renderer 1.11.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 – |
| 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="licenses.html" title="License">License</a></li> |
| <li><a href="http://www.apache.org/dyn/closer.cgi/hbase/" 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="mailing-lists.html" title="Mailing Lists">Mailing Lists</a></li> |
| <li><a href="team.html" title="Team">Team</a></li> |
| <li><a href="https://reviews.apache.org/" title="ReviewBoard">ReviewBoard</a></li> |
| <li><a href="sponsors.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="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="scm.html" title="Source Repository">Source Repository</a></li> |
| <li><a href="issue-management.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="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="2.0/devapidocs/index.html" target="_blank" title="Developer API">Developer API</a></li> |
| <li><a href="2.0/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="http://wiki.apache.org/hadoop/Hbase" target="_blank" title="Wiki">Wiki</a></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" > |
| |
| |
| <section> |
| <h2><a name="Introduction"></a>Introduction</h2> |
| |
| <p> |
| Apache HBase (TM) emits Hadoop <a class="externalLink" href="http://hadoop.apache.org/core/docs/current/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>. |
| </p> |
| </section> |
| <section> |
| <h2><a name="Setup"></a>Setup</h2> |
| |
| <p>First read up on Hadoop <a class="externalLink" href="http://hadoop.apache.org/core/docs/current/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>. |
| If you are using ganglia, the <a class="externalLink" href="http://wiki.apache.org/hadoop/GangliaMetrics">GangliaMetrics</a> |
| wiki page is useful read.</p> |
| |
| <p>To have HBase emit metrics, edit <code>$HBASE_HOME/conf/hadoop-metrics.properties</code> |
| 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> |
| </section> |
| |
| <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> |
| <section> |
| <h2><a name="Enable_HBase_stats_collection"></a>Enable HBase stats collection</h2> |
| |
| <p> |
| To enable JMX support in HBase, first edit |
| <code>$HBASE_HOME/conf/hadoop-metrics.properties</code> to support |
| metrics refreshing. (If you've running 0.94.1 and above, or have already configured |
| <code>hadoop-metrics.properties</code> for another output context, |
| you can skip this step). |
| </p> |
| |
| <div class="source"><pre class="prettyprint"> |
| # 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 |
| </pre></div> |
| </section> |
| <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><code>$HBASE_HOME/conf/jmxremote.passwd</code> (set permissions |
| to 600)</dt> |
| |
| <dd> |
| |
| <div class="source"><pre class="prettyprint"> |
| monitorRole monitorpass |
| controlRole controlpass |
| </pre></div> |
| </dd> |
| |
| |
| <dt><code>$HBASE_HOME/conf/jmxremote.access</code></dt> |
| |
| <dd> |
| |
| <div class="source"><pre class="prettyprint"> |
| monitorRole readonly |
| controlRole readwrite |
| </pre></div> |
| </dd> |
| </dl> |
| </section> |
| <section> |
| <h2><a name="Configure_JMX_in_HBase_startup"></a>Configure JMX in HBase startup</h2> |
| |
| <p> |
| Finally, edit the <code>$HBASE_HOME/conf/hbase-env.sh</code> |
| script to add JMX support: |
| </p> |
| |
| <dl> |
| |
| <dt><code>$HBASE_HOME/conf/hbase-env.sh</code></dt> |
| |
| <dd> |
| |
| <p>Add the lines:</p> |
| |
| <div class="source"><pre class="prettyprint"> |
| HBASE_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false" |
| HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.passwd" |
| HBASE_JMX_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access" |
| |
| export HBASE_MASTER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10101" |
| export HBASE_REGIONSERVER_OPTS="$HBASE_JMX_OPTS -Dcom.sun.management.jmxremote.port=10102" |
| </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><code>hadoop</code></b> domain in JMX. |
| </p> |
| </section> |
| <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> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <hr/> |
| <footer> |
| <div class="container"> |
| <div class="row"> |
| <p>Copyright ©2007–2022 |
| <a href="https://www.apache.org/">The Apache Software Foundation</a>. |
| All rights reserved. <li id="publishDate" class="pull-right">Last Published: 2022-08-31</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> |