Skip to content

Commit

Permalink
YARN-2859. ApplicationHistoryServer binds to default port 8188 in
Browse files Browse the repository at this point in the history
MiniYARNCluster. Contributed by Vinod Kumar Vavilapalli
  • Loading branch information
xgong committed Oct 28, 2015
1 parent 19a77f5 commit 27414da
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Expand Up @@ -1897,6 +1897,9 @@ Release 2.6.2 - UNRELEASED
YARN-3798. ZKRMStateStore shouldn't create new session without occurrance of YARN-3798. ZKRMStateStore shouldn't create new session without occurrance of
SESSIONEXPIED. (ozawa and Varun Saxena) SESSIONEXPIED. (ozawa and Varun Saxena)


YARN-2859. ApplicationHistoryServer binds to default port 8188 in MiniYARNCluster.
(Vinod Kumar Vavilapalli via xgong)

Release 2.6.1 - 2015-09-23 Release 2.6.1 - 2015-09-23


INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES
Expand Down
Expand Up @@ -252,9 +252,9 @@ public void serviceInit(Configuration conf) throws Exception {
resourceManagers[i] = createResourceManager(); resourceManagers[i] = createResourceManager();
if (!useFixedPorts) { if (!useFixedPorts) {
if (HAUtil.isHAEnabled(conf)) { if (HAUtil.isHAEnabled(conf)) {
setHARMConfiguration(i, conf); setHARMConfigurationWithEphemeralPorts(i, conf);
} else { } else {
setNonHARMConfiguration(conf); setNonHARMConfigurationWithEphemeralPorts(conf);
} }
} }
addService(new ResourceManagerWrapper(i)); addService(new ResourceManagerWrapper(i));
Expand All @@ -274,7 +274,7 @@ public void serviceInit(Configuration conf) throws Exception {
conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf)); conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf));
} }


private void setNonHARMConfiguration(Configuration conf) { private void setNonHARMConfigurationWithEphemeralPorts(Configuration conf) {
String hostname = MiniYARNCluster.getHostname(); String hostname = MiniYARNCluster.getHostname();
conf.set(YarnConfiguration.RM_ADDRESS, hostname + ":0"); conf.set(YarnConfiguration.RM_ADDRESS, hostname + ":0");
conf.set(YarnConfiguration.RM_ADMIN_ADDRESS, hostname + ":0"); conf.set(YarnConfiguration.RM_ADMIN_ADDRESS, hostname + ":0");
Expand All @@ -283,7 +283,7 @@ private void setNonHARMConfiguration(Configuration conf) {
WebAppUtils.setRMWebAppHostnameAndPort(conf, hostname, 0); WebAppUtils.setRMWebAppHostnameAndPort(conf, hostname, 0);
} }


private void setHARMConfiguration(final int index, Configuration conf) { private void setHARMConfigurationWithEphemeralPorts(final int index, Configuration conf) {
String hostname = MiniYARNCluster.getHostname(); String hostname = MiniYARNCluster.getHostname();
for (String confKey : YarnConfiguration.getServiceAddressConfKeys(conf)) { for (String confKey : YarnConfiguration.getServiceAddressConfKeys(conf)) {
conf.set(HAUtil.addSuffix(confKey, rmIds[index]), hostname + ":0"); conf.set(HAUtil.addSuffix(confKey, rmIds[index]), hostname + ":0");
Expand Down Expand Up @@ -704,6 +704,12 @@ protected synchronized void serviceInit(Configuration conf)
MemoryTimelineStore.class, TimelineStore.class); MemoryTimelineStore.class, TimelineStore.class);
conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS,
MemoryTimelineStateStore.class, TimelineStateStore.class); MemoryTimelineStateStore.class, TimelineStateStore.class);
if (!useFixedPorts) {
String hostname = MiniYARNCluster.getHostname();
conf.set(YarnConfiguration.TIMELINE_SERVICE_ADDRESS, hostname + ":0");
conf.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, hostname
+ ":0");
}
appHistoryServer.init(conf); appHistoryServer.init(conf);
super.serviceInit(conf); super.serviceInit(conf);
} }
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.junit.Test; import org.junit.Test;


public class TestMiniYarnCluster { public class TestMiniYarnCluster {

@Test @Test
public void testTimelineServiceStartInMiniCluster() throws Exception { public void testTimelineServiceStartInMiniCluster() throws Exception {
Configuration conf = new YarnConfiguration(); Configuration conf = new YarnConfiguration();
Expand Down Expand Up @@ -68,6 +69,14 @@ public void testTimelineServiceStartInMiniCluster() throws Exception {
cluster = new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(), cluster = new MiniYARNCluster(TestMiniYarnCluster.class.getSimpleName(),
numNodeManagers, numLocalDirs, numLogDirs, numLogDirs, enableAHS); numNodeManagers, numLocalDirs, numLogDirs, numLogDirs, enableAHS);
cluster.init(conf); cluster.init(conf);

// Verify that the timeline-service starts on ephemeral ports by default
String hostname = MiniYARNCluster.getHostname();
Assert.assertEquals(hostname + ":0",
conf.get(YarnConfiguration.TIMELINE_SERVICE_ADDRESS));
Assert.assertEquals(hostname + ":0",
conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS));

cluster.start(); cluster.start();


//Timeline service may sometime take a while to get started //Timeline service may sometime take a while to get started
Expand Down

0 comments on commit 27414da

Please sign in to comment.