HDFS-5316. Merging change 1530150 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1530153 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2013-10-08 04:42:06 +00:00
parent c3dff760d9
commit 991faf598f
3 changed files with 20 additions and 11 deletions

View File

@ -107,6 +107,9 @@ Release 2.2.1 - UNRELEASED
HDFS-5317. Go back to DFS Home link does not work on datanode webUI HDFS-5317. Go back to DFS Home link does not work on datanode webUI
(Haohui Mai via brandonli) (Haohui Mai via brandonli)
HDFS-5316. Namenode ignores the default https port (Haohui Mai via
brandonli)
Release 2.2.0 - 2013-10-13 Release 2.2.0 - 2013-10-13
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -52,6 +52,7 @@ public class NameNodeHttpServer {
private final NameNode nn; private final NameNode nn;
private InetSocketAddress httpAddress; private InetSocketAddress httpAddress;
private InetSocketAddress httpsAddress;
private InetSocketAddress bindAddress; private InetSocketAddress bindAddress;
public static final String NAMENODE_ADDRESS_ATTRIBUTE_KEY = "name.node.address"; public static final String NAMENODE_ADDRESS_ATTRIBUTE_KEY = "name.node.address";
@ -99,14 +100,15 @@ public class NameNodeHttpServer {
boolean certSSL = conf.getBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY, false); boolean certSSL = conf.getBoolean(DFSConfigKeys.DFS_HTTPS_ENABLE_KEY, false);
if (certSSL) { if (certSSL) {
boolean needClientAuth = conf.getBoolean("dfs.https.need.client.auth", false); boolean needClientAuth = conf.getBoolean("dfs.https.need.client.auth", false);
InetSocketAddress secInfoSocAddr = NetUtils.createSocketAddr(infoHost + ":" + conf.get( httpsAddress = NetUtils.createSocketAddr(conf.get(
DFSConfigKeys.DFS_NAMENODE_HTTPS_PORT_KEY, "0")); DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY,
DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_DEFAULT));
Configuration sslConf = new Configuration(false); Configuration sslConf = new Configuration(false);
if (certSSL) { sslConf.addResource(conf.get(
sslConf.addResource(conf.get(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY, DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
"ssl-server.xml")); DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_DEFAULT));
} httpServer.addSslListener(httpsAddress, sslConf, needClientAuth);
httpServer.addSslListener(secInfoSocAddr, sslConf, needClientAuth);
// assume same ssl port for all datanodes // assume same ssl port for all datanodes
InetSocketAddress datanodeSslPort = NetUtils.createSocketAddr(conf.get( InetSocketAddress datanodeSslPort = NetUtils.createSocketAddr(conf.get(
DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 50475)); DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":" + 50475));
@ -163,6 +165,10 @@ public class NameNodeHttpServer {
return httpAddress; return httpAddress;
} }
public InetSocketAddress getHttpsAddress() {
return httpsAddress;
}
/** /**
* Sets fsimage for use by servlets. * Sets fsimage for use by servlets.
* *

View File

@ -31,9 +31,9 @@ public class TestNameNodeHttpServer {
System.setProperty("jetty.ssl.password", "foo"); System.setProperty("jetty.ssl.password", "foo");
System.setProperty("jetty.ssl.keypassword", "bar"); System.setProperty("jetty.ssl.keypassword", "bar");
MiniDFSCluster dfsCluster = new MiniDFSCluster.Builder(conf) MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0)
.numDataNodes(0).build(); .build();
dfsCluster.waitActive();
dfsCluster.shutdown(); cluster.shutdown();
} }
} }