From f5960f71d9dcdc237f08e41bf1ebfbd572ca83af Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Thu, 10 May 2012 13:49:06 +0000 Subject: [PATCH] HDFS-3395. NN doesn't start with HA+security enabled and HTTP address set to 0.0.0.0. Contributed by Aaron T. Myers. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1336690 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/hadoop/net/NetUtils.java | 4 ++-- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/hdfs/DFSUtil.java | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java index b3c77c20336..ac48a08da72 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java @@ -140,7 +140,7 @@ public class NetUtils { /** * Util method to build socket addr from either: - * : + * : * ://:/ */ public static InetSocketAddress createSocketAddr(String target) { @@ -150,7 +150,7 @@ public class NetUtils { /** * Util method to build socket addr from either: * - * : + * : * ://:/ */ public static InetSocketAddress createSocketAddr(String target, diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 39ce0d7f4e8..b867df14a89 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -631,6 +631,9 @@ Release 2.0.0 - UNRELEASED HDFS-3396. FUSE build fails on Ubuntu 12.04. (Colin Patrick McCabe via eli) + HDFS-3395. NN doesn't start with HA+security enabled and HTTP address + set to 0.0.0.0. (atm) + BREAKDOWN OF HDFS-1623 SUBTASKS HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java index 9e244a25315..dccc4e2ee0b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java @@ -714,8 +714,11 @@ public class DFSUtil { public static String substituteForWildcardAddress(String configuredAddress, String defaultHost) throws IOException { InetSocketAddress sockAddr = NetUtils.createSocketAddr(configuredAddress); + InetSocketAddress defaultSockAddr = NetUtils.createSocketAddr(defaultHost + + ":0"); if (sockAddr.getAddress().isAnyLocalAddress()) { - if(UserGroupInformation.isSecurityEnabled()) { + if (UserGroupInformation.isSecurityEnabled() && + defaultSockAddr.getAddress().isAnyLocalAddress()) { throw new IOException("Cannot use a wildcard address with security. " + "Must explicitly set bind address for Kerberos"); }