/** * @param infoServer that we're trying to send all requests to * @param hostname may be null. if given, will be used for redirects instead of host from client. */ public RedirectServlet(InfoServer infoServer, String hostname) { regionServerInfoPort = infoServer.getPort(); regionServerHostname = hostname; }
return -1; if(infoPort == infoServer.getPort()) { return infoPort;
port = this.infoServer.getPort(); conf.setInt(HConstants.REGIONSERVER_INFO_PORT, port); int masterInfoPort = conf.getInt(HConstants.MASTER_INFO_PORT,
/** * Get some information of the region server. * * @param controller the RPC controller * @param request the request * @throws ServiceException */ @Override @QosPriority(priority=HConstants.ADMIN_QOS) public GetServerInfoResponse getServerInfo(final RpcController controller, final GetServerInfoRequest request) throws ServiceException { try { checkOpen(); } catch (IOException ie) { throw new ServiceException(ie); } requestCount.increment(); int infoPort = regionServer.infoServer != null ? regionServer.infoServer.getPort() : -1; return ResponseConverter.buildGetServerInfoResponse(regionServer.serverName, infoPort); }
@Test public void testMasterServerReadOnly() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); byte[] cf = Bytes.toBytes("d"); UTIL.createTable(tableName, cf); UTIL.waitTableAvailable(tableName); int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertDoesNotContainContent(new URL("http://localhost:" + port + "/table.jsp?name=" + tableName + "&action=split&key="), "Table action request accepted"); assertDoesNotContainContent( new URL("http://localhost:" + port + "/table.jsp?name=" + tableName), "Actions:"); }
/** * Test that the status pages in the minicluster load properly. * * This is somewhat a duplicate of TestRSStatusServlet and * TestMasterStatusServlet, but those are true unit tests * whereas this uses a cluster. */ @Test public void testInfoServersStatusPages() throws Exception { int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/master-status"), "meta"); port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer() .getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/rs-status"), "meta"); }
builder.setMasterInfoPort(infoServer.getPort());
private void createMyEphemeralNode() throws KeeperException, IOException { RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder(); rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1); rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo()); byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray()); ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper, getMyEphemeralNodePath(), data); }
@Test public void testGetMasterInfoPort() throws Exception { assertEquals(TEST_UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), (int) admin .getMasterInfoPort().get()); }
/** * Ensure when we go to top level index pages that we get redirected to an info-server specific status * page. */ @Test public void testInfoServersRedirect() throws Exception { // give the cluster time to start up UTIL.getConnection().getTable(TableName.META_TABLE_NAME).close(); int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/index.html"), "master-status"); port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer() .getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/index.html"), "rs-status"); }
@Test public void testGetMasterInfoPort() throws Exception { try (Admin admin = UTIL.getAdmin()) { assertEquals(UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), admin.getMasterInfoPort()); } }
cluster.getMaster().getRpcServer().getListenerAddress().getPort()); assertEquals("Master info port is incorrect", masterInfoPort, cluster.getMaster().getInfoServer().getPort()); assertEquals("RS RPC port is incorrect", rsPort, cluster.getRegionServer(0).getRpcServer().getListenerAddress().getPort()); assertEquals("RS info port is incorrect", rsInfoPort, cluster.getRegionServer(0).getInfoServer().getPort()); } catch (BindException e) { LOG.info("Failed to bind, need to retry", e);
serverLoad.setReportEndTime(reportEndTime); if (this.infoServer != null) { serverLoad.setInfoServerPort(this.infoServer.getPort()); } else { serverLoad.setInfoServerPort(-1);
/** * Get some information of the region server. * * @param controller the RPC controller * @param request the request * @throws ServiceException */ @Override @QosPriority(priority=HConstants.ADMIN_QOS) public GetServerInfoResponse getServerInfo(final RpcController controller, final GetServerInfoRequest request) throws ServiceException { try { checkOpen(); } catch (IOException ie) { throw new ServiceException(ie); } requestCount.increment(); int infoPort = regionServer.infoServer != null ? regionServer.infoServer.getPort() : -1; return ResponseConverter.buildGetServerInfoResponse(regionServer.serverName, infoPort); }
@Test public void testMasterServerReadOnly() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); byte[] cf = Bytes.toBytes("d"); UTIL.createTable(tableName, cf); UTIL.waitTableAvailable(tableName); int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertDoesNotContainContent(new URL("http://localhost:" + port + "/table.jsp?name=" + tableName + "&action=split&key="), "Table action request accepted"); assertDoesNotContainContent( new URL("http://localhost:" + port + "/table.jsp?name=" + tableName), "Actions:"); }
/** * Test that the status pages in the minicluster load properly. * * This is somewhat a duplicate of TestRSStatusServlet and * TestMasterStatusServlet, but those are true unit tests * whereas this uses a cluster. */ @Test public void testInfoServersStatusPages() throws Exception { int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/master-status"), "meta"); port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer() .getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/rs-status"), "meta"); }
private void createMyEphemeralNode() throws KeeperException, IOException { RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder(); rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1); rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo()); byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray()); ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper, getMyEphemeralNodePath(), data); }
/** * Ensure when we go to top level index pages that we get redirected to an info-server specific status * page. */ @Test public void testInfoServersRedirect() throws Exception { // give the cluster time to start up UTIL.getConnection().getTable(TableName.META_TABLE_NAME).close(); int port = UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/index.html"), "master-status"); port = UTIL.getHBaseCluster().getRegionServerThreads().get(0).getRegionServer() .getInfoServer().getPort(); assertContainsContent(new URL("http://localhost:" + port + "/index.html"), "rs-status"); }
@Test public void testGetMasterInfoPort() throws Exception { assertEquals(TEST_UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), (int) admin .getMasterInfoPort().get()); }
@Test public void testGetMasterInfoPort() throws Exception { try (Admin admin = UTIL.getAdmin()) { assertEquals(UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), admin.getMasterInfoPort()); } }