private synchronized boolean isRMActive() { return HAServiceState.ACTIVE == rmContext.getHAServiceState(); }
private synchronized boolean isRMActive() { return HAServiceState.ACTIVE == rmContext.getHAServiceState(); }
private synchronized boolean isRMActive() { return HAServiceState.ACTIVE == rm.getRMContext().getHAServiceState(); }
public void checkIfStandbyRM() { standby = (rm.getRMContext().getHAServiceState() == HAServiceState.STANDBY); }
public void checkIfStandbyRM() { standby = (rm.getRMContext().getHAServiceState() == HAServiceState.STANDBY); }
public void checkIfStandbyRM() { standby = (rm.getRMContext().getHAServiceState() == HAServiceState.STANDBY); }
@Override protected boolean isActive() { ResourceManager rm = (ResourceManager) getServletContext().getAttribute(RM_ATTRIBUTE); RMContext rmContext = rm.getRMContext(); HAServiceProtocol.HAServiceState state = rmContext.getHAServiceState(); return state == HAServiceProtocol.HAServiceState.ACTIVE; } }
@Override public synchronized HAServiceStatus getServiceStatus() throws IOException { checkAccess("getServiceState"); HAServiceState haState = rmContext.getHAServiceState(); HAServiceStatus ret = new HAServiceStatus(haState); if (isRMActive() || haState == HAServiceProtocol.HAServiceState.STANDBY) { ret.setReadyToBecomeActive(); } else { ret.setNotReadyToBecomeActive("State is " + haState); } return ret; }
@Override public synchronized HAServiceStatus getServiceStatus() throws IOException { checkAccess("getServiceState"); HAServiceState haState = rmContext.getHAServiceState(); HAServiceStatus ret = new HAServiceStatus(haState); if (isRMActive() || haState == HAServiceProtocol.HAServiceState.STANDBY) { ret.setReadyToBecomeActive(); } else { ret.setNotReadyToBecomeActive("State is " + haState); } return ret; }
protected void explicitFailover() throws IOException { rm1.adminService.transitionToStandby(requestInfo); rm2.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); }
protected void explicitFailover() throws IOException { rm1.adminService.transitionToStandby(requestInfo); rm2.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); }
/** * Return the HA status of this RM. This includes the current state and * whether the RM is ready to become active. * * @return {@link HAServiceStatus} of the current RM * @throws IOException if the caller does not have permissions */ @Override public synchronized HAServiceStatus getServiceStatus() throws IOException { checkAccess("getServiceState"); HAServiceState haState = rm.getRMContext().getHAServiceState(); HAServiceStatus ret = new HAServiceStatus(haState); if (isRMActive() || haState == HAServiceProtocol.HAServiceState.STANDBY) { ret.setReadyToBecomeActive(); } else { ret.setNotReadyToBecomeActive("State is " + haState); } return ret; }
public ClusterInfo(ResourceManager rm) { long ts = ResourceManager.getClusterTimeStamp(); this.id = ts; this.state = rm.getServiceState(); this.haState = rm.getRMContext().getHAServiceState(); this.rmStateStoreName = rm.getRMContext().getStateStore().getClass() .getName(); this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.getVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate(); this.hadoopVersion = VersionInfo.getVersion(); this.hadoopBuildVersion = VersionInfo.getBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.getDate(); this.haZooKeeperConnectionState = rm.getRMContext().getHAZookeeperConnectionState(); }
protected void startRMs(MockRM rm1, Configuration confForRM1, MockRM rm2, Configuration confForRM2) throws IOException { rm1.init(confForRM1); rm1.start(); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); rm2.init(confForRM2); rm2.start(); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.STANDBY); rm1.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); } }
protected void startRMs(MockRM rm1, Configuration confForRM1, MockRM rm2, Configuration confForRM2) throws IOException { rm1.init(confForRM1); rm1.start(); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.STANDBY); rm2.init(confForRM2); rm2.start(); Assert.assertTrue(rm2.getRMContext().getHAServiceState() == HAServiceState.STANDBY); rm1.adminService.transitionToActive(requestInfo); Assert.assertTrue(rm1.getRMContext().getHAServiceState() == HAServiceState.ACTIVE); } }
public ClusterInfo(ResourceManager rm) { long ts = ResourceManager.getClusterTimeStamp(); this.id = ts; this.state = rm.getServiceState(); this.haState = rm.getRMContext().getHAServiceState(); this.rmStateStoreName = rm.getRMContext().getStateStore().getClass() .getName(); this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.getVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate(); this.hadoopVersion = VersionInfo.getVersion(); this.hadoopBuildVersion = VersionInfo.getBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.getDate(); this.haZooKeeperConnectionState = rm.getRMContext().getRMAdminService().getHAZookeeperConnectionState(); }
public ClusterInfo(ResourceManager rm) { long ts = ResourceManager.getClusterTimeStamp(); this.id = ts; this.state = rm.getServiceState(); this.haState = rm.getRMContext().getHAServiceState(); this.rmStateStoreName = rm.getRMContext().getStateStore().getClass() .getName(); this.startedOn = ts; this.resourceManagerVersion = YarnVersionInfo.getVersion(); this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion(); this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate(); this.hadoopVersion = VersionInfo.getVersion(); this.hadoopBuildVersion = VersionInfo.getBuildVersion(); this.hadoopVersionBuiltOn = VersionInfo.getDate(); this.haZooKeeperConnectionState = rm.getRMContext().getRMAdminService().getHAZookeeperConnectionState(); }
private void explicitFailover(MockRM rm) throws IOException { rm.getAdminService().transitionToStandby(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.STANDBY); rm.getAdminService().transitionToActive(requestInfo); Assert.assertTrue(rm.getRMContext() .getHAServiceState() == HAServiceProtocol.HAServiceState.ACTIVE); lastHearbeatTS = 0; stateStore = rm.getFederationStateStoreService().getStateStoreClient(); }
@Test public void testSecureRMBecomeActive() throws IOException, YarnException { StateChangeRequestInfo requestInfo = new StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER); updateConfigurationForRMHA(); configuration.setBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, true); configuration.set(YarnConfiguration.RM_HA_ID, "rm1"); // upload default configurations uploadDefaultConfiguration(); ResourceManager resourceManager = new ResourceManager(); try { resourceManager.init(configuration); resourceManager.start(); Assert.assertTrue(resourceManager.getRMContext().getHAServiceState() == HAServiceState.STANDBY); resourceManager.adminService.transitionToActive(requestInfo); } finally { resourceManager.close(); } }
@Test public void testSecureRMBecomeActive() throws IOException, YarnException { StateChangeRequestInfo requestInfo = new StateChangeRequestInfo( HAServiceProtocol.RequestSource.REQUEST_BY_USER); updateConfigurationForRMHA(); configuration.setBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, true); configuration.set(YarnConfiguration.RM_HA_ID, "rm1"); // upload default configurations uploadDefaultConfiguration(); ResourceManager resourceManager = new ResourceManager(); try { resourceManager.init(configuration); resourceManager.start(); Assert.assertTrue(resourceManager.getRMContext().getHAServiceState() == HAServiceState.STANDBY); resourceManager.adminService.transitionToActive(requestInfo); } finally { resourceManager.close(); } }