From 376a2439db9cd55ed1f2965cd876b811109990ba Mon Sep 17 00:00:00 2001 From: Junping Du Date: Tue, 29 Nov 2016 15:51:27 -0800 Subject: [PATCH] MAPREDUCE-6565. Configuration to use host name in delegation token service is not read from job.xml during MapReduce job execution. Contributed by Li Lu. (cherry picked from commit 8f6e14399a3e77e1bdcc5034f7601e9f62163dea) --- .../src/main/java/org/apache/hadoop/mapred/YarnChild.java | 2 ++ .../java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java index 164f19dc2f1..97642a5479f 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java @@ -78,6 +78,8 @@ public static void main(String[] args) throws Throwable { // Initing with our JobConf allows us to avoid loading confs twice Limits.init(job); UserGroupInformation.setConfiguration(job); + // MAPREDUCE-6565: need to set configuration for SecurityUtil. + SecurityUtil.setConfiguration(job); String host = args[0]; int port = Integer.parseInt(args[1]); diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java index ce1483c85d7..f64d0877e98 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/MRAppMaster.java @@ -121,6 +121,7 @@ import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.service.AbstractService; @@ -1654,6 +1655,8 @@ protected static void initAndStartAppMaster(final MRAppMaster appMaster, final JobConf conf, String jobUserName) throws IOException, InterruptedException { UserGroupInformation.setConfiguration(conf); + // MAPREDUCE-6565: need to set configuration for SecurityUtil. + SecurityUtil.setConfiguration(conf); // Security framework already loaded the tokens into current UGI, just use // them Credentials credentials =