Browse Source

AMBARI-14621: Blueprint deploy should update the value localhost for HAWQMASTER and HAWQSTANDBY (bhuvnesh2703 via jaoki)

Jun Aoki 9 years ago
parent
commit
c0e2269247

+ 6 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java

@@ -2120,6 +2120,7 @@ public class BlueprintConfigurationProcessor {
     Map<String, PropertyUpdater> multiRangerKmsSiteMap = new HashMap<String, PropertyUpdater>();
     Map<String, PropertyUpdater> dbHiveSiteMap = new HashMap<String, PropertyUpdater>();
     Map<String, PropertyUpdater> rangerAdminPropsMap = new HashMap<String, PropertyUpdater>();
+    Map<String, PropertyUpdater> hawqSiteMap = new HashMap<String, PropertyUpdater>();
 
 
 
@@ -2138,6 +2139,7 @@ public class BlueprintConfigurationProcessor {
     singleHostTopologyUpdaters.put("kafka-broker", kafkaBrokerMap);
     singleHostTopologyUpdaters.put("application-properties", atlasPropsMap);
     singleHostTopologyUpdaters.put("admin-properties", rangerAdminPropsMap);
+    singleHostTopologyUpdaters.put("hawq-site", hawqSiteMap);
 
 
     mPropertyUpdaters.put("hadoop-env", hadoopEnvMap);
@@ -2401,6 +2403,10 @@ public class BlueprintConfigurationProcessor {
     hbaseEnvMap.put("hbase_regionserver_heapsize", new MPropertyUpdater());
     oozieEnvHeapSizeMap.put("oozie_heapsize", new MPropertyUpdater());
     oozieEnvHeapSizeMap.put("oozie_permsize", new MPropertyUpdater());
+
+    hawqSiteMap.put("hawq_master_address_host", new SingleHostTopologyUpdater("HAWQMASTER"));
+    hawqSiteMap.put("hawq_standby_address_host", new SingleHostTopologyUpdater("HAWQSTANDBY"));
+    hawqSiteMap.put("hawq_dfs_url", new SingleHostTopologyUpdater("NAMENODE"));
   }
 
   /**

+ 1 - 3
ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py

@@ -213,9 +213,7 @@ def start_master():
   __check_dfs_truncate_enforced()
 
   is_active_master = __is_active_master()
-  # Exchange ssh keys from active hawq master before starting.
-  if is_active_master:
-    __setup_passwordless_ssh()
+  __setup_passwordless_ssh()
 
   if __is_local_initialized():
     __start_local_master()

+ 48 - 0
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java

@@ -6324,6 +6324,54 @@ public class BlueprintConfigurationProcessorTest {
     assertEquals("host1:100,host2:200", updatedValue);
   }
 
+  @Test
+  public void testHawqConfigClusterUpdate() throws Exception {
+    final String expectedHostNameHawqMaster = "c6401.apache.ambari.org";
+    final String expectedHostNameHawqStandby = "c6402.apache.ambari.org";
+    final String expectedHostNameNamenode = "c6403.apache.ambari.org";
+    final String expectedPortNamenode = "8020";
+
+    Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+    Map<String, String> hawqSite = new HashMap<String, String>();
+    properties.put("hawq-site", hawqSite);
+
+    // setup properties that include host information
+    hawqSite.put("hawq_master_address_host", "localhost");
+    hawqSite.put("hawq_standby_address_host", "localhost");
+    hawqSite.put("hawq_dfs_url", createHostAddress("localhost", expectedPortNamenode) + "/hawq_default");
+
+    Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap());
+
+    //Host group which has NAMENODE
+    Collection<String> hgComponents = new HashSet<String>();
+    hgComponents.add("NAMENODE");
+    TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton(expectedHostNameNamenode));
+
+    //Host group which has HAWQMASTER
+    Collection<String> hgComponents2 = new HashSet<String>();
+    hgComponents2.add("HAWQMASTER");
+    TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton(expectedHostNameHawqMaster));
+
+    //Host group which has HAWQSTANDBY
+    Collection<String> hgComponents3 = new HashSet<String>();
+    hgComponents3.add("HAWQSTANDBY");
+    TestHostGroup group3 = new TestHostGroup("group3", hgComponents3, Collections.singleton(expectedHostNameHawqStandby));
+
+    Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>();
+    hostGroups.add(group1);
+    hostGroups.add(group2);
+    hostGroups.add(group3);
+
+    ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups);
+    BlueprintConfigurationProcessor updater = new BlueprintConfigurationProcessor(topology);
+
+    updater.doUpdateForClusterCreate();
+
+    assertEquals(expectedHostNameHawqMaster, hawqSite.get("hawq_master_address_host"));
+    assertEquals(expectedHostNameHawqStandby, hawqSite.get("hawq_standby_address_host"));
+    assertEquals(createHostAddress(expectedHostNameNamenode, expectedPortNamenode) + "/hawq_default", hawqSite.get("hawq_dfs_url"));
+  }
+
 
   private Map<String, AdvisedConfiguration> createAdvisedConfigMap() {
     Map<String, AdvisedConfiguration> advMap = new HashMap<String, AdvisedConfiguration>();