Преглед изворни кода

AMBARI-14808. Add Oozie limits.conf for Oozie User as done for HDFS/YARN (aonishuk)

Andrew Onishuk пре 9 година
родитељ
комит
a88678fc7d

+ 10 - 0
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml

@@ -98,6 +98,16 @@
     <value>256</value>
     <value>256</value>
     <description>Oozie permanent generation size.</description>
     <description>Oozie permanent generation size.</description>
   </property>
   </property>
+  <property>
+    <name>oozie_user_nofile_limit</name>
+    <value>32000</value>
+    <description>Max open files limit setting for OOZIE user.</description>
+  </property>
+  <property>
+    <name>oozie_user_nproc_limit</name>
+    <value>16000</value>
+    <description>Max number of processes limit setting for OOZIE user.</description>
+  </property>
 
 
   <!-- oozie-env.sh -->
   <!-- oozie-env.sh -->
   <property>
   <property>

+ 14 - 0
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py

@@ -114,6 +114,20 @@ def oozie(is_server=False):
     group=params.user_group,
     group=params.user_group,
   )
   )
 
 
+  # On some OS this folder could be not exists, so we will create it before pushing there files
+  Directory(params.limits_conf_dir,
+            recursive=True,
+            owner='root',
+            group='root'
+  )
+
+  File(os.path.join(params.limits_conf_dir, 'oozie.conf'),
+       owner='root',
+       group='root',
+       mode=0644,
+       content=Template("oozie.conf.j2")
+  )
+
   if (params.log4j_props != None):
   if (params.log4j_props != None):
     File(format("{params.conf_dir}/oozie-log4j.properties"),
     File(format("{params.conf_dir}/oozie-log4j.properties"),
       mode=0644,
       mode=0644,

+ 5 - 0
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py

@@ -124,6 +124,11 @@ security_enabled = config['configurations']['cluster-env']['security_enabled']
 oozie_heapsize = config['configurations']['oozie-env']['oozie_heapsize']
 oozie_heapsize = config['configurations']['oozie-env']['oozie_heapsize']
 oozie_permsize = config['configurations']['oozie-env']['oozie_permsize']
 oozie_permsize = config['configurations']['oozie-env']['oozie_permsize']
 
 
+limits_conf_dir = "/etc/security/limits.d"
+
+oozie_user_nofile_limit = config['configurations']['oozie-env']['oozie_user_nofile_limit']
+oozie_user_nproc_limit = config['configurations']['oozie-env']['oozie_user_nproc_limit']
+
 kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
 kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
 oozie_service_keytab = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.keytab.file']
 oozie_service_keytab = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.keytab.file']
 oozie_principal = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.kerberos.principal']
 oozie_principal = config['configurations']['oozie-site']['oozie.service.HadoopAccessorService.kerberos.principal']

+ 35 - 0
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/templates/oozie.conf.j2

@@ -0,0 +1,35 @@
+{#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{{oozie_user}}   - nofile   {{oozie_user_nofile_limit}}
+{{oozie_user}}   - nproc    {{oozie_user_nproc_limit}}

+ 33 - 0
ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_client.py

@@ -52,6 +52,17 @@ class TestOozieClient(RMFTestCase):
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',
@@ -107,6 +118,17 @@ class TestOozieClient(RMFTestCase):
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',
@@ -168,6 +190,17 @@ class TestOozieClient(RMFTestCase):
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               group = 'hadoop',
                               group = 'hadoop',
     )
     )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/usr/hdp/current/oozie-client/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/usr/hdp/current/oozie-client/conf/oozie-log4j.properties',
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',

+ 44 - 0
ambari-server/src/test/python/stacks/2.0.6/OOZIE/test_oozie_server.py

@@ -105,6 +105,17 @@ class TestOozieServer(RMFTestCase):
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               content = 'log4jproperties\nline2',
                               content = 'log4jproperties\nline2',
                               owner = 'oozie',
                               owner = 'oozie',
@@ -313,6 +324,17 @@ class TestOozieServer(RMFTestCase):
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               content = 'log4jproperties\nline2',
                               content = 'log4jproperties\nline2',
                               owner = 'oozie',
                               owner = 'oozie',
@@ -673,6 +695,17 @@ class TestOozieServer(RMFTestCase):
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',
@@ -852,6 +885,17 @@ class TestOozieServer(RMFTestCase):
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               content = InlineTemplate(self.getConfig()['configurations']['oozie-env']['content']),
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive=True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/oozie.conf',
+                              owner = 'root',
+                              group = 'root',
+                              mode=0644,
+                              content=Template("oozie.conf.j2"),
+                              )
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
     self.assertResourceCalled('File', '/etc/oozie/conf/oozie-log4j.properties',
                               owner = 'oozie',
                               owner = 'oozie',
                               group = 'hadoop',
                               group = 'hadoop',