AMBARI-21327 Ambari server to print error messages if NN HA namenode services 
properties use diff FQDN (dual network cards) than FQDN in the 
HostComponentState table (dili)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f402505
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f402505
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f402505

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 2f402505060354e8c71d24879c47a3850cc04009
Parents: 40e6352
Author: Di Li <d...@apache.org>
Authored: Tue Jun 27 15:56:53 2017 -0400
Committer: Di Li <d...@apache.org>
Committed: Tue Jun 27 15:56:53 2017 -0400

----------------------------------------------------------------------
 .../apache/ambari/server/stack/MasterHostResolver.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f402505/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
index 427a5f5..fc657c1 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java
@@ -132,7 +132,7 @@ public class MasterHostResolver {
               return filterHosts(hostsType, serviceName, componentName);
             }
 
-            Map<Status, String> pair = getNameNodePair();
+            Map<Status, String> pair = getNameNodePair(componentHosts);
             if (pair != null) {
               hostsType.master = pair.containsKey(Status.ACTIVE) ? 
pair.get(Status.ACTIVE) :  null;
               hostsType.secondary = pair.containsKey(Status.STANDBY) ? 
pair.get(Status.STANDBY) :  null;
@@ -273,7 +273,7 @@ public class MasterHostResolver {
    * one active and one standby host were found, otherwise, return null.
    * The hostnames are returned in lowercase.
    */
-  private Map<Status, String> getNameNodePair() {
+  private Map<Status, String> getNameNodePair(Set<String> componentHosts) 
throws AmbariException {
     Map<Status, String> stateToHost = new HashMap<>();
     Cluster cluster = getCluster();
 
@@ -307,6 +307,13 @@ public class MasterHostResolver {
           throw new MalformedURLException("Could not parse host and port from 
" + value);
         }
 
+        if (!componentHosts.contains(hp.host)){
+          //This may happen when NN HA is configured on dual network card 
machines with public/private FQDNs.
+          LOG.error(
+              String.format(
+                  "Hadoop NameNode HA configuration {0} contains host {1} that 
does not exist in the NameNode hosts list {3}",
+                  key, hp.host, componentHosts.toString()));
+        }
         String state = queryJmxBeanValue(hp.host, hp.port, 
"Hadoop:service=NameNode,name=NameNodeStatus", "State", true, encrypted);
 
         if (null != state && (state.equalsIgnoreCase(Status.ACTIVE.toString()) 
|| state.equalsIgnoreCase(Status.STANDBY.toString()))) {

Reply via email to