HBASE-3949. Add "Master" link to RegionServer pages. Contributed by Gregory Chanan.
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1229035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dd604d3136
commit
8c2a573d48
|
@ -53,6 +53,7 @@ org.apache.hadoop.hbase.HBaseConfiguration;
|
|||
RegionServerMetrics metrics = regionServer.getMetrics();
|
||||
List<HRegionInfo> onlineRegions = regionServer.getOnlineRegions();
|
||||
int interval = regionServer.getConfiguration().getInt("hbase.regionserver.msginterval", 3000)/1000;
|
||||
int masterInfoPort = regionServer.getConfiguration().getInt("hbase.master.info.port", 60010);
|
||||
</%java>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Commenting out DOCTYPE so our blue outline shows on hadoop 0.20.205.0, etc.
|
||||
|
@ -95,9 +96,20 @@ org.apache.hadoop.hbase.HBaseConfiguration;
|
|||
<td>
|
||||
<% java.util.Arrays.toString(regionServer.getCoprocessors()) %>
|
||||
</td>
|
||||
<td>Coprocessors currently loaded by this regionserver</td>
|
||||
<td>Coprocessors currently loaded by this regionserver</td></tr>
|
||||
<tr><td>RS Start Time</td><td><% new Date(regionServer.getStartcode()) %></td><td>Date stamp of when this region server was started</td></tr>
|
||||
</tr>
|
||||
<tr><td>HBase Master</td><td>
|
||||
<%if (masterInfoPort < 0) %>
|
||||
No hbase.master.info.port found
|
||||
<%else>
|
||||
<%java>
|
||||
String host = regionServer.getMasterAddressManager().getMasterAddress().getHostname() + ":" + masterInfoPort;
|
||||
String url = "http://" + host + "/";
|
||||
</%java>
|
||||
<a href="<% url %>"><% host %></a>
|
||||
</%if>
|
||||
</td><td>Address of HBase Master</td></tr>
|
||||
</table>
|
||||
|
||||
<& ../common/TaskMonitorTmpl; filter = filter &>
|
||||
|
|
|
@ -1433,6 +1433,13 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
return this.metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Master address tracker instance.
|
||||
*/
|
||||
public MasterAddressTracker getMasterAddressManager() {
|
||||
return this.masterAddressManager;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start maintanence Threads, Server, Worker and lease checker threads.
|
||||
* Install an UncaughtExceptionHandler that calls abort of RegionServer if we
|
||||
|
|
|
@ -55,6 +55,8 @@ public class TestRSStatusServlet {
|
|||
new HServerInfo(fakeAddress, FAKE_WEB_PORT);
|
||||
private RegionServerMetrics metrics =
|
||||
new RegionServerMetrics();
|
||||
private ServerName fakeMasterAddress =
|
||||
new ServerName("localhost", 60010, 1212121212);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Before
|
||||
|
@ -69,6 +71,11 @@ public class TestRSStatusServlet {
|
|||
ZooKeeperWatcher zkw = Mockito.mock(ZooKeeperWatcher.class);
|
||||
Mockito.doReturn("fakequorum").when(zkw).getQuorum();
|
||||
Mockito.doReturn(zkw).when(rs).getZooKeeper();
|
||||
|
||||
// Fake MasterAddressTracker
|
||||
MasterAddressTracker mat = Mockito.mock(MasterAddressTracker.class);
|
||||
Mockito.doReturn(fakeMasterAddress).when(mat).getMasterAddress();
|
||||
Mockito.doReturn(mat).when(rs).getMasterAddressManager();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -85,7 +92,7 @@ public class TestRSStatusServlet {
|
|||
);
|
||||
Mockito.doReturn(regions).when(rs).getOnlineRegions();
|
||||
|
||||
new RSStatusTmpl().render(new StringWriter(), rs);
|
||||
new RSStatusTmpl().render(new StringWriter(), rs);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue