ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-14467 Handle schemaless value for ams-hbase-site/hbase.rootdir (dsen)
Date Wed, 23 Dec 2015 17:01:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 512a8ad20 -> 684790327


AMBARI-14467 Handle schemaless value for ams-hbase-site/hbase.rootdir (dsen)


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

Branch: refs/heads/branch-2.2
Commit: 68479032787412b91c392ae2b8dd1dc4bb023b56
Parents: 512a8ad
Author: Dmytro Sen <dsen@apache.org>
Authored: Wed Dec 23 18:58:44 2015 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Wed Dec 23 19:00:33 2015 +0200

----------------------------------------------------------------------
 .../0.1.0/configuration/ams-hbase-site.xml      |  6 ++++++
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 20 +++++++++++++++-----
 .../stacks/2.0.6/common/test_stack_advisor.py   |  5 +++++
 3 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/68479032/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
index 00d0a2c..e6ee6f3 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
@@ -29,6 +29,12 @@
       HBase to either local filesystem path if using Ambari Metrics in embedded mode or
       to a HDFS dir, example: hdfs://namenode.example.org:8020/amshbase.
     </description>
+    <depends-on>
+      <property>
+        <type>core-site</type>
+        <name>fs.defaultFS</name>
+      </property>
+    </depends-on>
   </property>
   <property>
     <name>hbase.tmp.dir</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/68479032/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index a723f75..0530359 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -459,6 +459,11 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
 
     amsCollectorHosts = self.getComponentHostNames(services, "AMBARI_METRICS", "METRICS_COLLECTOR")
 
+    defaultFs = 'file:///'
+    if "core-site" in services["configurations"] and \
+      "fs.defaultFS" in services["configurations"]["core-site"]["properties"]:
+      defaultFs = services["configurations"]["core-site"]["properties"]["fs.defaultFS"]
+
     rootDir = "file:///var/lib/ambari-metrics-collector/hbase"
     tmpDir = "/var/lib/ambari-metrics-collector/hbase-tmp"
     hbaseClusterDistributed = False
@@ -476,7 +481,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if host["Hosts"]["host_name"] == collectorHostName:
           mountpoints = self.getPreferredMountPoints(host["Hosts"])
           break
-    isLocalRootDir = rootDir.startswith("file://")
+    isLocalRootDir = rootDir.startswith("file://") or (defaultFs.startswith("file://") and
rootDir.startswith("/"))
     if isLocalRootDir:
       rootDir = re.sub("^file:///|/", "", rootDir, count=1)
       rootDir = "file://" + os.path.join(mountpoints[0], rootDir)
@@ -536,7 +541,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       putHbaseEnvProperty("hbase_master_xmn_size", round_to_n(0.15*(hbase_heapsize+hbase_rs_heapsize),64))
 
     # If no local DN in distributed mode
-    if rootDir.startswith("hdfs://"):
+    if rootDir.startswith("hdfs://") or (defaultFs.startswith("hdfs://") and rootDir.startswith("/")):
       dn_hosts = self.getComponentHostNames(services, "HDFS", "DATANODE")
       if set(amsCollectorHosts).intersection(dn_hosts):
         collector_cohosted_with_dn = "true"
@@ -821,6 +826,7 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
 
     amsCollectorHosts = self.getComponentHostNames(services, "AMBARI_METRICS", "METRICS_COLLECTOR")
     ams_site = getSiteProperties(configurations, "ams-site")
+    core_site = getSiteProperties(configurations, "core-site")
 
     collector_heapsize, hbase_heapsize, total_sinks_count = self.getAmsMemoryRecommendation(services,
hosts)
     recommendedDiskSpace = 10485760
@@ -839,10 +845,14 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
 
     rootdir_item = None
     op_mode = ams_site.get("timeline.metrics.service.operation.mode")
+    default_fs = core_site.get("fs.defaultFS") if core_site else "file:///"
     hbase_rootdir = properties.get("hbase.rootdir")
     hbase_tmpdir = properties.get("hbase.tmp.dir")
-    if op_mode == "distributed" and hbase_rootdir.startswith("file://"):
+    is_local_root_dir = hbase_rootdir.startswith("file://") or (default_fs.startswith("file://")
and hbase_rootdir.startswith("/"))
+    if op_mode == "distributed" and is_local_root_dir:
       rootdir_item = self.getWarnItem("In distributed mode hbase.rootdir should point to
HDFS.")
+    elif op_mode == "embedded" and hbase_rootdir.startswith('/'):
+      rootdir_item = self.getWarnItem("In embedded mode schemaless values are not supported
for hbase.rootdir")
       pass
 
     distributed_item = None
@@ -856,13 +866,13 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     for collectorHostName in amsCollectorHosts:
       for host in hosts["items"]:
         if host["Hosts"]["host_name"] == collectorHostName:
-          if op_mode == 'embedded':
+          if op_mode == 'embedded' or is_local_root_dir:
             validationItems.extend([{"config-name": 'hbase.rootdir', "item": self.validatorEnoughDiskSpace(properties,
'hbase.rootdir', host["Hosts"], recommendedDiskSpace)}])
             validationItems.extend([{"config-name": 'hbase.rootdir', "item": self.validatorNotRootFs(properties,
recommendedDefaults, 'hbase.rootdir', host["Hosts"])}])
             validationItems.extend([{"config-name": 'hbase.tmp.dir', "item": self.validatorNotRootFs(properties,
recommendedDefaults, 'hbase.tmp.dir', host["Hosts"])}])
 
           dn_hosts = self.getComponentHostNames(services, "HDFS", "DATANODE")
-          if not hbase_rootdir.startswith("hdfs"):
+          if is_local_root_dir:
             mountPoints = []
             for mountPoint in host["Hosts"]["disk_info"]:
               mountPoints.append(mountPoint["mountpoint"])

http://git-wip-us.apache.org/repos/asf/ambari/blob/68479032/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 46e51f8..c37f2ab 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -1227,6 +1227,11 @@ class TestHDP206StackAdvisor(TestCase):
           'dfs.datanode.data.dir': "/hadoop/data"
         }
       },
+      "core-site": {
+        "properties": {
+          "fs.defaultFS": "hdfs://c6401.ambari.apache.org:8020"
+        }
+      },
       "ams-site": {
         "properties": {
           "timeline.metrics.service.operation.mode": "embedded"


Mime
View raw message