diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 0ed0fe3429..f3a5debfcd 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -747,6 +747,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3709. TestDistributedShell is failing. (Hitesh Shah via mahadev) + + MAPREDUCE-3436. JobHistory webapp address should use the host configured + in the jobhistory address. (Ahmed Radwan via sseth) Release 0.23.0 - 2011-11-01 diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java index 711dd18118..c1da2fe6a9 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/v2/jobhistory/JobHistoryUtils.java @@ -24,6 +24,7 @@ import java.net.InetSocketAddress; import java.net.UnknownHostException; import java.util.Calendar; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; @@ -46,6 +47,9 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.api.records.ApplicationId; +import com.google.common.base.Joiner; +import com.google.common.base.Splitter; + public class JobHistoryUtils { /** @@ -110,6 +114,9 @@ public class JobHistoryUtils { public static final Pattern TIMESTAMP_DIR_PATTERN = Pattern.compile(TIMESTAMP_DIR_REGEX); private static final String TIMESTAMP_DIR_FORMAT = "%04d" + File.separator + "%02d" + File.separator + "%02d"; + private static final Splitter ADDR_SPLITTER = Splitter.on(':').trimResults(); + private static final Joiner JOINER = Joiner.on(""); + private static final PathFilter CONF_FILTER = new PathFilter() { @Override public boolean accept(Path path) { @@ -478,8 +485,16 @@ private static Path[] filteredStat2Paths(List stats, boolean dirs, public static String getHistoryUrl(Configuration conf, ApplicationId appId) throws UnknownHostException { //construct the history url for job - String hsAddress = conf.get(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS, + String addr = conf.get(JHAdminConfig.MR_HISTORY_WEBAPP_ADDRESS, JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS); + Iterator it = ADDR_SPLITTER.split(addr).iterator(); + it.next(); // ignore the bind host + String port = it.next(); + // Use hs address to figure out the host for webapp + addr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS, + JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS); + String host = ADDR_SPLITTER.split(addr).iterator().next(); + String hsAddress = JOINER.join(host, ":", port); InetSocketAddress address = NetUtils.createSocketAddr( hsAddress, JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_PORT, JHAdminConfig.DEFAULT_MR_HISTORY_WEBAPP_ADDRESS); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml index 80406132a4..f6fc57ba0f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml @@ -1262,4 +1262,18 @@ to the RM to fetch Application Status. + + + + mapreduce.jobhistory.address + 0.0.0.0:10020 + MapReduce JobHistory Server host:port + + + + mapreduce.jobhistory.webapp.address + 0.0.0.0:19888 + MapReduce JobHistory Server Web UI host:port + +