diff --git src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon new file mode 100644 index 0000000..4379ef5 --- /dev/null +++ src/main/jamon/org/apache/hadoop/hbase/tmpl/common/TaskMonitorTmpl.jamon @@ -0,0 +1,93 @@ +<%doc> +Copyright 2011 The Apache Software Foundation + +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. + +<%import> +java.util.*; +org.apache.hadoop.hbase.monitoring.*; +org.apache.hadoop.util.StringUtils; + +<%args> +TaskMonitor taskMonitor = TaskMonitor.get(); +String filter = "general"; +String format = "html"; + +<%java> +List tasks = taskMonitor.getTasks(); +Iterator iter = tasks.iterator(); +// apply requested filter +while (iter.hasNext()) { + MonitoredTask t = iter.next(); + if (filter.equals("general")) { + if (t instanceof MonitoredRPCHandler) + iter.remove(); + } else if (filter.equals("handler")) { + if (!(t instanceof MonitoredRPCHandler)) + iter.remove(); + } else if (filter.equals("rpc")) { + if (!(t instanceof MonitoredRPCHandler) || + !((MonitoredRPCHandler) t).isRPCRunning()) + iter.remove(); + } else if (filter.equals("operation")) { + if (!(t instanceof MonitoredRPCHandler) || + !((MonitoredRPCHandler) t).isOperationRunning()) + iter.remove(); + } +} +long now = System.currentTimeMillis(); +Collections.reverse(tasks); +boolean first = true; + +<%if format.equals("json")%> +[<%for MonitoredTask task : tasks%><%if first%><%java>first = false;<%else>,<% task.toJSON() %>] +<%else> +

Tasks

+
+ Show All Monitored Tasks + Show non-RPC Tasks + Show All RPC Handler Tasks + Show Active RPC Calls + Show Client Operations + View as JSON +
+ <%if tasks.isEmpty()%> + No tasks currently running on this node. + <%else> + + + + + + + + <%for MonitoredTask task : tasks %> + + + + + + + +
Start TimeDescriptionStateStatus
<% new Date(task.getStartTime()) %><% task.getDescription() %><% task.getState() %> + (since <% StringUtils.formatTimeDiff(now, task.getStateTime()) %> ago) + <% task.getStatus() %> + (since <% StringUtils.formatTimeDiff(now, task.getStatusTime()) %> + ago)
+ + + diff --git src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon new file mode 100644 index 0000000..0dc0691 --- /dev/null +++ src/main/jamon/org/apache/hadoop/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon @@ -0,0 +1,70 @@ +<%doc> +Copyright 2011 The Apache Software Foundation + +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. + +<%import> +org.apache.hadoop.hbase.HRegionInfo; +org.apache.hadoop.hbase.master.AssignmentManager; +org.apache.hadoop.hbase.master.AssignmentManager.RegionState; +java.util.Iterator; +java.util.Map; + +<%args> +AssignmentManager assignmentManager; +int limit = 100; + +<%java> +Map rit = assignmentManager.getRegionsInTransition(); + +int toRemove = rit.size() - limit; +int removed = 0; +if (toRemove > 0) { + // getRegionsInTransition returned a copy, so we can mutate it + for (Iterator> it = rit.entrySet().iterator(); + it.hasNext() && toRemove > 0; + ) { + Map.Entry e = it.next(); + if (HRegionInfo.FIRST_META_REGIONINFO.getEncodedName().equals( + e.getKey()) || + HRegionInfo.ROOT_REGIONINFO.getEncodedName().equals( + e.getKey())) { + // don't remove the meta regions, they're too interesting! + continue; + } + it.remove(); + toRemove--; + removed++; + } +} + + + +

Regions in Transition

+<%if rit.isEmpty() %> +No regions in transition. +<%else> + + + <%for Map.Entry entry : rit.entrySet() %> + + +
RegionState
<% entry.getKey() %><% entry.getValue().toDescriptiveString() %>
+ <%if removed > 0 %> + (<% removed %> more regions in transition not shown) + + \ No newline at end of file diff --git src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon new file mode 100644 index 0000000..69434f7 --- /dev/null +++ src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -0,0 +1,254 @@ +<%doc> +Copyright 2011 The Apache Software Foundation + +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. + +<%args> +HMaster master; +HBaseAdmin admin; +Map frags = null; +ServerName rootLocation = null; +ServerName metaLocation = null; +List servers = null; +Set deadServers = null; +boolean showAppendWarning = false; +String filter = "general"; +String format = "html"; + +<%import> +java.util.*; +org.apache.hadoop.util.StringUtils; +org.apache.hadoop.hbase.util.Bytes; +org.apache.hadoop.hbase.util.JvmVersion; +org.apache.hadoop.hbase.util.FSUtils; +org.apache.hadoop.hbase.master.HMaster; +org.apache.hadoop.hbase.HConstants; +org.apache.hadoop.hbase.HServerLoad; +org.apache.hadoop.hbase.ServerName; +org.apache.hadoop.hbase.client.HBaseAdmin; +org.apache.hadoop.hbase.client.HConnectionManager; +org.apache.hadoop.hbase.HTableDescriptor; +org.apache.hadoop.hbase.HBaseConfiguration; + +<%if format.equals("json") %> + <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &> + <%java return; %> + + + + + +HBase Master: <% master.getServerName() %> + + + + +

Master: <% master.getServerName().getHostname() %>:<% master.getServerName().getPort() %>

+ + + +<%if JvmVersion.isBadJvmVersion() %> +
+ Your current JVM version <% System.getProperty("java.version") %> is known to be + unstable with HBase. Please see the + HBase wiki + for details. +
+ +<%if showAppendWarning %> +
+ You are currently running the HMaster without HDFS append support enabled. + This may result in data loss. + Please see the HBase wiki + for details. +
+ + +
+

Attributes

+ + + + + + + + + +<%if frags != null %> + + + + + + + + + +
Attribute NameValueDescription
HBase Version<% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision
HBase Compiled<% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %>When HBase version was compiled and by whom
Hadoop Version<% org.apache.hadoop.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.util.VersionInfo.getRevision() %>Hadoop version and revision
Hadoop Compiled<% org.apache.hadoop.util.VersionInfo.getDate() %>, <% org.apache.hadoop.util.VersionInfo.getUser() %>When Hadoop version was compiled and by whom
HBase Root Directory<% FSUtils.getRootDir(master.getConfiguration()).toString() %>Location of HBase home directory
HBase Cluster ID<% master.getClusterId() != null ? master.getClusterId() : "Not set" %>Unique identifier generated for each HBase cluster
Load average<% StringUtils.limitDecimalTo2(master.getServerManager().getAverageLoad()) %>Average number of regions per regionserver. Naive computation.
Fragmentation<% frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a" %>Overall fragmentation of all tables, including .META. and -ROOT-.
Zookeeper Quorum<% master.getZooKeeperWatcher().getQuorum() %>Addresses of all registered ZK servers. For more, see zk dump.
+ Coprocessors<% java.util.Arrays.toString(master.getCoprocessors()) %> + Coprocessors currently loaded loaded by the master
HMaster Start Time<% new Date(master.getMasterStartTime()) %>Date stamp of when this HMaster was started
HMaster Active Time<% new Date(master.getMasterActiveTime()) %>Date stamp of when this HMaster became active
+ +<& ../common/TaskMonitorTmpl; filter = filter &> + +<%if (rootLocation != null) %> +<& catalogTables &> + +<%if (metaLocation != null) %> +<& userTables &> + +<%if (servers != null) %> +<& regionServers &> + +<%if (deadServers != null) %> +<& deadRegionServers &> + + +<& AssignmentManagerStatusTmpl; assignmentManager=master.getAssignmentManager()&> + + + + + +<%def catalogTables> +

Tables

+ + + + <%if (frags != null) %> + + + + + + + <%if (frags != null)%> + + + + + <%if (metaLocation != null) %> + + + <%if (frags != null)%> + + + + + + +
Catalog TableFrag.Description
<% Bytes.toString(HConstants.ROOT_TABLE_NAME) %><% frags.get("-ROOT-") != null ? frags.get("-ROOT-").intValue() + "%" : "n/a" %>The -ROOT- table holds references to all .META. regions.
<% Bytes.toString(HConstants.META_TABLE_NAME) %><% frags.get(".META.") != null ? frags.get(".META.").intValue() + "%" : "n/a" %>The .META. table holds references to all User Table regions
+ + +<%def userTables> +<%java> + HTableDescriptor[] tables = admin.listTables(); + HConnectionManager.deleteConnection(admin.getConfiguration(), false); + +<%if (tables != null && tables.length > 0)%> + + + +<%if (frags != null) %> + + + + +<%for HTableDescriptor htDesc : tables%> + + + <%if (frags != null) %> + + + + + + +

<% tables.length %> table(s) in set. [Details]

+
User TableFrag.Description
><% htDesc.getNameAsString() %> <% frags.get(htDesc.getNameAsString()) != null ? frags.get(htDesc.getNameAsString()).intValue() + "%" : "n/a" %><% htDesc.toStringCustomizedValues() %>
+ + + +<%def regionServers> +

Region Servers

+<%if (servers != null && servers.size() > 0)%> +<%java> + int totalRegions = 0; + int totalRequests = 0; + + + + +<%java> + ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]); + Arrays.sort(serverNames); + for (ServerName serverName: serverNames) { + // TODO: this is incorrect since this conf might differ from RS to RS + // or be set to 0 to get ephemeral ports + int infoPort = master.getConfiguration().getInt("hbase.regionserver.info.port", 60030); + String url = "http://" + serverName.getHostname() + ":" + infoPort + "/"; + HServerLoad hsl = master.getServerManager().getLoad(serverName); + String loadStr = hsl == null? "-": hsl.toString(); + if (hsl != null) { + totalRegions += hsl.getNumberOfRegions(); + totalRequests += hsl.getNumberOfRequests(); + } + long startcode = serverName.getStartcode(); + + +<%java> + } + + +
ServerNameStart timeLoad
<% serverName %><% new Date(startcode) %><% loadStr %>
Total: servers: <% servers.size() %>requestsPerSecond=<% totalRequests %>, numberOfOnlineRegions=<% totalRegions %>
+ +

Load is requests per second and count of regions loaded

+ + + +<%def deadRegionServers> +

Dead Region Servers

+<%if (deadServers != null && deadServers.size() > 0)%> + + + +<%java> + ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]); + Arrays.sort(deadServerNames); + for (ServerName deadServerName: deadServerNames) { + int infoPort = master.getConfiguration().getInt("hbase.regionserver.info.port", 60030); + + +<%java> + } + + +
ServerName
<% deadServerName %>
Total: servers: <% deadServers.size() %>
+ + diff --git src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon new file mode 100644 index 0000000..ae76204 --- /dev/null +++ src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon @@ -0,0 +1,150 @@ +<%doc> +Copyright 2011 The Apache Software Foundation + +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. + +<%args> +HRegionServer regionServer; +String filter = "general"; +String format = "html"; + +<%import> +java.util.*; +java.io.IOException; +org.apache.hadoop.io.Text; +org.apache.hadoop.hbase.regionserver.HRegionServer; +org.apache.hadoop.hbase.regionserver.HRegion; +org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics; +org.apache.hadoop.hbase.util.Bytes; +org.apache.hadoop.hbase.HConstants; +org.apache.hadoop.hbase.HServerInfo; +org.apache.hadoop.hbase.HServerLoad; +org.apache.hadoop.hbase.HRegionInfo; +org.apache.hadoop.hbase.ServerName; +org.apache.hadoop.hbase.HBaseConfiguration; + +<%if format.equals("json") %> + <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &> + <%java return; %> + +<%java> + HServerInfo serverInfo = null; + ServerName serverName = null; + try { + serverInfo = regionServer.getHServerInfo(); + serverName = regionServer.getServerName(); + } catch (IOException e) { + e.printStackTrace(); + } + RegionServerMetrics metrics = regionServer.getMetrics(); + List onlineRegions = regionServer.getOnlineRegions(); + int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval", 3000)/1000; + int masterInfoPort = regionServer.getConfiguration().getInt("hbase.master.info.port", 60010); + + + + + +HBase Region Server: <% serverName %>:<% serverInfo.getServerAddress().getPort() %> + + + + + +

RegionServer: <% serverName %>

+ +
+ +

Attributes

+ ++++ + + + + + + + + + + + +
Attribute NameValueDescription
HBase Version<% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision
HBase Compiled<% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %>When HBase version was compiled and by whom
Metrics<% metrics.toString() %>RegionServer Metrics; file and heap sizes are in megabytes
Zookeeper Quorum<% regionServer.getZooKeeper().getQuorum() %>Addresses of all registered ZK servers
Coprocessors + <% java.util.Arrays.toString(regionServer.getCoprocessors()) %> + Coprocessors currently loaded by this regionserver
RS Start Time<% new Date(regionServer.getStartcode()) %>Date stamp of when this region server was started
HBase Master +<%if (masterInfoPort < 0) %> +No hbase.master.info.port found +<%else> +<%java> +String host = regionServer.getMasterAddressManager().getMasterAddress().getHostname() + ":" + masterInfoPort; +String url = "http://" + host + "/"; + +<% host %> + +Address of HBase Master
+ +<& ../common/TaskMonitorTmpl; filter = filter &> + +

Regions

+<%if (onlineRegions != null && onlineRegions.size() > 0) %> + + +<%java> + Collections.sort(onlineRegions); + +<%for HRegionInfo r: onlineRegions %> +<%java> + HServerLoad.RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); + + + + + + +
Region NameStart KeyEnd KeyMetrics
<% r.getRegionNameAsString() %><% Bytes.toStringBinary(r.getStartKey()) %><% Bytes.toStringBinary(r.getEndKey()) %><% load == null? "null": load.toString() %>
+

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 +domains,apache.org,5464829424211263407 is party to the table +domains, has an id of 5464829424211263407 and the first key +in the region is apache.org. The -ROOT- +and .META. '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 +HBase Home for further explication.

+<%else> +

Not serving regions

+ + + diff --git src/main/jamon/org/apache/hbase/tmpl/common/TaskMonitorTmpl.jamon src/main/jamon/org/apache/hbase/tmpl/common/TaskMonitorTmpl.jamon deleted file mode 100644 index 4379ef5..0000000 --- src/main/jamon/org/apache/hbase/tmpl/common/TaskMonitorTmpl.jamon +++ /dev/null @@ -1,93 +0,0 @@ -<%doc> -Copyright 2011 The Apache Software Foundation - -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. - -<%import> -java.util.*; -org.apache.hadoop.hbase.monitoring.*; -org.apache.hadoop.util.StringUtils; - -<%args> -TaskMonitor taskMonitor = TaskMonitor.get(); -String filter = "general"; -String format = "html"; - -<%java> -List tasks = taskMonitor.getTasks(); -Iterator iter = tasks.iterator(); -// apply requested filter -while (iter.hasNext()) { - MonitoredTask t = iter.next(); - if (filter.equals("general")) { - if (t instanceof MonitoredRPCHandler) - iter.remove(); - } else if (filter.equals("handler")) { - if (!(t instanceof MonitoredRPCHandler)) - iter.remove(); - } else if (filter.equals("rpc")) { - if (!(t instanceof MonitoredRPCHandler) || - !((MonitoredRPCHandler) t).isRPCRunning()) - iter.remove(); - } else if (filter.equals("operation")) { - if (!(t instanceof MonitoredRPCHandler) || - !((MonitoredRPCHandler) t).isOperationRunning()) - iter.remove(); - } -} -long now = System.currentTimeMillis(); -Collections.reverse(tasks); -boolean first = true; - -<%if format.equals("json")%> -[<%for MonitoredTask task : tasks%><%if first%><%java>first = false;<%else>,<% task.toJSON() %>] -<%else> -

Tasks

- - <%if tasks.isEmpty()%> - No tasks currently running on this node. - <%else> - - - - - - - - <%for MonitoredTask task : tasks %> - - - - - - - -
Start TimeDescriptionStateStatus
<% new Date(task.getStartTime()) %><% task.getDescription() %><% task.getState() %> - (since <% StringUtils.formatTimeDiff(now, task.getStateTime()) %> ago) - <% task.getStatus() %> - (since <% StringUtils.formatTimeDiff(now, task.getStatusTime()) %> - ago)
- - - diff --git src/main/jamon/org/apache/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon src/main/jamon/org/apache/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon deleted file mode 100644 index 0dc0691..0000000 --- src/main/jamon/org/apache/hbase/tmpl/master/AssignmentManagerStatusTmpl.jamon +++ /dev/null @@ -1,70 +0,0 @@ -<%doc> -Copyright 2011 The Apache Software Foundation - -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. - -<%import> -org.apache.hadoop.hbase.HRegionInfo; -org.apache.hadoop.hbase.master.AssignmentManager; -org.apache.hadoop.hbase.master.AssignmentManager.RegionState; -java.util.Iterator; -java.util.Map; - -<%args> -AssignmentManager assignmentManager; -int limit = 100; - -<%java> -Map rit = assignmentManager.getRegionsInTransition(); - -int toRemove = rit.size() - limit; -int removed = 0; -if (toRemove > 0) { - // getRegionsInTransition returned a copy, so we can mutate it - for (Iterator> it = rit.entrySet().iterator(); - it.hasNext() && toRemove > 0; - ) { - Map.Entry e = it.next(); - if (HRegionInfo.FIRST_META_REGIONINFO.getEncodedName().equals( - e.getKey()) || - HRegionInfo.ROOT_REGIONINFO.getEncodedName().equals( - e.getKey())) { - // don't remove the meta regions, they're too interesting! - continue; - } - it.remove(); - toRemove--; - removed++; - } -} - - - -

Regions in Transition

-<%if rit.isEmpty() %> -No regions in transition. -<%else> - - - <%for Map.Entry entry : rit.entrySet() %> - - -
RegionState
<% entry.getKey() %><% entry.getValue().toDescriptiveString() %>
- <%if removed > 0 %> - (<% removed %> more regions in transition not shown) - - \ No newline at end of file diff --git src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon deleted file mode 100644 index 69434f7..0000000 --- src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon +++ /dev/null @@ -1,254 +0,0 @@ -<%doc> -Copyright 2011 The Apache Software Foundation - -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. - -<%args> -HMaster master; -HBaseAdmin admin; -Map frags = null; -ServerName rootLocation = null; -ServerName metaLocation = null; -List servers = null; -Set deadServers = null; -boolean showAppendWarning = false; -String filter = "general"; -String format = "html"; - -<%import> -java.util.*; -org.apache.hadoop.util.StringUtils; -org.apache.hadoop.hbase.util.Bytes; -org.apache.hadoop.hbase.util.JvmVersion; -org.apache.hadoop.hbase.util.FSUtils; -org.apache.hadoop.hbase.master.HMaster; -org.apache.hadoop.hbase.HConstants; -org.apache.hadoop.hbase.HServerLoad; -org.apache.hadoop.hbase.ServerName; -org.apache.hadoop.hbase.client.HBaseAdmin; -org.apache.hadoop.hbase.client.HConnectionManager; -org.apache.hadoop.hbase.HTableDescriptor; -org.apache.hadoop.hbase.HBaseConfiguration; - -<%if format.equals("json") %> - <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &> - <%java return; %> - - - - - -HBase Master: <% master.getServerName() %> - - - - -

Master: <% master.getServerName().getHostname() %>:<% master.getServerName().getPort() %>

- - - -<%if JvmVersion.isBadJvmVersion() %> -
- Your current JVM version <% System.getProperty("java.version") %> is known to be - unstable with HBase. Please see the - HBase wiki - for details. -
- -<%if showAppendWarning %> -
- You are currently running the HMaster without HDFS append support enabled. - This may result in data loss. - Please see the HBase wiki - for details. -
- - -
-

Attributes

- - - - - - - - - -<%if frags != null %> - - - - - - - - - -
Attribute NameValueDescription
HBase Version<% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision
HBase Compiled<% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %>When HBase version was compiled and by whom
Hadoop Version<% org.apache.hadoop.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.util.VersionInfo.getRevision() %>Hadoop version and revision
Hadoop Compiled<% org.apache.hadoop.util.VersionInfo.getDate() %>, <% org.apache.hadoop.util.VersionInfo.getUser() %>When Hadoop version was compiled and by whom
HBase Root Directory<% FSUtils.getRootDir(master.getConfiguration()).toString() %>Location of HBase home directory
HBase Cluster ID<% master.getClusterId() != null ? master.getClusterId() : "Not set" %>Unique identifier generated for each HBase cluster
Load average<% StringUtils.limitDecimalTo2(master.getServerManager().getAverageLoad()) %>Average number of regions per regionserver. Naive computation.
Fragmentation<% frags.get("-TOTAL-") != null ? frags.get("-TOTAL-").intValue() + "%" : "n/a" %>Overall fragmentation of all tables, including .META. and -ROOT-.
Zookeeper Quorum<% master.getZooKeeperWatcher().getQuorum() %>Addresses of all registered ZK servers. For more, see zk dump.
- Coprocessors<% java.util.Arrays.toString(master.getCoprocessors()) %> - Coprocessors currently loaded loaded by the master
HMaster Start Time<% new Date(master.getMasterStartTime()) %>Date stamp of when this HMaster was started
HMaster Active Time<% new Date(master.getMasterActiveTime()) %>Date stamp of when this HMaster became active
- -<& ../common/TaskMonitorTmpl; filter = filter &> - -<%if (rootLocation != null) %> -<& catalogTables &> - -<%if (metaLocation != null) %> -<& userTables &> - -<%if (servers != null) %> -<& regionServers &> - -<%if (deadServers != null) %> -<& deadRegionServers &> - - -<& AssignmentManagerStatusTmpl; assignmentManager=master.getAssignmentManager()&> - - - - - -<%def catalogTables> -

Tables

- - - - <%if (frags != null) %> - - - - - - - <%if (frags != null)%> - - - - - <%if (metaLocation != null) %> - - - <%if (frags != null)%> - - - - - - -
Catalog TableFrag.Description
<% Bytes.toString(HConstants.ROOT_TABLE_NAME) %><% frags.get("-ROOT-") != null ? frags.get("-ROOT-").intValue() + "%" : "n/a" %>The -ROOT- table holds references to all .META. regions.
<% Bytes.toString(HConstants.META_TABLE_NAME) %><% frags.get(".META.") != null ? frags.get(".META.").intValue() + "%" : "n/a" %>The .META. table holds references to all User Table regions
- - -<%def userTables> -<%java> - HTableDescriptor[] tables = admin.listTables(); - HConnectionManager.deleteConnection(admin.getConfiguration(), false); - -<%if (tables != null && tables.length > 0)%> - - - -<%if (frags != null) %> - - - - -<%for HTableDescriptor htDesc : tables%> - - - <%if (frags != null) %> - - - - - - -

<% tables.length %> table(s) in set. [Details]

-
User TableFrag.Description
><% htDesc.getNameAsString() %> <% frags.get(htDesc.getNameAsString()) != null ? frags.get(htDesc.getNameAsString()).intValue() + "%" : "n/a" %><% htDesc.toStringCustomizedValues() %>
- - - -<%def regionServers> -

Region Servers

-<%if (servers != null && servers.size() > 0)%> -<%java> - int totalRegions = 0; - int totalRequests = 0; - - - - -<%java> - ServerName [] serverNames = servers.toArray(new ServerName[servers.size()]); - Arrays.sort(serverNames); - for (ServerName serverName: serverNames) { - // TODO: this is incorrect since this conf might differ from RS to RS - // or be set to 0 to get ephemeral ports - int infoPort = master.getConfiguration().getInt("hbase.regionserver.info.port", 60030); - String url = "http://" + serverName.getHostname() + ":" + infoPort + "/"; - HServerLoad hsl = master.getServerManager().getLoad(serverName); - String loadStr = hsl == null? "-": hsl.toString(); - if (hsl != null) { - totalRegions += hsl.getNumberOfRegions(); - totalRequests += hsl.getNumberOfRequests(); - } - long startcode = serverName.getStartcode(); - - -<%java> - } - - -
ServerNameStart timeLoad
<% serverName %><% new Date(startcode) %><% loadStr %>
Total: servers: <% servers.size() %>requestsPerSecond=<% totalRequests %>, numberOfOnlineRegions=<% totalRegions %>
- -

Load is requests per second and count of regions loaded

- - - -<%def deadRegionServers> -

Dead Region Servers

-<%if (deadServers != null && deadServers.size() > 0)%> - - - -<%java> - ServerName [] deadServerNames = deadServers.toArray(new ServerName[deadServers.size()]); - Arrays.sort(deadServerNames); - for (ServerName deadServerName: deadServerNames) { - int infoPort = master.getConfiguration().getInt("hbase.regionserver.info.port", 60030); - - -<%java> - } - - -
ServerName
<% deadServerName %>
Total: servers: <% deadServers.size() %>
- - diff --git src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon deleted file mode 100644 index ae76204..0000000 --- src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon +++ /dev/null @@ -1,150 +0,0 @@ -<%doc> -Copyright 2011 The Apache Software Foundation - -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. - -<%args> -HRegionServer regionServer; -String filter = "general"; -String format = "html"; - -<%import> -java.util.*; -java.io.IOException; -org.apache.hadoop.io.Text; -org.apache.hadoop.hbase.regionserver.HRegionServer; -org.apache.hadoop.hbase.regionserver.HRegion; -org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics; -org.apache.hadoop.hbase.util.Bytes; -org.apache.hadoop.hbase.HConstants; -org.apache.hadoop.hbase.HServerInfo; -org.apache.hadoop.hbase.HServerLoad; -org.apache.hadoop.hbase.HRegionInfo; -org.apache.hadoop.hbase.ServerName; -org.apache.hadoop.hbase.HBaseConfiguration; - -<%if format.equals("json") %> - <& ../common/TaskMonitorTmpl; filter = filter; format = "json" &> - <%java return; %> - -<%java> - HServerInfo serverInfo = null; - ServerName serverName = null; - try { - serverInfo = regionServer.getHServerInfo(); - serverName = regionServer.getServerName(); - } catch (IOException e) { - e.printStackTrace(); - } - RegionServerMetrics metrics = regionServer.getMetrics(); - List onlineRegions = regionServer.getOnlineRegions(); - int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval", 3000)/1000; - int masterInfoPort = regionServer.getConfiguration().getInt("hbase.master.info.port", 60010); - - - - - -HBase Region Server: <% serverName %>:<% serverInfo.getServerAddress().getPort() %> - - - - - -

RegionServer: <% serverName %>

- -
- -

Attributes

- ---- - - - - - - - - - - - -
Attribute NameValueDescription
HBase Version<% org.apache.hadoop.hbase.util.VersionInfo.getVersion() %>, r<% org.apache.hadoop.hbase.util.VersionInfo.getRevision() %>HBase version and revision
HBase Compiled<% org.apache.hadoop.hbase.util.VersionInfo.getDate() %>, <% org.apache.hadoop.hbase.util.VersionInfo.getUser() %>When HBase version was compiled and by whom
Metrics<% metrics.toString() %>RegionServer Metrics; file and heap sizes are in megabytes
Zookeeper Quorum<% regionServer.getZooKeeper().getQuorum() %>Addresses of all registered ZK servers
Coprocessors - <% java.util.Arrays.toString(regionServer.getCoprocessors()) %> - Coprocessors currently loaded by this regionserver
RS Start Time<% new Date(regionServer.getStartcode()) %>Date stamp of when this region server was started
HBase Master -<%if (masterInfoPort < 0) %> -No hbase.master.info.port found -<%else> -<%java> -String host = regionServer.getMasterAddressManager().getMasterAddress().getHostname() + ":" + masterInfoPort; -String url = "http://" + host + "/"; - -<% host %> - -Address of HBase Master
- -<& ../common/TaskMonitorTmpl; filter = filter &> - -

Regions

-<%if (onlineRegions != null && onlineRegions.size() > 0) %> - - -<%java> - Collections.sort(onlineRegions); - -<%for HRegionInfo r: onlineRegions %> -<%java> - HServerLoad.RegionLoad load = regionServer.createRegionLoad(r.getEncodedName()); - - - - - - -
Region NameStart KeyEnd KeyMetrics
<% r.getRegionNameAsString() %><% Bytes.toStringBinary(r.getStartKey()) %><% Bytes.toStringBinary(r.getEndKey()) %><% load == null? "null": load.toString() %>
-

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 -domains,apache.org,5464829424211263407 is party to the table -domains, has an id of 5464829424211263407 and the first key -in the region is apache.org. The -ROOT- -and .META. '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 -HBase Home for further explication.

-<%else> -

Not serving regions

- - - diff --git src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java index ef3e28b..862db2e 100644 --- src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java +++ src/main/java/org/apache/hadoop/hbase/master/MasterStatusServlet.java @@ -35,7 +35,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.FSUtils; -import org.apache.hbase.tmpl.master.MasterStatusTmpl; +import org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl; /** * The servlet responsible for rendering the index page of the diff --git src/main/java/org/apache/hadoop/hbase/regionserver/RSStatusServlet.java src/main/java/org/apache/hadoop/hbase/regionserver/RSStatusServlet.java index 0f1fd04..7521cd4 100644 --- src/main/java/org/apache/hadoop/hbase/regionserver/RSStatusServlet.java +++ src/main/java/org/apache/hadoop/hbase/regionserver/RSStatusServlet.java @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.hbase.tmpl.regionserver.RSStatusTmpl; +import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl; public class RSStatusServlet extends HttpServlet { private static final long serialVersionUID = 1L; diff --git src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java index 30ae515..be5dea5 100644 --- src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java +++ src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java @@ -36,11 +36,10 @@ import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.master.AssignmentManager.RegionState; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.ServerManager; -import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; -import org.apache.hbase.tmpl.master.AssignmentManagerStatusTmpl; -import org.apache.hbase.tmpl.master.MasterStatusTmpl; +import org.apache.hadoop.hbase.tmpl.master.AssignmentManagerStatusTmpl; +import org.apache.hadoop.hbase.tmpl.master.MasterStatusTmpl; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; diff --git src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java index 9f5e769..8478260 100644 --- src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java +++ src/test/java/org/apache/hadoop/hbase/regionserver/TestRSStatusServlet.java @@ -19,17 +19,22 @@ */ package org.apache.hadoop.hbase.regionserver; -import static org.junit.Assert.*; - import java.io.IOException; import java.io.StringWriter; import java.util.List; -import org.apache.hadoop.hbase.*; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HRegionInfo; +import org.apache.hadoop.hbase.HServerAddress; +import org.apache.hadoop.hbase.HServerInfo; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.MasterAddressTracker; +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.SmallTests; import org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics; +import org.apache.hadoop.hbase.tmpl.regionserver.RSStatusTmpl; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; -import org.apache.hbase.tmpl.regionserver.RSStatusTmpl; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -48,14 +53,14 @@ public class TestRSStatusServlet { static final int FAKE_WEB_PORT = 1586; @SuppressWarnings("deprecation") - private HServerAddress fakeAddress = + private final HServerAddress fakeAddress = new HServerAddress("localhost", FAKE_IPC_PORT); @SuppressWarnings("deprecation") - private HServerInfo fakeInfo = + private final HServerInfo fakeInfo = new HServerInfo(fakeAddress, FAKE_WEB_PORT); - private RegionServerMetrics metrics = + private final RegionServerMetrics metrics = new RegionServerMetrics(); - private ServerName fakeMasterAddress = + private final ServerName fakeMasterAddress = new ServerName("localhost", 60010, 1212121212); @SuppressWarnings("deprecation")