blob: cadae7e22a78fad656e415204626bde8abfd4815 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.8">
<meta name="Forrest-skin-name" content="pelt">
<title>
HBase Metrics
</title>
<link type="text/css" href="skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
<link type="text/css" href="skin/profile.css" rel="stylesheet">
<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="images/favicon.ico">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
|breadtrail
+-->
<div class="breadtrail">
<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hbase.apache.org/">HBase</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
|header
+-->
<div class="header">
<!--+
|start group logo
+-->
<div class="grouplogo">
<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
</div>
<!--+
|end group logo
+-->
<!--+
|start Project Logo
+-->
<div class="projectlogo">
<a href="http://hbase.apache.org/"><img class="logoImage" alt="HBase" src="images/hbase_small.gif" title="The Hadoop database"></a>
</div>
<!--+
|end Project Logo
+-->
<!--+
|start Search
+-->
<div class="searchbox">
<form action="http://www.google.com/search" method="get" class="roundtopsmall">
<input value="hbase.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
<input name="Search" value="Search" type="submit">
</form>
</div>
<!--+
|end search
+-->
<!--+
|start Tabs
+-->
<ul id="tabs">
<li>
<a class="unselected" href="http://hbase.apache.org/">Project</a>
</li>
<li>
<a class="unselected" href="http://wiki.apache.org/hadoop/Hbase">Wiki</a>
</li>
<li class="current">
<a class="selected" href="index.html">HBase Documentation</a>
</li>
</ul>
<!--+
|end Tabs
+-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
|start Subtabs
+-->
<div id="level2tabs"></div>
<!--+
|end Endtabs
+-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<!--+
|breadtrail
+-->
<div class="breadtrail">
&nbsp;
</div>
<!--+
|start Menu, mainarea
+-->
<!--+
|start Menu
+-->
<div id="menu">
<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Documentation</div>
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="index.html">Overview</a>
</div>
<div class="menuitem">
<a href="api/overview-summary.html#overview_description">Getting Started</a>
</div>
<div class="menuitem">
<a href="releasenotes.html">Release Notes</a>
</div>
<div class="menuitem">
<a href="api/index.html">API Docs</a>
</div>
<div class="menupage">
<div class="menupagetitle">HBase Metrics</div>
</div>
<div class="menuitem">
<a href="hbase-conf.html">HBase Default Configuration</a>
</div>
<div class="menuitem">
<a href="cygwin.html">HBase on Windows</a>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/Hbase">Wiki</a>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/Hbase/FAQ">FAQ</a>
</div>
<div class="menuitem">
<a href="http://hbase.apache.org/mailing_lists.html">Mailing Lists</a>
</div>
</div>
<div id="credit"></div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
|alternative credits
+-->
<div id="credit2"></div>
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<div id="content">
<div title="Portable Document Format" class="pdflink">
<a class="dida" href="metrics.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
<h1>
HBase Metrics
</h1>
<div id="minitoc-area">
<ul class="minitoc">
<li>
<a href="#Introduction"> Introduction </a>
</li>
<li>
<a href="#HOWTO">HOWTO</a>
</li>
<li>
<a href="#Using+with+JMX"> Using with JMX </a>
<ul class="minitoc">
<li>
<a href="#Enable+HBase+stats+collection">Enable HBase stats collection</a>
</li>
<li>
<a href="#Setup+JMX+remote+access">Setup JMX remote access</a>
</li>
<li>
<a href="#Configure+JMX+in+HBase+startup">Configure JMX in HBase startup</a>
</li>
</ul>
</li>
</ul>
</div>
<a name="N1000D"></a><a name="Introduction"></a>
<h2 class="h3"> Introduction </h2>
<div class="section">
<p>
HBase emits Hadoop <a href="http://hadoop.apache.org/core/docs/current/api/org/apache/hadoop/metrics/package-summary.html">metrics</a>.
</p>
</div>
<a name="N1001B"></a><a name="HOWTO"></a>
<h2 class="h3">HOWTO</h2>
<div class="section">
<p>First read up on Hadoop <a 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 href="http://wiki.apache.org/hadoop/GangliaMetrics">GangliaMetrics</a>
wiki page is useful read.</p>
<p>To have HBase emit metrics, edit <span class="codefrag">$HBASE_HOME/conf/hadoop-metrics.properties</span>
and enable metric 'contexts' per plugin. As of this writing, hadoop supports
<strong>file</strong> and <strong>ganglia</strong> plugins.
Yes, the hbase metrics files is named hadoop-metrics rather than
<em>hbase-metrics</em> because currently at least the hadoop metrics system has the
properties filename hardcoded. Per metrics <em>context</em>,
comment out the NullContext and enable one or more plugins instead.
</p>
<p>
If you enable the <em>hbase</em> 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 <em>rpc</em> context is good if you are interested in seeing
metrics on each hbase rpc method invocation (counts and time taken).
</p>
<p>
The <em>jvm</em> 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>
<a name="N10051"></a><a name="Using+with+JMX"></a>
<h2 class="h3"> Using with JMX </h2>
<div class="section">
<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>
<a name="N1005A"></a><a name="Enable+HBase+stats+collection"></a>
<h3 class="h4">Enable HBase stats collection</h3>
<p>
To enable JMX support in HBase, first edit
<span class="codefrag">$HBASE_HOME/conf/hadoop-metrics.properties</span> to support
metrics refreshing. (If you've already configured
<span class="codefrag">hadoop-metrics.properties</span> for another output context,
you can skip this step).
</p>
<pre class="code">
# 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>
<a name="N1006E"></a><a name="Setup+JMX+remote+access"></a>
<h3 class="h4">Setup JMX remote access</h3>
<p>
For remote access, you will need to configure JMX remote passwords
and access profiles. Create the files:
</p>
<dl>
<dt>
<span class="codefrag">$HBASE_HOME/conf/jmxremote.passwd</span> (set permissions
to 600)</dt>
<dd>
<pre class="code">
monitorRole monitorpass
controlRole controlpass
</pre>
</dd>
<dt>
<span class="codefrag">$HBASE_HOME/conf/jmxremote.access</span>
</dt>
<dd>
<pre class="code">
monitorRole readonly
controlRole readwrite
</pre>
</dd>
</dl>
<a name="N10092"></a><a name="Configure+JMX+in+HBase+startup"></a>
<h3 class="h4">Configure JMX in HBase startup</h3>
<p>
Finally, edit the <span class="codefrag">$HBASE_HOME/conf/hbase-env.sh</span>
script to add JMX support:
</p>
<dl>
<dt>
<span class="codefrag">$HBASE_HOME/conf/hbase-env.sh</span>
</dt>
<dd>
<p>Add the lines:</p>
<pre class="code">
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>
</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
<strong><span class="codefrag">hadoop</span></strong> domain in JMX.
</p>
</div>
</div>
<!--+
|end content
+-->
<div class="clearboth">&nbsp;</div>
</div>
<div id="footer">
<!--+
|start bottomstrip
+-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<div class="copyright">
Copyright &copy;
2009 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
</div>
<!--+
|end bottomstrip
+-->
</div>
</body>
</html>