diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java index 1373f3cdc23..6d58040e557 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JobHistoryServer.java @@ -19,6 +19,7 @@ package org.apache.hadoop.mapreduce.v2.hs; import java.io.IOException; +import java.net.InetSocketAddress; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -169,8 +170,21 @@ public class JobHistoryServer extends CompositeService { } protected void doSecureLogin(Configuration conf) throws IOException { + InetSocketAddress socAddr = getBindAddress(conf); SecurityUtil.login(conf, JHAdminConfig.MR_HISTORY_KEYTAB, - JHAdminConfig.MR_HISTORY_PRINCIPAL); + JHAdminConfig.MR_HISTORY_PRINCIPAL, socAddr.getHostName()); + } + + /** + * Retrieve JHS bind address from configuration + * + * @param conf + * @return InetSocketAddress + */ + public static InetSocketAddress getBindAddress(Configuration conf) { + return conf.getSocketAddr(JHAdminConfig.MR_HISTORY_ADDRESS, + JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS, + JHAdminConfig.DEFAULT_MR_HISTORY_PORT); } @Override diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index eafc295bfa6..542b0454980 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -295,6 +295,10 @@ Release 2.4.0 - UNRELEASED YARN-1724. Race condition in Fair Scheduler when continuous scheduling is turned on (Sandy Ryza) + YARN-1590. Fixed ResourceManager, web-app proxy and MR JobHistoryServer to + expand _HOST properly in their kerberos principles. (Mohammad Kamrul Islam + va vinodkv) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java index 9612cac15e5..29f785ff3e7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java @@ -861,6 +861,9 @@ public class YarnConfiguration extends Configuration { /** The address for the web proxy.*/ public static final String PROXY_ADDRESS = PROXY_PREFIX + "address"; + public static final int DEFAULT_PROXY_PORT = 9099; + public static final String DEFAULT_PROXY_ADDRESS = + "0.0.0.0:" + DEFAULT_RM_PORT; /** * YARN Service Level Authorization diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java index 3aa11c55296..f9ed1bb6af4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java @@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.server.resourcemanager; import java.io.IOException; +import java.net.InetSocketAddress; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; @@ -894,8 +895,9 @@ public class ResourceManager extends CompositeService implements Recoverable { } protected void doSecureLogin() throws IOException { + InetSocketAddress socAddr = getBindAddress(conf); SecurityUtil.login(this.conf, YarnConfiguration.RM_KEYTAB, - YarnConfiguration.RM_PRINCIPAL); + YarnConfiguration.RM_PRINCIPAL, socAddr.getHostName()); } @Override @@ -1042,4 +1044,17 @@ public class ResourceManager extends CompositeService implements Recoverable { addIfService(rmDispatcher); rmContext.setDispatcher(rmDispatcher); } + + + /** + * Retrieve RM bind address from configuration + * + * @param conf + * @return InetSocketAddress + */ +public static InetSocketAddress getBindAddress(Configuration conf) { + return conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, + YarnConfiguration.DEFAULT_RM_ADDRESS, + YarnConfiguration.DEFAULT_RM_PORT); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServer.java index c8474a54ef3..d082bdceda9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServer.java @@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.server.webproxy; import java.io.IOException; +import java.net.InetSocketAddress; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -69,8 +70,21 @@ public class WebAppProxyServer extends CompositeService { * @throws IOException on any error. */ protected void doSecureLogin(Configuration conf) throws IOException { + InetSocketAddress socAddr = getBindAddress(conf); SecurityUtil.login(conf, YarnConfiguration.PROXY_KEYTAB, - YarnConfiguration.PROXY_PRINCIPAL); + YarnConfiguration.PROXY_PRINCIPAL, socAddr.getHostName()); + } + + /** + * Retrieve PROXY bind address from configuration + * + * @param conf + * @return InetSocketAddress + */ + public static InetSocketAddress getBindAddress(Configuration conf) { + return conf.getSocketAddr(YarnConfiguration.PROXY_ADDRESS, + YarnConfiguration.DEFAULT_PROXY_ADDRESS, + YarnConfiguration.DEFAULT_PROXY_PORT); } public static void main(String[] args) {