MAPREDUCE-3007. Fixed Yarn Mapreduce client to be able to connect to JobHistoryServer in secure mode. Contributed by Vinod Kumar Vavilapalli.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1171051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
be2b0921fa
commit
cb48bc1c93
@ -1327,6 +1327,9 @@ Release 0.23.0 - Unreleased
|
|||||||
MAPREDUCE-3005. Fix both FifoScheduler and CapacityScheduler to correctly
|
MAPREDUCE-3005. Fix both FifoScheduler and CapacityScheduler to correctly
|
||||||
enforce locality constraints. (acmurthy)
|
enforce locality constraints. (acmurthy)
|
||||||
|
|
||||||
|
MAPREDUCE-3007. Fixed Yarn Mapreduce client to be able to connect to
|
||||||
|
JobHistoryServer in secure mode. (vinodkv)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.apache.hadoop.mapred;
|
package org.apache.hadoop.mapred;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -28,12 +29,13 @@
|
|||||||
import org.apache.hadoop.mapreduce.JobID;
|
import org.apache.hadoop.mapreduce.JobID;
|
||||||
import org.apache.hadoop.mapreduce.v2.api.MRClientProtocol;
|
import org.apache.hadoop.mapreduce.v2.api.MRClientProtocol;
|
||||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
|
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
|
||||||
|
import org.apache.hadoop.mapreduce.v2.security.client.ClientHSSecurityInfo;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
import org.apache.hadoop.net.NetUtils;
|
||||||
import org.apache.hadoop.security.SecurityInfo;
|
import org.apache.hadoop.security.SecurityInfo;
|
||||||
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.yarn.YarnException;
|
import org.apache.hadoop.yarn.YarnException;
|
||||||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
import org.apache.hadoop.yarn.ipc.YarnRPC;
|
||||||
import org.apache.hadoop.yarn.security.client.ClientRMSecurityInfo;
|
|
||||||
|
|
||||||
public class ClientCache {
|
public class ClientCache {
|
||||||
|
|
||||||
@ -72,16 +74,21 @@ synchronized ClientServiceDelegate getClient(JobID jobId) {
|
|||||||
|
|
||||||
private MRClientProtocol instantiateHistoryProxy()
|
private MRClientProtocol instantiateHistoryProxy()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String serviceAddr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS,
|
final String serviceAddr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS,
|
||||||
JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS);
|
JHAdminConfig.DEFAULT_MR_HISTORY_ADDRESS);
|
||||||
LOG.info("Connecting to HistoryServer at: " + serviceAddr);
|
LOG.info("Connecting to HistoryServer at: " + serviceAddr);
|
||||||
Configuration myConf = new Configuration(conf);
|
final Configuration myConf = new Configuration(conf);
|
||||||
//TODO This should ideally be using it's own class (instead of ClientRMSecurityInfo)
|
|
||||||
myConf.setClass(YarnConfiguration.YARN_SECURITY_INFO,
|
myConf.setClass(YarnConfiguration.YARN_SECURITY_INFO,
|
||||||
ClientRMSecurityInfo.class, SecurityInfo.class);
|
ClientHSSecurityInfo.class, SecurityInfo.class);
|
||||||
YarnRPC rpc = YarnRPC.create(myConf);
|
final YarnRPC rpc = YarnRPC.create(myConf);
|
||||||
LOG.info("Connected to HistoryServer at: " + serviceAddr);
|
LOG.info("Connected to HistoryServer at: " + serviceAddr);
|
||||||
|
UserGroupInformation currentUser = UserGroupInformation.getCurrentUser();
|
||||||
|
return currentUser.doAs(new PrivilegedAction<MRClientProtocol>() {
|
||||||
|
@Override
|
||||||
|
public MRClientProtocol run() {
|
||||||
return (MRClientProtocol) rpc.getProxy(MRClientProtocol.class,
|
return (MRClientProtocol) rpc.getProxy(MRClientProtocol.class,
|
||||||
NetUtils.createSocketAddr(serviceAddr), myConf);
|
NetUtils.createSocketAddr(serviceAddr), myConf);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
org.apache.hadoop.mapreduce.v2.security.client.ClientHSSecurityInfo
|
Loading…
Reference in New Issue
Block a user