HBASE-13534 Changed Master UI to promptly display if it is a backup master. (Apekshit)
Signed-off-by: Elliott Clark <eclark@apache.org>
This commit is contained in:
parent
bcb2a279c4
commit
031dd3638c
|
@ -27,32 +27,23 @@ org.apache.hadoop.hbase.master.HMaster;
|
||||||
org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
|
org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
|
||||||
</%import>
|
</%import>
|
||||||
<%java>
|
<%java>
|
||||||
Collection<ServerName> masters = null;
|
|
||||||
MasterAddressTracker masterAddressTracker = master.getMasterAddressTracker();
|
MasterAddressTracker masterAddressTracker = master.getMasterAddressTracker();
|
||||||
if (master.isActiveMaster()) {
|
|
||||||
ClusterStatus status = master.getClusterStatus();
|
|
||||||
masters = status.getBackupMasters();
|
|
||||||
} else{
|
|
||||||
ServerName sn = masterAddressTracker == null ? null
|
|
||||||
: masterAddressTracker.getMasterAddress();
|
|
||||||
assert sn != null : "Failed to retreive master's ServerName!";
|
|
||||||
masters = Collections.singletonList(sn);
|
|
||||||
}
|
|
||||||
</%java>
|
</%java>
|
||||||
|
|
||||||
<%java>
|
|
||||||
ServerName [] serverNames = masters.toArray(new ServerName[masters.size()]);
|
|
||||||
int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMasterInfoPort();
|
|
||||||
</%java>
|
|
||||||
<%if (!master.isActiveMaster()) %>
|
<%if (!master.isActiveMaster()) %>
|
||||||
<%if serverNames[0] != null %>
|
<%java>
|
||||||
<h2>Master</h2>
|
ServerName active_master =
|
||||||
<a href="//<% serverNames[0].getHostname() %>:<%
|
(masterAddressTracker == null) ? null : masterAddressTracker.getMasterAddress();
|
||||||
infoPort %>/master-status" target="_blank"><%
|
assert active_master != null : "Failed to retrieve master's ServerName!";
|
||||||
serverNames[0].getHostname() %></a>
|
int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker.getMasterInfoPort();
|
||||||
<%else>
|
</%java>
|
||||||
Unable to parse master hostname.
|
<div class="row inner_header">
|
||||||
</%if>
|
<div class="page-header">
|
||||||
|
<h1>Backup Master <small><% master.getServerName().getHostname() %></small></h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h4>Current Active Master: <a href="//<% active_master.getHostname() %>:<% infoPort %>/master-status"
|
||||||
|
target="_blank"><% active_master.getHostname() %></a><h4>
|
||||||
<%else>
|
<%else>
|
||||||
<h2>Backup Masters</h2>
|
<h2>Backup Masters</h2>
|
||||||
|
|
||||||
|
@ -63,14 +54,16 @@ int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMaster
|
||||||
<th>Start Time</th>
|
<th>Start Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
<%java>
|
<%java>
|
||||||
Arrays.sort(serverNames);
|
Collection<ServerName> backup_masters = master.getClusterStatus().getBackupMasters();
|
||||||
for (ServerName serverName : serverNames) {
|
ServerName [] backupServerNames = backup_masters.toArray(new ServerName[backup_masters.size()]);
|
||||||
infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getBackupMasterInfoPort(serverName);
|
Arrays.sort(backupServerNames);
|
||||||
|
for (ServerName serverName : backupServerNames) {
|
||||||
|
int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker
|
||||||
|
.getBackupMasterInfoPort(serverName);
|
||||||
</%java>
|
</%java>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="//<% serverName.getHostname() %>:<%
|
<td><a href="//<% serverName.getHostname() %>:<% infoPort %>/master-status"
|
||||||
infoPort %>/master-status" target="_blank"><%
|
target="_blank"><% serverName.getHostname() %></a>
|
||||||
serverName.getHostname() %></a>
|
|
||||||
</td>
|
</td>
|
||||||
<td><% serverName.getPort() %></td>
|
<td><% serverName.getPort() %></td>
|
||||||
<td><% new Date(serverName.getStartcode()) %></td>
|
<td><% new Date(serverName.getStartcode()) %></td>
|
||||||
|
@ -78,6 +71,6 @@ int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMaster
|
||||||
<%java>
|
<%java>
|
||||||
}
|
}
|
||||||
</%java>
|
</%java>
|
||||||
<tr><td>Total:<% (masters != null) ? masters.size() : 0 %></td>
|
<tr><td>Total:<% backupServerNames.length %></td>
|
||||||
</table>
|
</table>
|
||||||
</%if>
|
</%if>
|
||||||
|
|
|
@ -97,7 +97,8 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Master: <% master.getServerName().getHostname() %></title>
|
<title><%if master.isActiveMaster() %>Master: <%else>Backup Master: </%if>
|
||||||
|
<% master.getServerName().getHostname() %></title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
Loading…
Reference in New Issue