YARN-2859.addendum: fix the remaining issue from the previous patch

(cherry picked from commit f114e728da)
This commit is contained in:
Xuan 2015-11-19 10:07:16 -08:00
parent 5a3db21563
commit be65d319fa
2 changed files with 12 additions and 1 deletions

View File

@ -1928,6 +1928,9 @@ Release 2.6.2 - 2015-10-28
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

View File

@ -141,10 +141,14 @@ public class ApplicationHistoryServer extends CompositeService {
return this.ahsClientService; return this.ahsClientService;
} }
private InetSocketAddress getListenerAddress() {
return this.webApp.httpServer().getConnectorAddress(0);
}
@Private @Private
@VisibleForTesting @VisibleForTesting
public int getPort() { public int getPort() {
return this.webApp.httpServer().getConnectorAddress(0).getPort(); return this.getListenerAddress().getPort();
} }
/** /**
@ -331,6 +335,10 @@ public class ApplicationHistoryServer extends CompositeService {
httpServer.addContext(uiWebAppContext, true); httpServer.addContext(uiWebAppContext, true);
} }
httpServer.start(); httpServer.start();
conf.updateConnectAddr(YarnConfiguration.TIMELINE_SERVICE_BIND_HOST,
YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS,
this.getListenerAddress());
LOG.info("Instantiating AHSWebApp at " + getPort()); LOG.info("Instantiating AHSWebApp at " + getPort());
} catch (Exception e) { } catch (Exception e) {
String msg = "AHSWebApp failed to start."; String msg = "AHSWebApp failed to start.";