All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hbase-webapps.master.rsgroup.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta-1
Show newest version
<%--
/**
 * 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.ArrayList"
  import="java.util.Collections"
  import="java.util.Date"
  import="java.util.List"
  import="java.util.Map"
  import="java.util.regex.Pattern"
  import="java.util.stream.Stream"
  import="java.util.stream.Collectors"
  import="org.apache.hadoop.hbase.HTableDescriptor"
  import="org.apache.hadoop.hbase.RSGroupTableAccessor"
  import="org.apache.hadoop.hbase.ServerName"
  import="org.apache.hadoop.hbase.TableName"
  import="org.apache.hadoop.hbase.client.Admin"
  import="org.apache.hadoop.hbase.client.RegionInfo"
  import="org.apache.hadoop.hbase.client.TableState"
  import="org.apache.hadoop.hbase.client.TableDescriptor"
  import="org.apache.hadoop.hbase.master.HMaster"
  import="org.apache.hadoop.hbase.master.RegionState"
  import="org.apache.hadoop.hbase.net.Address"
  import="org.apache.hadoop.hbase.rsgroup.RSGroupInfo"
  import="org.apache.hadoop.hbase.util.Bytes"
  import="org.apache.hadoop.hbase.util.VersionInfo"
  import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix"%>
<%@ page import="org.apache.hadoop.hbase.ServerMetrics" %>
<%@ page import="org.apache.hadoop.hbase.Size" %>
<%@ page import="org.apache.hadoop.hbase.RegionMetrics" %>
<%
  String rsGroupName = request.getParameter("name");
  pageContext.setAttribute("pageTitle", "RSGroup: " + rsGroupName);
%>

    

<% HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); RSGroupInfo rsGroupInfo = null; final String ZEROKB = "0 KB"; final String ZEROMB = "0 MB"; if (!RSGroupTableAccessor.isRSGroupsEnabled(master.getConnection())) { %>
<% } else if (rsGroupName == null || rsGroupName.isEmpty() || (rsGroupInfo = RSGroupTableAccessor.getRSGroupInfo( master.getConnection(), Bytes.toBytes(rsGroupName))) == null) { %>
<% } else { List
rsGroupServers = new ArrayList<>(); List rsGroupTables = new ArrayList<>(); rsGroupServers.addAll(rsGroupInfo.getServers()); rsGroupTables.addAll(rsGroupInfo.getTables()); Collections.sort(rsGroupServers); rsGroupTables.sort((o1, o2) -> { int compare = Bytes.compareTo(o1.getNamespace(), o2.getNamespace()); if (compare != 0) return compare; compare = Bytes.compareTo(o1.getQualifier(), o2.getQualifier()); if (compare != 0) return compare; return 0; }); Map onlineServers = Collections.emptyMap(); Map serverMaping = Collections.emptyMap(); if (master.getServerManager() != null) { onlineServers = master.getServerManager().getOnlineServers().entrySet().stream() .collect(Collectors.toMap(p -> p.getKey().getAddress(), Map.Entry::getValue)); serverMaping = master.getServerManager().getOnlineServers().entrySet().stream() .collect(Collectors.toMap(p -> p.getKey().getAddress(), Map.Entry::getKey)); } %>

Region Servers

<% if (rsGroupServers != null && rsGroupServers.size() > 0) { %>
<% int totalRegions = 0; int totalRequestsPerSecond = 0; int inconsistentNodeNum = 0; String masterVersion = VersionInfo.getVersion(); for (Address server: rsGroupServers) { ServerName serverName = serverMaping.get(server); if (serverName != null) { ServerMetrics sl = onlineServers.get(server); String version = master.getRegionServerVersion(serverName); if (!masterVersion.equals(version)) { inconsistentNodeNum ++; } double requestsPerSecond = 0.0; int numRegionsOnline = 0; long lastContact = 0; if (sl != null) { requestsPerSecond = sl.getRequestCountPerSecond(); numRegionsOnline = sl.getRegionMetrics().size(); totalRegions += sl.getRegionMetrics().size(); totalRequestsPerSecond += sl.getRequestCountPerSecond(); lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000; } long startcode = serverName.getStartcode(); int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";%> <% } else { %> <% } %> <% } %> <%if (inconsistentNodeNum > 0) { %> <%} else { %> <%} %>
ServerName Start time Last contact Version Requests Per Second Num. Regions
<%= serverName.getServerName() %> <%= new Date(startcode) %> <%= lastContact %> <%= version %> <%= String.format("%.0f", requestsPerSecond) %> <%= numRegionsOnline %>
<%= server %> <%= "Dead" %>
Total:<%= rsGroupServers.size() %> <%= inconsistentNodeNum %> nodes with inconsistent version<%= totalRequestsPerSecond %> <%= totalRegions %>
<% for (Address server: rsGroupServers) { String usedHeapSizeMBStr = ZEROMB; String maxHeapSizeMBStr = ZEROMB; String memStoreSizeMBStr = ZEROMB; ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { double usedHeapSizeMB = sl.getUsedHeapSize().get(Size.Unit.MEGABYTE); double maxHeapSizeMB = sl.getMaxHeapSize().get(Size.Unit.MEGABYTE); double memStoreSizeMB = sl.getRegionMetrics().values() .stream().mapToDouble(rm -> rm.getMemStoreSize().get(Size.Unit.MEGABYTE)) .sum(); int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; if (memStoreSizeMB > 0) { memStoreSizeMBStr = TraditionalBinaryPrefix.long2String( (long) memStoreSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); } if (usedHeapSizeMB > 0) { usedHeapSizeMBStr = TraditionalBinaryPrefix.long2String( (long) usedHeapSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); } if (maxHeapSizeMB > 0) { maxHeapSizeMBStr = TraditionalBinaryPrefix.long2String( (long) maxHeapSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); } %> <% } else { %> <% } } %>
ServerName Used Heap Max Heap Memstore Size
<%= serverName.getServerName() %> <%= usedHeapSizeMBStr %> <%= maxHeapSizeMBStr %> <%= memStoreSizeMBStr %>
<%= server %>
<% for (Address server: rsGroupServers) { ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { int infoPort = master.getRegionServerInfoPort(serverName); long readRequestCount = 0; long writeRequestCount = 0; for (RegionMetrics rm : sl.getRegionMetrics().values()) { readRequestCount += rm.getReadRequestCount(); writeRequestCount += rm.getWriteRequestCount(); } String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; %> <% } else { %> <% } } %>
ServerName Request Per Second Read Request Count Write Request Count
<%= serverName.getServerName() %> <%= sl.getRequestCountPerSecond() %> <%= readRequestCount %> <%= writeRequestCount %>
<%= server %>
<% for (Address server: rsGroupServers) { String storeUncompressedSizeMBStr = ZEROMB; String storeFileSizeMBStr = ZEROMB; String totalStaticIndexSizeKBStr = ZEROKB; String totalStaticBloomSizeKBStr = ZEROKB; ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { long storeCount = 0; long storeFileCount = 0; double storeUncompressedSizeMB = 0; double storeFileSizeMB = 0; double totalStaticIndexSizeKB = 0; double totalStaticBloomSizeKB = 0; for (RegionMetrics rm : sl.getRegionMetrics().values()) { storeCount += rm.getStoreCount(); storeFileCount += rm.getStoreFileCount(); storeUncompressedSizeMB += rm.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE); storeFileSizeMB += rm.getStoreFileSize().get(Size.Unit.MEGABYTE); totalStaticIndexSizeKB += rm.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); totalStaticBloomSizeKB += rm.getBloomFilterSize().get(Size.Unit.KILOBYTE); } int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; if (storeUncompressedSizeMB > 0) { storeUncompressedSizeMBStr = TraditionalBinaryPrefix.long2String( (long) storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); } if (storeFileSizeMB > 0) { storeFileSizeMBStr = TraditionalBinaryPrefix.long2String( (long) storeFileSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1); } if (totalStaticIndexSizeKB > 0) { totalStaticIndexSizeKBStr = TraditionalBinaryPrefix.long2String( (long) totalStaticIndexSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); } if (totalStaticBloomSizeKB > 0) { totalStaticBloomSizeKBStr = TraditionalBinaryPrefix.long2String( (long) totalStaticBloomSizeKB * TraditionalBinaryPrefix.KILO.value, "B", 1); } %> <% } else { %> <% } } %>
ServerName Num. Stores Num. Storefiles Storefile Size Uncompressed Storefile Size Index Size Bloom Size
<%= serverName.getServerName() %> <%= storeCount %> <%= storeFileCount %> <%= storeUncompressedSizeMBStr %> <%= storeFileSizeMBStr %> <%= totalStaticIndexSizeKBStr %> <%= totalStaticBloomSizeKBStr %>
<%= server %>
<% for (Address server: rsGroupServers) { ServerName serverName = serverMaping.get(server); ServerMetrics sl = onlineServers.get(server); if (sl != null && serverName != null) { long totalCompactingCells = 0; long currentCompactedCells = 0; for (RegionMetrics rm : sl.getRegionMetrics().values()) { totalCompactingCells += rm.getCompactingCellCount(); currentCompactedCells += rm.getCompactedCellCount(); } String percentDone = ""; if (totalCompactingCells > 0) { percentDone = String.format("%.2f", 100 * ((float) currentCompactedCells / totalCompactingCells)) + "%"; } int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status"; %> <% } else { %> <% } } %>
ServerName Num. Compacting KVs Num. Compacted KVs Remaining KVs Compaction Progress
<%= serverName.getServerName() %> <%= totalCompactingCells %> <%= currentCompactedCells %> <%= totalCompactingCells - currentCompactedCells %> <%= percentDone %>
<%= server %>
<% } else { %>

No Region Servers

<% } %>

<% if (rsGroupTables != null && rsGroupTables.size() > 0) { HTableDescriptor[] tables = null; try (Admin admin = master.getConnection().getAdmin()) { tables = master.isInitialized() ? admin.listTables((Pattern)null, true) : null; } Map tableDescriptors = Stream.of(tables).collect(Collectors.toMap(TableDescriptor::getTableName, p -> p)); %> <% for(TableName tableName : rsGroupTables) { HTableDescriptor htDesc = tableDescriptors.get(tableName); if(htDesc == null) { %> <% } else { %> <% TableState tableState = master.getTableStateManager().getTableState(tableName); if(tableState.isDisabledOrDisabling()) { %> <% } else { %> <% } %> <% Map> tableRegions = master.getAssignmentManager().getRegionStates().getRegionByStateOfTable(tableName); int openRegionsCount = tableRegions.get(RegionState.State.OPEN).size(); int offlineRegionsCount = tableRegions.get(RegionState.State.OFFLINE).size(); int splitRegionsCount = tableRegions.get(RegionState.State.SPLIT).size(); int failedRegionsCount = tableRegions.get(RegionState.State.FAILED_OPEN).size() + tableRegions.get(RegionState.State.FAILED_CLOSE).size(); int otherRegionsCount = 0; for (List list: tableRegions.values()) { otherRegionsCount += list.size(); } // now subtract known states otherRegionsCount = otherRegionsCount - openRegionsCount - failedRegionsCount - offlineRegionsCount - splitRegionsCount; %> <% } } %>

<%= rsGroupTables.size() %> table(s) in set.

Namespace Table Stats Online Regions Offline Regions Failed Regions Split Regions Other Regions Description
<%= tableName.getNamespaceAsString() %> <%= tableName.getQualifierAsString() %> <%= "DELETED" %>
<%= tableName.getNamespaceAsString() %> <%= tableName.getQualifierAsString() %><%= tableState.getState().name() %><%= tableState.getState().name() %><%= openRegionsCount %> <%= offlineRegionsCount %> <%= failedRegionsCount %> <%= splitRegionsCount %> <%= otherRegionsCount %> <%= htDesc.toStringCustomizedValues() %>
<% } else { %>

No Tables

<% } %>
<% } %>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy