本文整理了Java中org.apache.hadoop.hbase.client.Admin.stopRegionServer()
方法的一些代码示例,展示了Admin.stopRegionServer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.stopRegionServer()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:stopRegionServer
[英]Stop the designated regionserver
[中]停止指定的regionserver
代码示例来源:origin: apache/hbase
/**
* This tests to validate the RegionServer's ConnectorServer after unauthorised stopRegionServer
* call.
*/
@Test
public void testRSConnectorServerWhenStopRegionServer() throws Exception {
conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
JMXListener.class.getName() + "," + MyAccessController.class.getName());
conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
UTIL.startMiniCluster();
admin = UTIL.getConnection().getAdmin();
hasAccess = false;
ServerName serverName = UTIL.getHBaseCluster().getRegionServer(0).getServerName();
LOG.info("Stopping Region Server...");
admin.stopRegionServer(serverName.getHostname() + ":" + serverName.getPort());
// Check whether Region Sever JMX Connector server can be connected
JMXConnector connector = null;
try {
connector = JMXConnectorFactory
.connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
} catch (IOException e) {
if (e.getCause() instanceof ServiceUnavailableException) {
Assert.fail("Can't connect to Region Server ConnectorServer.");
}
}
Assert.assertNotNull("JMXConnector should not be null.", connector);
connector.close();
}
代码示例来源:origin: apache/hbase
@Test
public void testClearNotProcessedDeadServer() throws Exception {
LOG.info("testClearNotProcessedDeadServer");
NUM_DEAD_SERVERS = cluster.getClusterMetrics().getDeadServerNames().size();
RSGroupInfo appInfo = addGroup("deadServerGroup", 1);
ServerName targetServer = getServerName(appInfo.getServers().iterator().next());
try {
// stopping may cause an exception
// due to the connection loss
admin.stopRegionServer(targetServer.getAddress().toString());
NUM_DEAD_SERVERS++;
} catch (Exception e) {
}
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return cluster.getClusterMetrics().getDeadServerNames().size() == NUM_DEAD_SERVERS;
}
});
List<ServerName> notClearedServers = admin.clearDeadServers(Lists.newArrayList(targetServer));
assertEquals(1, notClearedServers.size());
}
代码示例来源:origin: apache/hbase
admin.stopRegionServer(targetServer.getAddress().toString());
NUM_DEAD_SERVERS++;
} catch (Exception e) {
代码示例来源:origin: apache/hbase
admin.stopRegionServer(targetServer.getAddress().toString());
NUM_DEAD_SERVERS++;
} catch (Exception e) {
代码示例来源:origin: apache/hbase
/**
* Test that a coprocessor is able to override a normal regionserver stop request.
*/
@Test
public void testStopOverrideFromCoprocessor() throws Exception {
Admin admin = testUtil.getHBaseAdmin();
HRegionServer regionserver = cluster.getRegionServer(0);
admin.stopRegionServer(regionserver.getServerName().getHostAndPort());
// regionserver should have failed to stop due to coprocessor
assertFalse(cluster.getRegionServer(0).isAborted());
assertFalse(cluster.getRegionServer(0).isStopped());
}
代码示例来源:origin: apache/hbase
admin.stopRegionServer(targetServer.getAddress().toString());
} catch (Exception e) {
代码示例来源:origin: org.apache.hbase/hbase-server
/**
* This tests to validate the RegionServer's ConnectorServer after unauthorised stopRegionServer
* call.
*/
@Test
public void testRSConnectorServerWhenStopRegionServer() throws Exception {
conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
JMXListener.class.getName() + "," + MyAccessController.class.getName());
conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
UTIL.startMiniCluster();
admin = UTIL.getConnection().getAdmin();
hasAccess = false;
ServerName serverName = UTIL.getHBaseCluster().getRegionServer(0).getServerName();
LOG.info("Stopping Region Server...");
admin.stopRegionServer(serverName.getHostname() + ":" + serverName.getPort());
// Check whether Region Sever JMX Connector server can be connected
JMXConnector connector = null;
try {
connector = JMXConnectorFactory
.connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
} catch (IOException e) {
if (e.getCause() instanceof ServiceUnavailableException) {
Assert.fail("Can't connect to Region Server ConnectorServer.");
}
}
Assert.assertNotNull("JMXConnector should not be null.", connector);
connector.close();
}
代码示例来源:origin: org.apache.hbase/hbase-server
/**
* Test that a coprocessor is able to override a normal regionserver stop request.
*/
@Test
public void testStopOverrideFromCoprocessor() throws Exception {
Admin admin = testUtil.getHBaseAdmin();
HRegionServer regionserver = cluster.getRegionServer(0);
admin.stopRegionServer(regionserver.getServerName().getHostAndPort());
// regionserver should have failed to stop due to coprocessor
assertFalse(cluster.getRegionServer(0).isAborted());
assertFalse(cluster.getRegionServer(0).isStopped());
}
内容来源于网络,如有侵权,请联系作者删除!