hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject hbase git commit: HBASE-7171 Initial web UI for region/memstore/storefiles details
Date Wed, 09 Dec 2015 01:31:27 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 e5c435d25 -> 9f39d356c


HBASE-7171 Initial web UI for region/memstore/storefiles details


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9f39d356
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9f39d356
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9f39d356

Branch: refs/heads/branch-1
Commit: 9f39d356c404d07b5826a147d29c700da8b7489a
Parents: e5c435d
Author: Mikhail Antonov <antonov@apache.org>
Authored: Tue Dec 8 13:53:21 2015 -0800
Committer: Mikhail Antonov <antonov@apache.org>
Committed: Tue Dec 8 17:30:00 2015 -0800

----------------------------------------------------------------------
 .../tmpl/regionserver/RegionListTmpl.jamon      |  20 ++-
 .../hbase-webapps/regionserver/region.jsp       | 129 +++++++++++++++++++
 .../hbase-webapps/regionserver/storeFile.jsp    | 115 +++++++++++++++++
 3 files changed, 259 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9f39d356/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
index bf143b9..8e341f0 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RegionListTmpl.jamon
@@ -95,7 +95,9 @@
 
         <%for HRegionInfo r: onlineRegions %>
         <tr>
-            <td><% r.getRegionNameAsString() %></td>
+            <td><a href="region.jsp?name=<% r.getEncodedName() %>">
+              <% r.getRegionNameAsString() %></a>
+            </td>
             <td><% Bytes.toStringBinary(r.getStartKey()) %></td>
             <td><% Bytes.toStringBinary(r.getEndKey()) %></td>
             <td><% r.getReplicaId() %></td>
@@ -121,7 +123,9 @@
         <%java>
             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
         </%java>
-            <td><% r.getRegionNameAsString() %></td>
+            <td><a href="region.jsp?name=<% r.getEncodedName() %>">
+              <% r.getRegionNameAsString() %></a>
+            </td>
             <%if load != null %>
             <td><% load.getReadRequestsCount() %></td>
             <td><% load.getWriteRequestsCount() %></td>
@@ -154,7 +158,9 @@
         <%java>
             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
         </%java>
-            <td><% r.getRegionNameAsString() %></td>
+            <td><a href="region.jsp?name=<% r.getEncodedName() %>">
+              <% r.getRegionNameAsString() %></a>
+            </td>
             <%if load != null %>
             <td><% load.getStores() %></td>
             <td><% load.getStorefiles() %></td>
@@ -193,7 +199,9 @@
             ((float) load.getCurrentCompactedKVs() / load.getTotalCompactingKVs())) + "%";
             }
         </%java>
-            <td><% r.getRegionNameAsString() %></td>
+            <td><a href="region.jsp?name=<% r.getEncodedName() %>">
+              <% r.getRegionNameAsString() %></a>
+            </td>
             <%if load != null %>
             <td><% load.getTotalCompactingKVs() %></td>
             <td><% load.getCurrentCompactedKVs() %></td>
@@ -220,7 +228,9 @@
         <%java>
             RegionLoad load = regionServer.createRegionLoad(r.getEncodedName());
         </%java>
-            <td><% r.getRegionNameAsString() %></td>
+            <td><a href="region.jsp?name=<% r.getEncodedName() %>">
+              <% r.getRegionNameAsString() %></a>
+            </td>
             <%if load != null %>
             <td><% load.getMemstoreSizeMB() %>m</td>
             </%if>

http://git-wip-us.apache.org/repos/asf/hbase/blob/9f39d356/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
new file mode 100644
index 0000000..cd35ad1
--- /dev/null
+++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp
@@ -0,0 +1,129 @@
+<%--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+--%>
+<%@ page contentType="text/html;charset=UTF-8"
+  import="java.util.Collection"
+  import="java.util.Date"
+  import="java.util.List"
+  import="static org.apache.commons.lang.StringEscapeUtils.escapeXml"
+  import="org.apache.hadoop.conf.Configuration"
+  import="org.apache.hadoop.hbase.HTableDescriptor"
+  import="org.apache.hadoop.hbase.HColumnDescriptor"
+  import="org.apache.hadoop.hbase.HBaseConfiguration"
+  import="org.apache.hadoop.hbase.HRegionInfo"
+  import="org.apache.hadoop.hbase.regionserver.HRegionServer"
+  import="org.apache.hadoop.hbase.regionserver.Region"
+  import="org.apache.hadoop.hbase.regionserver.Store"
+  import="org.apache.hadoop.hbase.regionserver.StoreFile"%>
+<%
+  String regionName = request.getParameter("name");
+  HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
+  Configuration conf = rs.getConfiguration();
+
+  Region region = rs.getFromOnlineRegions(regionName);
+  String displayName = region.getRegionInfo().getRegionNameAsString();
+%>
+<!--[if IE]>
+<!DOCTYPE html>
+<![endif]-->
+<?xml version="1.0" encoding="UTF-8" ?>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>HBase RegionServer: <%= rs.getServerName() %></title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="">
+    <meta name="author" content="">
+
+
+      <link href="/static/css/bootstrap.min.css" rel="stylesheet">
+      <link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
+      <link href="/static/css/hbase.css" rel="stylesheet">
+  </head>
+
+  <body>
+
+  <div class="navbar  navbar-fixed-top navbar-default">
+      <div class="container-fluid">
+          <div class="navbar-header">
+              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+                  <span class="icon-bar"></span>
+                  <span class="icon-bar"></span>
+                  <span class="icon-bar"></span>
+              </button>
+              <a class="navbar-brand" href="/rs-status"><img src="/static/hbase_logo_small.png"
alt="HBase Logo"/></a>
+          </div>
+          <div class="collapse navbar-collapse">
+              <ul class="nav navbar-nav">
+                  <li class="active"><a href="/rs-status">Home</a></li>
+                  <li><a href="/logs/">Local Logs</a></li>
+                  <li><a href="/logLevel">Log Level</a></li>
+                  <li><a href="/dump">Debug Dump</a></li>
+                  <li><a href="/jmx">Metrics Dump</a></li>
+                  <% if (HBaseConfiguration.isShowConfInServlet()) { %>
+                  <li><a href="/conf">HBase Configuration</a></li>
+                  <% } %>
+              </ul>
+          </div><!--/.nav-collapse -->
+      </div>
+  </div>
+
+  <div class="container-fluid content">
+    <div class="row inner_header">
+        <div class="page-header">
+            <h1>Region: <%= displayName %></h1>
+        </div>
+    </div>
+
+<% if(region != null) { //
+     List<Store> stores = region.getStores();
+     for (Store store : stores) {
+       String cf = store.getColumnFamilyName();
+       Collection<StoreFile> storeFiles = store.getStorefiles(); %>
+
+       <h3>Column Family: <%= cf %></h2>
+
+       <h4>Memstore size (MB): <%= (int) (store.getMemStoreSize() / 1024 / 1024)
%></h3>
+
+       <h4>Store Files</h3>
+
+       <table class="table table-striped">
+         <tr>
+           <th>Store File</th>
+           <th>Size (MB)</th>
+           <th>Modification time</th>
+         </tr>
+       <%   for(StoreFile sf : storeFiles) { %>
+         <tr>
+           <td><a href="storeFile.jsp?name=<%= sf.getPath() %>"><%=
sf.getPath() %></a></td>
+           <td><%= (int) (rs.getFileSystem().getLength(sf.getPath()) / 1024 / 1024)
%></td>
+           <td><%= new Date(sf.getModificationTimeStamp()) %></td>
+         </tr>
+         <% } %>
+
+         <p> <%= storeFiles.size() %> StoreFile(s) in set.</p>
+         </table>
+   <%  }
+   }%>
+</div>
+<script src="/static/js/jquery.min.js" type="text/javascript"></script>
+<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/hbase/blob/9f39d356/hbase-server/src/main/resources/hbase-webapps/regionserver/storeFile.jsp
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/storeFile.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/storeFile.jsp
new file mode 100644
index 0000000..cbbb61f
--- /dev/null
+++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/storeFile.jsp
@@ -0,0 +1,115 @@
+<%--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+--%>
+<%@ page contentType="text/html;charset=UTF-8"
+  import="java.util.Collection"
+  import="java.util.Date"
+  import="java.util.List"
+  import="java.io.ByteArrayOutputStream"
+  import="java.io.PrintStream"
+  import="java.io.BufferedReader"
+  import="java.io.InputStreamReader"
+  import="org.apache.hadoop.conf.Configuration"
+  import="org.apache.hadoop.hbase.HBaseConfiguration"
+  import="org.apache.hadoop.hbase.io.hfile.HFilePrettyPrinter"
+  import="org.apache.hadoop.hbase.regionserver.HRegionServer"
+  import="org.apache.hadoop.hbase.regionserver.Region"
+  import="org.apache.hadoop.hbase.regionserver.Store"
+  import="org.apache.hadoop.hbase.regionserver.StoreFile"%>
+<%
+  String storeFile = request.getParameter("name");
+  HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER);
+  Configuration conf = rs.getConfiguration();
+%>
+<!--[if IE]>
+<!DOCTYPE html>
+<![endif]-->
+<?xml version="1.0" encoding="UTF-8" ?>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>HBase RegionServer: <%= rs.getServerName() %></title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="">
+    <meta name="author" content="">
+
+
+      <link href="/static/css/bootstrap.min.css" rel="stylesheet">
+      <link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
+      <link href="/static/css/hbase.css" rel="stylesheet">
+  </head>
+
+  <body>
+
+  <div class="navbar  navbar-fixed-top navbar-default">
+      <div class="container-fluid">
+          <div class="navbar-header">
+              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+                  <span class="icon-bar"></span>
+                  <span class="icon-bar"></span>
+                  <span class="icon-bar"></span>
+              </button>
+              <a class="navbar-brand" href="/rs-status"><img src="/static/hbase_logo_small.png"
alt="HBase Logo"/></a>
+          </div>
+          <div class="collapse navbar-collapse">
+              <ul class="nav navbar-nav">
+                  <li class="active"><a href="/rs-status">Home</a></li>
+                  <li><a href="/logs/">Local Logs</a></li>
+                  <li><a href="/logLevel">Log Level</a></li>
+                  <li><a href="/dump">Debug Dump</a></li>
+                  <li><a href="/jmx">Metrics Dump</a></li>
+                  <% if (HBaseConfiguration.isShowConfInServlet()) { %>
+                  <li><a href="/conf">HBase Configuration</a></li>
+                  <% } %>
+              </ul>
+          </div><!--/.nav-collapse -->
+      </div>
+  </div>
+
+  <div class="container-fluid content">
+    <div class="row inner_header">
+        <div class="page-header">
+            <h4>StoreFile: <%= storeFile %></h4>
+        </div>
+    </div>
+    <pre>
+<%
+   try {
+     ProcessBuilder pb=new ProcessBuilder("hbase", "hfile", "-s", "-f", storeFile);
+     pb.redirectErrorStream(true);
+     Process pr = pb.start();
+     BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
+     String line;
+     while ((line = in.readLine()) != null) {%>
+       <%= line %>
+     <%}
+     pr.waitFor();
+     in.close();
+   }
+   catch (Exception e) {%>
+     <%= e %>
+   <%}
+%>
+  </pre>
+</div>
+<script src="/static/js/jquery.min.js" type="text/javascript"></script>
+<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
+
+</body>
+</html>


Mime
View raw message