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 8f6e14399a)
This commit is contained in:
Junping Du 2016-11-29 15:51:27 -08:00
parent c22ceb0a9b
commit 376a2439db
2 changed files with 5 additions and 0 deletions

View File

@ -78,6 +78,8 @@ class YarnChild {
// Initing with our JobConf allows us to avoid loading confs twice // Initing with our JobConf allows us to avoid loading confs twice
Limits.init(job); Limits.init(job);
UserGroupInformation.setConfiguration(job); UserGroupInformation.setConfiguration(job);
// MAPREDUCE-6565: need to set configuration for SecurityUtil.
SecurityUtil.setConfiguration(job);
String host = args[0]; String host = args[0];
int port = Integer.parseInt(args[1]); int port = Integer.parseInt(args[1]);

View File

@ -121,6 +121,7 @@ import org.apache.hadoop.mapreduce.v2.util.MRBuilderUtils;
import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil; import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.AbstractService;
@ -1654,6 +1655,8 @@ public class MRAppMaster extends CompositeService {
final JobConf conf, String jobUserName) throws IOException, final JobConf conf, String jobUserName) throws IOException,
InterruptedException { InterruptedException {
UserGroupInformation.setConfiguration(conf); 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 // Security framework already loaded the tokens into current UGI, just use
// them // them
Credentials credentials = Credentials credentials =