|
@@ -712,9 +712,10 @@ public class DFSUtil {
|
|
* @param httpsAddress -If true, and if security is enabled, returns server
|
|
* @param httpsAddress -If true, and if security is enabled, returns server
|
|
* https address. If false, returns server http address.
|
|
* https address. If false, returns server http address.
|
|
* @return server http or https address
|
|
* @return server http or https address
|
|
|
|
+ * @throws IOException
|
|
*/
|
|
*/
|
|
- public static String getInfoServer(
|
|
|
|
- InetSocketAddress namenodeAddr, Configuration conf, boolean httpsAddress) {
|
|
|
|
|
|
+ public static String getInfoServer(InetSocketAddress namenodeAddr,
|
|
|
|
+ Configuration conf, boolean httpsAddress) throws IOException {
|
|
boolean securityOn = UserGroupInformation.isSecurityEnabled();
|
|
boolean securityOn = UserGroupInformation.isSecurityEnabled();
|
|
String httpAddressKey = (securityOn && httpsAddress) ?
|
|
String httpAddressKey = (securityOn && httpsAddress) ?
|
|
DFS_NAMENODE_HTTPS_ADDRESS_KEY : DFS_NAMENODE_HTTP_ADDRESS_KEY;
|
|
DFS_NAMENODE_HTTPS_ADDRESS_KEY : DFS_NAMENODE_HTTP_ADDRESS_KEY;
|
|
@@ -731,8 +732,14 @@ public class DFSUtil {
|
|
} else {
|
|
} else {
|
|
suffixes = new String[2];
|
|
suffixes = new String[2];
|
|
}
|
|
}
|
|
-
|
|
|
|
- return getSuffixedConf(conf, httpAddressKey, httpAddressDefault, suffixes);
|
|
|
|
|
|
+ String configuredInfoAddr = getSuffixedConf(conf, httpAddressKey,
|
|
|
|
+ httpAddressDefault, suffixes);
|
|
|
|
+ if (namenodeAddr != null) {
|
|
|
|
+ return substituteForWildcardAddress(configuredInfoAddr,
|
|
|
|
+ namenodeAddr.getHostName());
|
|
|
|
+ } else {
|
|
|
|
+ return configuredInfoAddr;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -757,7 +764,7 @@ public class DFSUtil {
|
|
if (UserGroupInformation.isSecurityEnabled() &&
|
|
if (UserGroupInformation.isSecurityEnabled() &&
|
|
defaultSockAddr.getAddress().isAnyLocalAddress()) {
|
|
defaultSockAddr.getAddress().isAnyLocalAddress()) {
|
|
throw new IOException("Cannot use a wildcard address with security. " +
|
|
throw new IOException("Cannot use a wildcard address with security. " +
|
|
- "Must explicitly set bind address for Kerberos");
|
|
|
|
|
|
+ "Must explicitly set bind address for Kerberos");
|
|
}
|
|
}
|
|
return defaultHost + ":" + sockAddr.getPort();
|
|
return defaultHost + ":" + sockAddr.getPort();
|
|
} else {
|
|
} else {
|