HBASE-1235 Add table enabled status to shell and UI
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@751331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ae864d629
commit
e60cf99672
|
@ -57,13 +57,13 @@ module HBase
|
||||||
|
|
||||||
def describe(tableName)
|
def describe(tableName)
|
||||||
now = Time.now
|
now = Time.now
|
||||||
@formatter.header()
|
@formatter.header(["FAMILIES", "ENABLED"])
|
||||||
found = false
|
found = false
|
||||||
tables = @admin.listTables().to_a
|
tables = @admin.listTables().to_a
|
||||||
tables.push(HTableDescriptor::META_TABLEDESC, HTableDescriptor::ROOT_TABLEDESC)
|
tables.push(HTableDescriptor::META_TABLEDESC, HTableDescriptor::ROOT_TABLEDESC)
|
||||||
for t in tables
|
for t in tables
|
||||||
if t.getNameAsString() == tableName
|
if t.getNameAsString() == tableName
|
||||||
@formatter.row([t.to_s])
|
@formatter.row([t.to_s, "%s" % [@admin.isTableEnabled(tableName)]])
|
||||||
found = true
|
found = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
import="org.apache.hadoop.io.Writable"
|
import="org.apache.hadoop.io.Writable"
|
||||||
import="org.apache.hadoop.hbase.HTableDescriptor"
|
import="org.apache.hadoop.hbase.HTableDescriptor"
|
||||||
import="org.apache.hadoop.hbase.client.HTable"
|
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.HRegionInfo"
|
||||||
import="org.apache.hadoop.hbase.HServerAddress"
|
import="org.apache.hadoop.hbase.HServerAddress"
|
||||||
import="org.apache.hadoop.hbase.HServerInfo"
|
import="org.apache.hadoop.hbase.HServerInfo"
|
||||||
|
import="org.apache.hadoop.hbase.HBaseConfiguration"
|
||||||
import="org.apache.hadoop.hbase.io.ImmutableBytesWritable"
|
import="org.apache.hadoop.hbase.io.ImmutableBytesWritable"
|
||||||
import="org.apache.hadoop.hbase.master.HMaster"
|
import="org.apache.hadoop.hbase.master.HMaster"
|
||||||
import="org.apache.hadoop.hbase.master.MetaRegion"
|
import="org.apache.hadoop.hbase.master.MetaRegion"
|
||||||
|
@ -14,11 +16,13 @@
|
||||||
import="java.util.Map"
|
import="java.util.Map"
|
||||||
import="org.apache.hadoop.hbase.HConstants"%><%
|
import="org.apache.hadoop.hbase.HConstants"%><%
|
||||||
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
|
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
|
||||||
|
HBaseConfiguration conf = master.getConfiguration();
|
||||||
|
HBaseAdmin hbadmin = new HBaseAdmin(conf);
|
||||||
String tableName = request.getParameter("name");
|
String tableName = request.getParameter("name");
|
||||||
HTable table = new HTable(master.getConfiguration(), tableName);
|
HTable table = new HTable(conf, tableName);
|
||||||
Map<String, HServerInfo> serverToServerInfos =
|
Map<String, HServerInfo> serverToServerInfos =
|
||||||
master.getServersToServerInfo();
|
master.getServersToServerInfo();
|
||||||
String tableHeader = "<table><tr><th>Name</th><th>Region Server</th><th>Encoded Name</th><th>Start Key</th><th>End Key</th></tr>";
|
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.getRootRegionLocation();
|
HServerAddress rootLocation = master.getRootRegionLocation();
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
@ -68,12 +72,12 @@ if ( action != null ) {
|
||||||
%>
|
%>
|
||||||
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
|
||||||
<meta http-equiv="refresh" content="30"/>
|
<meta http-equiv="refresh" content="30"/>
|
||||||
<title>Regions in <%= tableName %></title>
|
<title>Table: <%= tableName %></title>
|
||||||
<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
|
<link rel="stylesheet" type="text/css" href="/static/hbase.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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>
|
<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">Regions in <%= tableName %></h1>
|
<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>
|
<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" />
|
<hr id="head_rule" />
|
||||||
<%if(tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME))) {%>
|
<%if(tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME))) {%>
|
||||||
|
@ -94,8 +98,13 @@ if ( action != null ) {
|
||||||
<% } %>
|
<% } %>
|
||||||
</table>
|
</table>
|
||||||
<%} else {
|
<%} else {
|
||||||
try {
|
try { %>
|
||||||
Map<HRegionInfo, HServerAddress> regions = table.getRegionsInfo();
|
<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>
|
||||||
|
</table>
|
||||||
|
<% Map<HRegionInfo, HServerAddress> regions = table.getRegionsInfo();
|
||||||
if(regions != null && regions.size() > 0) { %>
|
if(regions != null && regions.size() > 0) { %>
|
||||||
<%= tableHeader %>
|
<%= tableHeader %>
|
||||||
<% for(Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) { %>
|
<% for(Map.Entry<HRegionInfo, HServerAddress> hriEntry : regions.entrySet()) { %>
|
||||||
|
|
Loading…
Reference in New Issue