Parcourir la source

AMBARI-18130. Atlas hooks to include atlas.rest.address config, allow editing in the UI, and compute value using all Atlas Servers (alejandro)

Alejandro Fernandez il y a 9 ans
Parent
commit
1719c9034b

+ 1 - 0
ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py

@@ -77,6 +77,7 @@ SHARED_ATLAS_HOOK_CONFIGS = set(
   "atlas.notification.kafka.service.principal",
   "atlas.notification.kafka.keytab.location",
   "atlas.cluster.name",
+  "atlas.rest.address",
 
   # Security properties
   "atlas.jaas.KafkaClient.option.serviceName",

+ 1 - 4
ambari-server/src/main/resources/common-services/ATLAS/0.7.0.2.5/configuration/application-properties.xml

@@ -128,10 +128,7 @@
       </property>
     </depends-on>
     <value-attributes>
-      <read-only>true</read-only>
-      <editable-only-at-install>true</editable-only-at-install>
-      <overridable>false</overridable>
-      <visible>true</visible>
+      <editable-only-at-install>false</editable-only-at-install>
     </value-attributes>
     <on-ambari-upgrade add="false"/>
   </property>

+ 9 - 4
ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py

@@ -454,9 +454,12 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     services_list = [service["StackServices"]["service_name"] for service in services["services"]]
     is_atlas_in_cluster = "ATLAS" in services_list
 
-    atlas_server_host_info = self.getHostWithComponent("ATLAS", "ATLAS_SERVER", services, hosts)
-    if is_atlas_in_cluster and atlas_server_host_info:
-      atlas_rest_host = atlas_server_host_info['Hosts']['host_name']
+    atlas_server_hosts_info = self.getHostsWithComponent("ATLAS", "ATLAS_SERVER", services, hosts)
+    if is_atlas_in_cluster and atlas_server_hosts_info and len(atlas_server_hosts_info) > 0:
+      # Multiple Atlas Servers can exist, so sort by hostname to create deterministic csv
+      atlas_host_names = [e['Hosts']['host_name'] for e in atlas_server_hosts_info]
+      if len(atlas_host_names) > 1:
+        atlas_host_names = sorted(atlas_host_names)
 
       scheme = "http"
       metadata_port = "21000"
@@ -474,7 +477,9 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
             metadata_port = str(services['configurations']['application-properties']['properties']['atlas.server.https.port'])
           else:
             metadata_port = atlas_server_default_https_port
-      atlas_rest_address = '{0}://{1}:{2}'.format(scheme, atlas_rest_host, metadata_port)
+
+      atlas_rest_address_list = ["{0}://{1}:{2}".format(scheme, hostname, metadata_port) for hostname in atlas_host_names]
+      atlas_rest_address = ",".join(atlas_rest_address_list)
       Logger.info("Constructing atlas.rest.address=%s" % atlas_rest_address)
     return atlas_rest_address