You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2010/05/26 04:56:09 UTC
svn commit: r948298 - in /hbase/trunk: ./ src/assembly/
src/main/java/org/apache/hadoop/hbase/util/
src/main/resources/hbase-webapps/ src/main/resources/hbase-webapps/master/
src/main/resources/hbase-webapps/regionserver/
src/main/resources/hbase-webap...
Author: apurtell
Date: Wed May 26 02:56:08 2010
New Revision: 948298
URL: http://svn.apache.org/viewvc?rev=948298&view=rev
Log:
HBASE-2586 Move hbase webapps to a hbase-webapps dir
Added:
hbase/trunk/src/main/resources/hbase-webapps/
hbase/trunk/src/main/resources/hbase-webapps/master/
hbase/trunk/src/main/resources/hbase-webapps/master/index.html
hbase/trunk/src/main/resources/hbase-webapps/master/master.jsp
hbase/trunk/src/main/resources/hbase-webapps/master/table.jsp
hbase/trunk/src/main/resources/hbase-webapps/master/zk.jsp
hbase/trunk/src/main/resources/hbase-webapps/regionserver/
hbase/trunk/src/main/resources/hbase-webapps/regionserver/index.html
hbase/trunk/src/main/resources/hbase-webapps/regionserver/regionserver.jsp
hbase/trunk/src/main/resources/hbase-webapps/static/
hbase/trunk/src/main/resources/hbase-webapps/static/hbase.css
Removed:
hbase/trunk/src/main/resources/webapps/
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/pom.xml
hbase/trunk/src/assembly/bin.xml
hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=948298&r1=948297&r2=948298&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Wed May 26 02:56:08 2010
@@ -357,6 +357,8 @@ Release 0.21.0 - Unreleased
(Todd Lipcon via Stack)
HBASE-2590 Failed parse of branch element in saveVersion.sh
(Benoît Sigoure via Stack)
+ HBASE-2586 Move hbase webapps to a hbase-webapps dir (Todd Lipcon via
+ Andrew Purtell)
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable
Modified: hbase/trunk/pom.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/pom.xml?rev=948298&r1=948297&r2=948298&view=diff
==============================================================================
--- hbase/trunk/pom.xml (original)
+++ hbase/trunk/pom.xml Wed May 26 02:56:08 2010
@@ -268,7 +268,7 @@
<directory>src/main/resources</directory>
</resource>
<resource>
- <directory>src/main/webapps</directory>
+ <directory>src/main/hbase-webapps</directory>
<includes>
<include>*/.gif</include>
<include>*/.css</include>
@@ -359,14 +359,14 @@
<configuration>
<tasks>
<taskdef classname="org.apache.jasper.JspC" name="jspcompiler" classpathref="maven.compile.classpath"/>
- <jspcompiler uriroot="${basedir}/src/main/resources/webapps/master"
+ <jspcompiler uriroot="${basedir}/src/main/resources/hbase-webapps/master"
outputdir="${project.build.directory}/jspc"
package="org.apache.hadoop.hbase.generated.master"
- webxml="${basedir}/src/main/resources/webapps/master/WEB-INF/web.xml"/>
- <jspcompiler uriroot="${basedir}/src/main/resources/webapps/regionserver"
+ webxml="${basedir}/src/main/resources/hbase-webapps/master/WEB-INF/web.xml"/>
+ <jspcompiler uriroot="${basedir}/src/main/resources/hbase-webapps/regionserver"
outputdir="${project.build.directory}/jspc"
package="org.apache.hadoop.hbase.generated.regionserver"
- webxml="${basedir}/src/main/resources/webapps/regionserver/WEB-INF/web.xml"/>
+ webxml="${basedir}/src/main/resources/hbase-webapps/regionserver/WEB-INF/web.xml"/>
</tasks>
</configuration>
<goals>
Modified: hbase/trunk/src/assembly/bin.xml
URL: http://svn.apache.org/viewvc/hbase/trunk/src/assembly/bin.xml?rev=948298&r1=948297&r2=948298&view=diff
==============================================================================
--- hbase/trunk/src/assembly/bin.xml (original)
+++ hbase/trunk/src/assembly/bin.xml Wed May 26 02:56:08 2010
@@ -34,8 +34,8 @@
</includes>
</fileSet>
<fileSet>
- <directory>target/classes/webapps</directory>
- <outputDirectory>webapps</outputDirectory>
+ <directory>target/classes/hbase-webapps</directory>
+ <outputDirectory>hbase-webapps</outputDirectory>
<excludes>
<exclude>**/*.jsp</exclude>
</excludes>
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java?rev=948298&r1=948297&r2=948298&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java Wed May 26 02:56:08 2010
@@ -34,13 +34,13 @@ import java.util.Map;
* is to serve up status information for the server.
* There are three contexts:
* "/stacks/" -> points to stack trace
- * "/static/" -> points to common static files (src/webapps/static)
- * "/" -> the jsp server code from (src/webapps/<name>)
+ * "/static/" -> points to common static files (src/hbase-webapps/static)
+ * "/" -> the jsp server code from (src/hbase-webapps/<name>)
*/
public class InfoServer extends HttpServer {
/**
* Create a status server on the given port.
- * The jsp scripts are taken from src/webapps/<code>name<code>.
+ * The jsp scripts are taken from src/hbase-webapps/<code>name<code>.
* @param name The name of the server
* @param bindAddress address to bind to
* @param port The port to use on the server
@@ -103,7 +103,7 @@ public class InfoServer extends HttpServ
throws IOException {
URL url = InfoServer.class.getClassLoader().getResource(path);
if (url == null)
- throw new IOException("webapps not found in CLASSPATH: " + path);
+ throw new IOException("hbase-webapps not found in CLASSPATH: " + path);
return url.toString();
}
@@ -116,7 +116,7 @@ public class InfoServer extends HttpServ
public static String getWebAppDir(final String webappName)
throws IOException {
String webappDir;
- webappDir = getWebAppsPath("webapps/" + webappName);
+ webappDir = getWebAppsPath("hbase-webapps/" + webappName);
return webappDir;
}
}
Added: hbase/trunk/src/main/resources/hbase-webapps/master/index.html
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/master/index.html?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/master/index.html (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/master/index.html Wed May 26 02:56:08 2010
@@ -0,0 +1 @@
+<meta HTTP-EQUIV="REFRESH" content="0;url=master.jsp"/>
Added: hbase/trunk/src/main/resources/hbase-webapps/master/master.jsp
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/master/master.jsp?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/master/master.jsp (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/master/master.jsp Wed May 26 02:56:08 2010
@@ -0,0 +1,151 @@
+<%@ page contentType="text/html;charset=UTF-8"
+ import="java.util.*"
+ import="org.apache.hadoop.conf.Configuration"
+ import="org.apache.hadoop.hbase.util.Bytes"
+ import="org.apache.hadoop.hbase.util.JvmVersion"
+ import="org.apache.hadoop.hbase.master.HMaster"
+ import="org.apache.hadoop.hbase.HConstants"
+ import="org.apache.hadoop.hbase.master.MetaRegion"
+ import="org.apache.hadoop.hbase.client.HBaseAdmin"
+ import="org.apache.hadoop.hbase.HServerInfo"
+ import="org.apache.hadoop.hbase.HServerAddress"
+ import="org.apache.hadoop.hbase.HTableDescriptor" %><%
+ HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+ Configuration conf = master.getConfiguration();
+ HServerAddress rootLocation = master.getRegionManager().getRootRegionLocation();
+ Map<byte [], MetaRegion> onlineRegions = master.getRegionManager().getOnlineMetaRegions();
+ Map<String, HServerInfo> serverToServerInfos =
+ master.getServerManager().getServersToServerInfo();
+ int interval = conf.getInt("hbase.regionserver.msginterval", 1000)/1000;
+ if (interval == 0) {
+ interval = 1;
+ }
+ boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false);
+ Map<String, Integer> frags = null;
+ if (showFragmentation) {
+ frags = master.getTableFragmentation();
+ }
+%><?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<title>HBase Master: <%= master.getMasterAddress().getHostname()%>:<%= master.getMasterAddress().getPort() %></title>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+<body>
+<a id="logo" href="http://wiki.apache.org/lucene-hadoop/Hbase"><img src="/static/hbase_logo_med.gif" alt="HBase Logo" title="HBase Logo" /></a>
+<h1 id="page_title">Master: <%=master.getMasterAddress().getHostname()%>:<%=master.getMasterAddress().getPort()%></h1>
+<p id="links_menu"><a href="/logs/">Local logs</a>, <a href="/stacks">Thread Dump</a>, <a href="/logLevel">Log Level</a></p>
+
+<% if (JvmVersion.isBadJvmVersion()) { %>
+ <div class="warning">
+ Your current JVM version <%= System.getProperty("java.version") %> is known to be
+ unstable with HBase. Please see the
+ <a href="http://wiki.apache.org/hadoop/Hbase/Troubleshooting#A18">HBase wiki</a>
+ for details.
+ </div>
+<% } %>
+
+<hr id="head_rule" />
+
+<h2>Master Attributes</h2>
+<table>
+<tr><th>Attribute Name</th><th>Value</th><th>Description</th></tr>
+<tr><td>HBase Version</td><td><%= org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<%= org.apache.hadoop.hbase.util.VersionInfo.getRevision() %></td><td>HBase version and svn revision</td></tr>
+<tr><td>HBase Compiled</td><td><%= org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <%= org.apache.hadoop.hbase.util.VersionInfo.getUser() %></td><td>When HBase version was compiled and by whom</td></tr>
+<tr><td>Hadoop Version</td><td><%= org.apache.hadoop.util.VersionInfo.getVersion() %>, r<%= org.apache.hadoop.util.VersionInfo.getRevision() %></td><td>Hadoop version and svn revision</td></tr>
+<tr><td>Hadoop Compiled</td><td><%= org.apache.hadoop.util.VersionInfo.getDate() %>, <%= org.apache.hadoop.util.VersionInfo.getUser() %></td><td>When Hadoop version was compiled and by whom</td></tr>
+<tr><td>HBase Root Directory</td><td><%= master.getRootDir().toString() %></td><td>Location of HBase home directory</td></tr>
+<tr><td>Load average</td><td><%= master.getServerManager().getAverageLoad() %></td><td>Average number of regions per regionserver. Naive computation.</td></tr>
+<tr><td>Regions On FS</td><td><%= master.getRegionManager().countRegionsOnFS() %></td><td>Number of regions on FileSystem. Rough count.</td></tr>
+<% if (showFragmentation) { %>
+ <tr><td>Fragmentation</td><td><%= frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a" %></td><td>Overall fragmentation of all tables, including .META. and -ROOT-.</td></tr>
+<% } %>
+<tr><td>Zookeeper Quorum</td><td><%= master.getZooKeeperWrapper().getQuorumServers() %></td><td>Addresses of all registered ZK servers. For more, see <a href="/zk.jsp">zk dump</a>.</td></tr>
+</table>
+
+<h2>Catalog Tables</h2>
+<%
+ if (rootLocation != null) { %>
+<table>
+<tr>
+ <th>Table</th>
+<% if (showFragmentation) { %>
+ <th title="Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.">Frag.</th>
+<% } %>
+ <th>Description</th>
+</tr>
+<tr>
+ <td><a href="table.jsp?name=<%= Bytes.toString(HConstants.ROOT_TABLE_NAME) %>"><%= Bytes.toString(HConstants.ROOT_TABLE_NAME) %></a></td>
+<% if (showFragmentation) { %>
+ <td align="center"><%= frags.get("-ROOT-") != null ? frags.get("-ROOT-").intValue() + "%" : "n/a" %></td>
+<% } %>
+ <td>The -ROOT- table holds references to all .META. regions.</td>
+</tr>
+<%
+ if (onlineRegions != null && onlineRegions.size() > 0) { %>
+<tr>
+ <td><a href="table.jsp?name=<%= Bytes.toString(HConstants.META_TABLE_NAME) %>"><%= Bytes.toString(HConstants.META_TABLE_NAME) %></a></td>
+<% if (showFragmentation) { %>
+ <td align="center"><%= frags.get(".META.") != null ? frags.get(".META.").intValue() + "%" : "n/a" %></td>
+<% } %>
+ <td>The .META. table holds references to all User Table regions</td>
+</tr>
+
+<% } %>
+</table>
+<%} %>
+
+<h2>User Tables</h2>
+<% HTableDescriptor[] tables = new HBaseAdmin(conf).listTables();
+ if(tables != null && tables.length > 0) { %>
+<table>
+<tr>
+ <th>Table</th>
+<% if (showFragmentation) { %>
+ <th title="Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.">Frag.</th>
+<% } %>
+ <th>Description</th>
+</tr>
+<% for(HTableDescriptor htDesc : tables ) { %>
+<tr>
+ <td><a href=table.jsp?name=<%= htDesc.getNameAsString() %>><%= htDesc.getNameAsString() %></a> </td>
+<% if (showFragmentation) { %>
+ <td align="center"><%= frags.get(htDesc.getNameAsString()) != null ? frags.get(htDesc.getNameAsString()).intValue() + "%" : "n/a" %></td>
+<% } %>
+ <td><%= htDesc.toString() %></td>
+</tr>
+<% } %>
+
+<p> <%= tables.length %> table(s) in set.</p>
+</table>
+<% } %>
+
+<h2>Region Servers</h2>
+<% if (serverToServerInfos != null && serverToServerInfos.size() > 0) { %>
+<% int totalRegions = 0;
+ int totalRequests = 0;
+%>
+
+<table>
+<tr><th rowspan="<%= serverToServerInfos.size() + 1%>"></th><th>Address</th><th>Start Code</th><th>Load</th></tr>
+<% String[] serverNames = serverToServerInfos.keySet().toArray(new String[serverToServerInfos.size()]);
+ Arrays.sort(serverNames);
+ for (String serverName: serverNames) {
+ HServerInfo hsi = serverToServerInfos.get(serverName);
+ String hostname = hsi.getServerAddress().getHostname() + ":" + hsi.getInfoPort();
+ String url = "http://" + hostname + "/";
+ totalRegions += hsi.getLoad().getNumberOfRegions();
+ totalRequests += hsi.getLoad().getNumberOfRequests() / interval;
+ long startCode = hsi.getStartCode();
+%>
+<tr><td><a href="<%= url %>"><%= hostname %></a></td><td><%= startCode %></td><td><%= hsi.getLoad().toString(interval) %></td></tr>
+<% } %>
+<tr><th>Total: </th><td>servers: <%= serverToServerInfos.size() %></td><td> </td><td>requests=<%= totalRequests %>, regions=<%= totalRegions %></td></tr>
+</table>
+
+<p>Load is requests per second and count of regions loaded</p>
+<% } %>
+</body>
+</html>
Added: hbase/trunk/src/main/resources/hbase-webapps/master/table.jsp
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/master/table.jsp?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/master/table.jsp (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/master/table.jsp Wed May 26 02:56:08 2010
@@ -0,0 +1,208 @@
+<%@ page contentType="text/html;charset=UTF-8"
+ import="java.util.Map"
+ import="org.apache.hadoop.io.Writable"
+ import="org.apache.hadoop.conf.Configuration"
+ import="org.apache.hadoop.hbase.client.HTable"
+ import="org.apache.hadoop.hbase.client.HBaseAdmin"
+ import="org.apache.hadoop.hbase.HRegionInfo"
+ import="org.apache.hadoop.hbase.HServerAddress"
+ import="org.apache.hadoop.hbase.HServerInfo"
+ import="org.apache.hadoop.hbase.io.ImmutableBytesWritable"
+ import="org.apache.hadoop.hbase.master.HMaster"
+ import="org.apache.hadoop.hbase.master.MetaRegion"
+ import="org.apache.hadoop.hbase.util.Bytes"
+ import="java.util.Map"
+ import="org.apache.hadoop.hbase.HConstants"%><%
+ HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+ Configuration conf = master.getConfiguration();
+ HBaseAdmin hbadmin = new HBaseAdmin(conf);
+ String tableName = request.getParameter("name");
+ HTable table = new HTable(conf, tableName);
+ Map<HServerAddress, HServerInfo> serverAddressToServerInfos =
+ master.getServerManager().getServerAddressToServerInfo();
+ String tableHeader = "<h2>Table Regions</h2><table><tr><th>Name</th><th>Region Server</th><th>Encoded Name</th><th>Start Key</th><th>End Key</th></tr>";
+ HServerAddress rootLocation = master.getRegionManager().getRootRegionLocation();
+ boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false);
+ Map<String, Integer> frags = null;
+ if (showFragmentation) {
+ frags = master.getTableFragmentation();
+ }
+%>
+
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<%
+ String action = request.getParameter("action");
+ String key = request.getParameter("key");
+ if ( action != null ) {
+%>
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+<body>
+<a id="logo" href="http://wiki.apache.org/lucene-hadoop/Hbase"><img src="/static/hbase_logo_med.gif" alt="HBase Logo" title="HBase Logo" /></a>
+<h1 id="page_title">Table action request accepted</h1>
+<p><hr><p>
+<%
+ if (action.equals("split")) {
+ if (key != null && key.length() > 0) {
+ Writable[] arr = new Writable[1];
+ arr[0] = new ImmutableBytesWritable(Bytes.toBytes(key));
+ master.modifyTable(Bytes.toBytes(tableName), HConstants.Modify.TABLE_SPLIT, arr);
+ } else {
+ master.modifyTable(Bytes.toBytes(tableName), HConstants.Modify.TABLE_SPLIT, null);
+ }
+ %> Split request accepted. <%
+ } else if (action.equals("compact")) {
+ if (key != null && key.length() > 0) {
+ Writable[] arr = new Writable[1];
+ arr[0] = new ImmutableBytesWritable(Bytes.toBytes(key));
+ master.modifyTable(Bytes.toBytes(tableName), HConstants.Modify.TABLE_COMPACT, arr);
+ } else {
+ master.modifyTable(Bytes.toBytes(tableName), HConstants.Modify.TABLE_COMPACT, null);
+ }
+ %> Compact request accepted. <%
+ }
+%>
+<p>Reload.
+</body>
+<%
+} else {
+%>
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<title>Table: <%= tableName %></title>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+<body>
+<a id="logo" href="http://wiki.apache.org/lucene-hadoop/Hbase"><img src="/static/hbase_logo_med.gif" alt="HBase Logo" title="HBase Logo" /></a>
+<h1 id="page_title">Table: <%= tableName %></h1>
+<p id="links_menu"><a href="/master.jsp">Master</a>, <a href="/logs/">Local logs</a>, <a href="/stacks">Thread Dump</a>, <a href="/logLevel">Log Level</a></p>
+<hr id="head_rule" />
+<%
+ if(tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME))) {
+%>
+<%= tableHeader %>
+<%
+ int infoPort = serverAddressToServerInfos.get(rootLocation).getInfoPort();
+ String url = "http://" + rootLocation.getHostname() + ":" + infoPort + "/";
+%>
+<tr>
+ <td><%= tableName %></td>
+ <td><a href="<%= url %>"><%= rootLocation.getHostname() %>:<%= rootLocation.getPort() %></a></td>
+ <td>-</td>
+ <td></td>
+ <td>-</td>
+</tr>
+</table>
+<%
+ } else if(tableName.equals(Bytes.toString(HConstants.META_TABLE_NAME))) {
+%>
+<%= tableHeader %>
+<%
+ Map<byte [], MetaRegion> onlineRegions = master.getRegionManager().getOnlineMetaRegions();
+ for (MetaRegion meta: onlineRegions.values()) {
+ int infoPort = serverAddressToServerInfos.get(meta.getServer()).getInfoPort();
+ String url = "http://" + meta.getServer().getHostname() + ":" + infoPort + "/";
+%>
+<tr>
+ <td><%= Bytes.toString(meta.getRegionName()) %></td>
+ <td><a href="<%= url %>"><%= meta.getServer().getHostname().toString() + ":" + infoPort %></a></td>
+ <td>-</td><td><%= Bytes.toString(meta.getStartKey()) %></td><td><%= Bytes.toString(meta.getEndKey()) %></td>
+</tr>
+<% } %>
+</table>
+<%} else {
+ try { %>
+<h2>Table Attributes</h2>
+<table>
+ <tr>
+ <th>Attribute Name</th>
+ <th>Value</th>
+ <th>Description</th></tr>
+ <tr>
+ <td>Enabled</td>
+ <td><%= hbadmin.isTableEnabled(table.getTableName()) %></td>
+ <td>Is the table enabled</td>
+ </tr>
+<% if (showFragmentation) { %>
+ <tr>
+ <td>Fragmentation</td>
+ <td><%= frags.get(tableName) != null ? frags.get(tableName).intValue() + "%" : "n/a" %></td>
+ <td>How fragmented is the table. After a major compaction it is 0%.</td>
+ </tr>
+<% } %>
+</table>
+<%
+ Map<HRegionInfo, HServerAddress> regions = table.getRegionsInfo();
+ if(regions != null && regions.size() > 0) { %>
+<%= tableHeader %>
+<%
+ for(Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) {
+
+ int infoPort = serverAddressToServerInfos.get(
+ hriEntry.getValue()).getInfoPort();
+
+ String urlRegionServer =
+ "http://" + hriEntry.getValue().getHostname().toString() + ":" + infoPort + "/";
+%>
+<tr>
+ <td><%= Bytes.toStringBinary(hriEntry.getKey().getRegionName())%></td>
+ <td><a href="<%= urlRegionServer %>"><%= hriEntry.getValue().getHostname().toString() + ":" + infoPort %></a></td>
+ <td><%= hriEntry.getKey().getEncodedName()%></td> <td><%= Bytes.toStringBinary(hriEntry.getKey().getStartKey())%></td>
+ <td><%= Bytes.toStringBinary(hriEntry.getKey().getEndKey())%></td>
+</tr>
+<% } %>
+</table>
+<% }
+} catch(Exception ex) {
+ ex.printStackTrace();
+}
+} // end else
+%>
+
+<p><hr><p>
+Actions:
+<p>
+<center>
+<table style="border-style: none" width="90%">
+<tr>
+ <form method="get">
+ <input type="hidden" name="action" value="compact">
+ <input type="hidden" name="name" value="<%= tableName %>">
+ <td style="border-style: none; text-align: center">
+ <input style="font-size: 12pt; width: 10em" type="submit" value="Compact"></td>
+ <td style="border-style: none" width="5%"> </td>
+ <td style="border-style: none">Region Key (optional):<input type="text" name="key" size="40"></td>
+ <td style="border-style: none">This action will force a compaction of all
+ regions of the table, or, if a key is supplied, only the region containing the
+ given key.</td>
+ </form>
+</tr>
+<tr><td style="border-style: none" colspan="4"> </td></tr>
+<tr>
+ <form method="get">
+ <input type="hidden" name="action" value="split">
+ <input type="hidden" name="name" value="<%= tableName %>">
+ <td style="border-style: none; text-align: center">
+ <input style="font-size: 12pt; width: 10em" type="submit" value="Split"></td>
+ <td style="border-style: none" width="5%"> </td>
+ <td style="border-style: none">Region Key (optional):<input type="text" name="key" size="40"></td>
+ <td style="border-style: none">This action will force a split of all eligible
+ regions of the table, or, if a key is supplied, only the region containing the
+ given key. An eligible region is one that does not contain any references to
+ other regions. Split requests for noneligible regions will be ignored.</td>
+ </form>
+</tr>
+</table>
+</center>
+<p>
+
+<%
+}
+%>
+
+</body>
+</html>
Added: hbase/trunk/src/main/resources/hbase-webapps/master/zk.jsp
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/master/zk.jsp?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/master/zk.jsp (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/master/zk.jsp Wed May 26 02:56:08 2010
@@ -0,0 +1,36 @@
+<%@ page contentType="text/html;charset=UTF-8"
+ import="java.io.IOException"
+ import="org.apache.hadoop.conf.Configuration"
+ import="org.apache.hadoop.hbase.client.HBaseAdmin"
+ import="org.apache.hadoop.hbase.client.HConnection"
+ import="org.apache.hadoop.hbase.HRegionInfo"
+ import="org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper"
+ import="org.apache.hadoop.hbase.HBaseConfiguration"
+ import="org.apache.hadoop.hbase.master.HMaster"
+ import="org.apache.hadoop.hbase.HConstants"%><%
+ HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
+ Configuration conf = master.getConfiguration();
+ HBaseAdmin hbadmin = new HBaseAdmin(conf);
+ HConnection connection = hbadmin.getConnection();
+ ZooKeeperWrapper wrapper = connection.getZooKeeperWrapper();
+%>
+
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<title>ZooKeeper Dump</title>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+<body>
+<a id="logo" href="http://hbase.org"><img src="/static/hbase_logo_med.gif" alt="HBase Logo" title="HBase Logo" /></a>
+<h1 id="page_title">ZooKeeper Dump</h1>
+<p id="links_menu"><a href="/master.jsp">Master</a>, <a href="/logs/">Local logs</a>, <a href="/stacks">Thread Dump</a>, <a href="/logLevel">Log Level</a></p>
+<hr id="head_rule" />
+<pre>
+<%= wrapper.dump() %>
+</pre>
+
+</body>
+</html>
Added: hbase/trunk/src/main/resources/hbase-webapps/regionserver/index.html
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/regionserver/index.html?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/regionserver/index.html (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/regionserver/index.html Wed May 26 02:56:08 2010
@@ -0,0 +1 @@
+<meta HTTP-EQUIV="REFRESH" content="0;url=regionserver.jsp"/>
Added: hbase/trunk/src/main/resources/hbase-webapps/regionserver/regionserver.jsp
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/regionserver/regionserver.jsp?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/regionserver/regionserver.jsp (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/regionserver/regionserver.jsp Wed May 26 02:56:08 2010
@@ -0,0 +1,77 @@
+<%@ page contentType="text/html;charset=UTF-8"
+ import="java.util.*"
+ import="java.io.IOException"
+ import="org.apache.hadoop.io.Text"
+ import="org.apache.hadoop.hbase.regionserver.HRegionServer"
+ import="org.apache.hadoop.hbase.regionserver.HRegion"
+ import="org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics"
+ import="org.apache.hadoop.hbase.util.Bytes"
+ import="org.apache.hadoop.hbase.HConstants"
+ import="org.apache.hadoop.hbase.HServerInfo"
+ import="org.apache.hadoop.hbase.HServerLoad"
+ import="org.apache.hadoop.hbase.HRegionInfo" %><%
+ HRegionServer regionServer = (HRegionServer)getServletContext().getAttribute(HRegionServer.REGIONSERVER);
+ HServerInfo serverInfo = null;
+ try {
+ serverInfo = regionServer.getHServerInfo();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ RegionServerMetrics metrics = regionServer.getMetrics();
+ Collection<HRegionInfo> onlineRegions = regionServer.getSortedOnlineRegionInfos();
+ int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval", 3000)/1000;
+
+%><?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+<title>HBase Region Server: <%= serverInfo.getServerAddress().getHostname() %>:<%= serverInfo.getServerAddress().getPort() %></title>
+<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
+</head>
+
+<body>
+<a id="logo" href="http://wiki.apache.org/lucene-hadoop/Hbase"><img src="/static/hbase_logo_med.gif" alt="HBase Logo" title="HBase Logo" /></a>
+<h1 id="page_title">Region Server: <%= serverInfo.getServerAddress().getHostname() %>:<%= serverInfo.getServerAddress().getPort() %></h1>
+<p id="links_menu"><a href="/logs/">Local logs</a>, <a href="/stacks">Thread Dump</a>, <a href="/logLevel">Log Level</a></p>
+<hr id="head_rule" />
+
+<h2>Region Server Attributes</h2>
+<table>
+<tr><th>Attribute Name</th><th>Value</th><th>Description</th></tr>
+<tr><td>HBase Version</td><td><%= org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<%= org.apache.hadoop.hbase.util.VersionInfo.getRevision() %></td><td>HBase version and svn revision</td></tr>
+<tr><td>HBase Compiled</td><td><%= org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <%= org.apache.hadoop.hbase.util.VersionInfo.getUser() %></td><td>When HBase version was compiled and by whom</td></tr>
+<tr><td>Metrics</td><td><%= metrics.toString() %></td><td>RegionServer Metrics; file and heap sizes are in megabytes</td></tr>
+<tr><td>Zookeeper Quorum</td><td><%= regionServer.getZooKeeperWrapper().getQuorumServers() %></td><td>Addresses of all registered ZK servers</td></tr>
+</table>
+
+<h2>Online Regions</h2>
+<% if (onlineRegions != null && onlineRegions.size() > 0) { %>
+<table>
+<tr><th>Region Name</th><th>Encoded Name</th><th>Start Key</th><th>End Key</th><th>Metrics</th></tr>
+<% for (HRegionInfo r: onlineRegions) {
+ HServerLoad.RegionLoad load = regionServer.createRegionLoad(r.getRegionName());
+ %>
+<tr><td><%= r.getRegionNameAsString() %></td><td><%= r.getEncodedName() %></td>
+ <td><%= Bytes.toStringBinary(r.getStartKey()) %></td><td><%= Bytes.toStringBinary(r.getEndKey()) %></td>
+ <td><%= load.toString() %></td>
+ </tr>
+<% } %>
+</table>
+<p>Region names are made of the containing table's name, a comma,
+the start key, a comma, and a randomly generated region id. To illustrate,
+the region named
+<em>domains,apache.org,5464829424211263407</em> is party to the table
+<em>domains</em>, has an id of <em>5464829424211263407</em> and the first key
+in the region is <em>apache.org</em>. The <em>-ROOT-</em>
+and <em>.META.</em> 'tables' are internal sytem tables (or 'catalog' tables in db-speak).
+The -ROOT- keeps a list of all regions in the .META. table. The .META. table
+keeps a list of all regions in the system. The empty key is used to denote
+table start and table end. A region with an empty start key is the first region in a table.
+If region has both an empty start and an empty end key, its the only region in the table. See
+<a href="http://hbase.org">HBase Home</a> for further explication.<p>
+<% } else { %>
+<p>Not serving regions</p>
+<% } %>
+</body>
+</html>
Added: hbase/trunk/src/main/resources/hbase-webapps/static/hbase.css
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/resources/hbase-webapps/static/hbase.css?rev=948298&view=auto
==============================================================================
--- hbase/trunk/src/main/resources/hbase-webapps/static/hbase.css (added)
+++ hbase/trunk/src/main/resources/hbase-webapps/static/hbase.css Wed May 26 02:56:08 2010
@@ -0,0 +1,15 @@
+h1, h2, h3 { color: DarkSlateBlue }
+table { border: thin solid DodgerBlue }
+tr { border: thin solid DodgerBlue }
+td { border: thin solid DodgerBlue }
+th { border: thin solid DodgerBlue }
+#logo {float: left;}
+#logo img {border: none;}
+#page_title {padding-top: 27px;}
+
+div.warning {
+ border: 1px solid #666;
+ background-color: #fcc;
+ font-size: 110%;
+ font-weight: bold;
+}