@Override public void reportServiceStatus(HAServiceStatus status) { verifyChangedServiceState(status.getState()); } }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("getServiceState: incorrect number of arguments"); printUsage(errOut, "-getServiceState"); return -1; } HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); out.println(proto.getServiceStatus().getState()); return 0; }
protected int getAllServiceState() { Collection<String> targetIds = getTargetIds(null); if (targetIds.isEmpty()) { errOut.println("Failed to get service IDs"); return -1; } for (String targetId : targetIds) { HAServiceTarget target = resolveTarget(targetId); String address = target.getAddress().getHostName() + ":" + target.getAddress().getPort(); try { HAServiceProtocol proto = target.getProxy(getConf(), rpcTimeoutForChecks); out.println(String.format("%-50s %-10s", address, proto .getServiceStatus().getState())); } catch (IOException e) { out.println(String.format("%-50s %-10s", address, "Failed to connect: " + e.getMessage())); } } return 0; }
if(proto.getServiceStatus().getState() == HAServiceState.ACTIVE) { errOut.println("transitionToActive: Node " + targetId +" is already active"); printUsage(errOut, "-transitionToActive");
if (!toSvcStatus.getState().equals(HAServiceState.STANDBY)) { throw new FailoverFailedException( "Can't failover to an active service");
switch (s.getState()) { case ACTIVE: retState = HAServiceStateProto.ACTIVE;
@Override public void reportServiceStatus(HAServiceStatus status) { verifyChangedServiceState(status.getState()); } }
@Override public void reportServiceStatus(HAServiceStatus status) { verifyChangedServiceState(status.getState()); } }
@Override public void reportServiceStatus(HAServiceStatus status) { verifyChangedServiceState(status.getState()); } }
@Override public void reportServiceStatus(HAServiceStatus status) { verifyChangedServiceState(status.getState()); } }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("getServiceState: incorrect number of arguments"); printUsage(errOut, "-getServiceState"); return -1; } HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); out.println(proto.getServiceStatus().getState()); return 0; }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("getServiceState: incorrect number of arguments"); printUsage(errOut, "-getServiceState"); return -1; } HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); out.println(proto.getServiceStatus().getState()); return 0; }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("getServiceState: incorrect number of arguments"); printUsage(errOut, "-getServiceState"); return -1; } HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); out.println(proto.getServiceStatus().getState()); return 0; }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("getServiceState: incorrect number of arguments"); printUsage(errOut, "-getServiceState"); return -1; } HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); out.println(proto.getServiceStatus().getState()); return 0; }
@Override public Boolean get() { try { return nn.getRpcServer().getServiceStatus().getState() == state; } catch (Exception e) { e.printStackTrace(); return false; } } }, 50, 15000);
private static HAServiceState getHAState(YarnConfiguration yarnConf) throws Exception { HAServiceTarget haServiceTarget; int rpcTimeoutForChecks = yarnConf.getInt(CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_KEY, CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_DEFAULT); yarnConf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY, yarnConf.get(YarnConfiguration.RM_PRINCIPAL, "")); haServiceTarget = new RMHAServiceTarget(yarnConf); HAServiceProtocol proto = haServiceTarget.getProxy(yarnConf, rpcTimeoutForChecks); HAServiceState haState = proto.getServiceStatus().getState(); return haState; }
private static HAServiceState getHAState(YarnConfiguration yarnConf) throws Exception { HAServiceTarget haServiceTarget; int rpcTimeoutForChecks = yarnConf.getInt(CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_KEY, CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_DEFAULT); yarnConf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY, yarnConf.get(YarnConfiguration.RM_PRINCIPAL, "")); haServiceTarget = new RMHAServiceTarget(yarnConf); HAServiceProtocol proto = haServiceTarget.getProxy(yarnConf, rpcTimeoutForChecks); HAServiceState haState = proto.getServiceStatus().getState(); return haState; }
@Override public Boolean get() { try { return rm.getAdminService().getServiceStatus().getState() .equals(state); } catch (IOException e) { } return false; } }, 2000, 15000);
private void checkStandbyRMFunctionality() throws IOException { assertEquals(STATE_ERR, HAServiceState.STANDBY, rm.adminService.getServiceStatus().getState()); assertFalse("Active RM services are started", rm.areActiveServicesRunning()); assertTrue("RM is not ready to become active", rm.adminService.getServiceStatus().isReadyToBecomeActive()); }
private void checkStandbyRMFunctionality() throws IOException { assertEquals(STATE_ERR, HAServiceState.STANDBY, rm.adminService.getServiceStatus().getState()); assertFalse("Active RM services are started", rm.areActiveServicesRunning()); assertTrue("RM is not ready to become active", rm.adminService.getServiceStatus().isReadyToBecomeActive()); }