You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/11/17 17:09:06 UTC

[1/2] ambari git commit: AMBARI-13922. Deleted properties appear in Add Service Wizard (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 e180c9ed7 -> 982101392
  refs/heads/trunk e89233e7d -> bb371da60


AMBARI-13922. Deleted properties appear in Add Service Wizard (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: bb371da605d766dd4a026778e1c0e40f27600b46
Parents: e89233e
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Nov 17 18:07:40 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Nov 17 18:07:40 2015 +0200

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 12 +++++++++++
 .../stacks/2.0.6/common/test_stack_advisor.py   | 21 ++++++++++++++++++++
 .../stacks/2.1/common/test_stack_advisor.py     |  4 ++++
 3 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb371da6/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 2b55ffb..bd25f7d 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
@@ -226,12 +226,24 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
 
   def recommendHDFSConfigurations(self, configurations, clusterData, services, hosts):
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
+    putHDFSSiteProperty = self.putProperty(configurations, "hdfs-site", services)
+    putHDFSSitePropertyAttributes = self.putPropertyAttribute(configurations, "hdfs-site")
     putHDFSProperty('namenode_heapsize', max(int(clusterData['totalAvailableRam'] / 2), 1024))
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
     putHDFSProperty('namenode_opt_newsize', max(int(clusterData['totalAvailableRam'] / 8), 128))
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
     putHDFSProperty('namenode_opt_maxnewsize', max(int(clusterData['totalAvailableRam'] / 8), 256))
 
+    # Check if NN HA is enabled and recommend removing dfs.namenode.rpc-address
+    hdfsSiteProperties = getServicesSiteProperties(services, "hdfs-site")
+    nameServices = None
+    if hdfsSiteProperties and 'dfs.nameservices' in hdfsSiteProperties:
+      nameServices = hdfsSiteProperties['dfs.nameservices']
+    if nameServices and "dfs.ha.namenodes.%s" % nameServices in hdfsSiteProperties:
+      namenodes = hdfsSiteProperties["dfs.ha.namenodes.%s" % nameServices]
+      if len(namenodes.split(',')) > 1:
+        putHDFSSitePropertyAttributes("dfs.namenode.rpc-address", "delete", "true")
+
     # recommendations for "hadoop.proxyuser.*.hosts", "hadoop.proxyuser.*.groups" properties in core-site
     self.recommendHadoopProxyUsers(configurations, services, hosts)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb371da6/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 cd61cba..a28f764 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
@@ -1010,6 +1010,10 @@ class TestHDP206StackAdvisor(TestCase):
           "webhcat_user": "webhcat"
         }
       },
+      "hdfs-site": {
+        "properties": {
+        }
+      },
       "oozie-env": {
         "properties": {
           "oozie_user": "oozie"
@@ -1066,6 +1070,23 @@ class TestHDP206StackAdvisor(TestCase):
     self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
     self.assertEquals(configurations, expected)
 
+    # Verify dfs.namenode.rpc-address is recommended to be deleted when NN HA
+    configurations["hdfs-site"]["properties"]['dfs.nameservices'] = "mycluster"
+    configurations["hdfs-site"]["properties"]['dfs.ha.namenodes.mycluster'] = "nn1,nn2"
+    services['configurations'] = configurations
+    expected["hdfs-site"] = {
+      'properties': {
+        'dfs.nameservices': 'mycluster',
+        'dfs.ha.namenodes.mycluster': 'nn1,nn2'
+      },
+      'property_attributes': {
+        'dfs.namenode.rpc-address': {
+          'delete': 'true'
+        }
+      }
+    }
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations, expected)
 
 
   def test_getHostNamesWithComponent(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb371da6/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
index 1fa4e44..63d34af 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
@@ -279,6 +279,10 @@ class TestHDP21StackAdvisor(TestCase):
           "hadoop.proxyuser.hdfs.hosts": "*",
           "hadoop.proxyuser.hdfs.groups": "*",
         }
+      },
+      "hdfs-site": {
+        "properties": {
+        }
       }
     }
 


[2/2] ambari git commit: AMBARI-13922. Deleted properties appear in Add Service Wizard (dlysnichenko)

Posted by dm...@apache.org.
AMBARI-13922. Deleted properties appear in Add Service Wizard (dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: 982101392f5aa33229875ed3ca723345d4000cb0
Parents: e180c9e
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Nov 17 18:07:40 2015 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Nov 17 18:08:36 2015 +0200

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 12 +++++++++++
 .../stacks/2.0.6/common/test_stack_advisor.py   | 21 ++++++++++++++++++++
 .../stacks/2.1/common/test_stack_advisor.py     |  4 ++++
 3 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/98210139/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 2b55ffb..bd25f7d 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
@@ -226,12 +226,24 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
 
   def recommendHDFSConfigurations(self, configurations, clusterData, services, hosts):
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
+    putHDFSSiteProperty = self.putProperty(configurations, "hdfs-site", services)
+    putHDFSSitePropertyAttributes = self.putPropertyAttribute(configurations, "hdfs-site")
     putHDFSProperty('namenode_heapsize', max(int(clusterData['totalAvailableRam'] / 2), 1024))
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
     putHDFSProperty('namenode_opt_newsize', max(int(clusterData['totalAvailableRam'] / 8), 128))
     putHDFSProperty = self.putProperty(configurations, "hadoop-env", services)
     putHDFSProperty('namenode_opt_maxnewsize', max(int(clusterData['totalAvailableRam'] / 8), 256))
 
+    # Check if NN HA is enabled and recommend removing dfs.namenode.rpc-address
+    hdfsSiteProperties = getServicesSiteProperties(services, "hdfs-site")
+    nameServices = None
+    if hdfsSiteProperties and 'dfs.nameservices' in hdfsSiteProperties:
+      nameServices = hdfsSiteProperties['dfs.nameservices']
+    if nameServices and "dfs.ha.namenodes.%s" % nameServices in hdfsSiteProperties:
+      namenodes = hdfsSiteProperties["dfs.ha.namenodes.%s" % nameServices]
+      if len(namenodes.split(',')) > 1:
+        putHDFSSitePropertyAttributes("dfs.namenode.rpc-address", "delete", "true")
+
     # recommendations for "hadoop.proxyuser.*.hosts", "hadoop.proxyuser.*.groups" properties in core-site
     self.recommendHadoopProxyUsers(configurations, services, hosts)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/98210139/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 41da879..3d5a764 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
@@ -1010,6 +1010,10 @@ class TestHDP206StackAdvisor(TestCase):
           "webhcat_user": "webhcat"
         }
       },
+      "hdfs-site": {
+        "properties": {
+        }
+      },
       "oozie-env": {
         "properties": {
           "oozie_user": "oozie"
@@ -1066,6 +1070,23 @@ class TestHDP206StackAdvisor(TestCase):
     self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
     self.assertEquals(configurations, expected)
 
+    # Verify dfs.namenode.rpc-address is recommended to be deleted when NN HA
+    configurations["hdfs-site"]["properties"]['dfs.nameservices'] = "mycluster"
+    configurations["hdfs-site"]["properties"]['dfs.ha.namenodes.mycluster'] = "nn1,nn2"
+    services['configurations'] = configurations
+    expected["hdfs-site"] = {
+      'properties': {
+        'dfs.nameservices': 'mycluster',
+        'dfs.ha.namenodes.mycluster': 'nn1,nn2'
+      },
+      'property_attributes': {
+        'dfs.namenode.rpc-address': {
+          'delete': 'true'
+        }
+      }
+    }
+    self.stackAdvisor.recommendHDFSConfigurations(configurations, clusterData, services, hosts)
+    self.assertEquals(configurations, expected)
 
 
   def test_getHostNamesWithComponent(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/98210139/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
index 1fa4e44..63d34af 100644
--- a/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.1/common/test_stack_advisor.py
@@ -279,6 +279,10 @@ class TestHDP21StackAdvisor(TestCase):
           "hadoop.proxyuser.hdfs.hosts": "*",
           "hadoop.proxyuser.hdfs.groups": "*",
         }
+      },
+      "hdfs-site": {
+        "properties": {
+        }
       }
     }