HDFS-3284. bootstrapStandby fails in secure cluster. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1326813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d370ef2ba
commit
574f99bd6b
|
@ -522,6 +522,8 @@ Release 2.0.0 - UNRELEASED
|
||||||
HDFS-3268. FileContext API mishandles token service and incompatible with
|
HDFS-3268. FileContext API mishandles token service and incompatible with
|
||||||
HA (Daryn Sharp via todd)
|
HA (Daryn Sharp via todd)
|
||||||
|
|
||||||
|
HDFS-3284. bootstrapStandby fails in secure cluster (todd)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-1623 SUBTASKS
|
BREAKDOWN OF HDFS-1623 SUBTASKS
|
||||||
|
|
||||||
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd)
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
||||||
import org.apache.hadoop.hdfs.server.namenode.TransferFsImage;
|
import org.apache.hadoop.hdfs.server.namenode.TransferFsImage;
|
||||||
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
|
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
|
||||||
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
|
||||||
|
import org.apache.hadoop.hdfs.tools.DFSHAAdmin;
|
||||||
import org.apache.hadoop.hdfs.tools.NNHAServiceTarget;
|
import org.apache.hadoop.hdfs.tools.NNHAServiceTarget;
|
||||||
import org.apache.hadoop.io.IOUtils;
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.io.MD5Hash;
|
import org.apache.hadoop.io.MD5Hash;
|
||||||
|
@ -144,8 +145,8 @@ public class BootstrapStandby implements Tool, Configurable {
|
||||||
|
|
||||||
private HAServiceProtocol createHAProtocolProxy()
|
private HAServiceProtocol createHAProtocolProxy()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new NNHAServiceTarget(new HdfsConfiguration(conf),
|
return new NNHAServiceTarget(new HdfsConfiguration(conf), nsId, otherNNId)
|
||||||
nsId, otherNNId).getProxy(conf, 15000);
|
.getProxy(conf, 15000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int doRun() throws IOException {
|
private int doRun() throws IOException {
|
||||||
|
@ -334,7 +335,7 @@ public class BootstrapStandby implements Tool, Configurable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setConf(Configuration conf) {
|
public void setConf(Configuration conf) {
|
||||||
this.conf = conf;
|
this.conf = DFSHAAdmin.addSecurityConfiguration(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,6 +46,18 @@ public class DFSHAAdmin extends HAAdmin {
|
||||||
@Override
|
@Override
|
||||||
public void setConf(Configuration conf) {
|
public void setConf(Configuration conf) {
|
||||||
if (conf != null) {
|
if (conf != null) {
|
||||||
|
conf = addSecurityConfiguration(conf);
|
||||||
|
}
|
||||||
|
super.setConf(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the requisite security principal settings to the given Configuration,
|
||||||
|
* returning a copy.
|
||||||
|
* @param conf the original config
|
||||||
|
* @return a copy with the security settings added
|
||||||
|
*/
|
||||||
|
public static Configuration addSecurityConfiguration(Configuration conf) {
|
||||||
// Make a copy so we don't mutate it. Also use an HdfsConfiguration to
|
// Make a copy so we don't mutate it. Also use an HdfsConfiguration to
|
||||||
// force loading of hdfs-site.xml.
|
// force loading of hdfs-site.xml.
|
||||||
conf = new HdfsConfiguration(conf);
|
conf = new HdfsConfiguration(conf);
|
||||||
|
@ -57,8 +69,7 @@ public class DFSHAAdmin extends HAAdmin {
|
||||||
|
|
||||||
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
||||||
nameNodePrincipal);
|
nameNodePrincipal);
|
||||||
}
|
return conf;
|
||||||
super.setConf(conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue