This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b6290ba  AMBARI-23402. Make nproc and nolimit values configurable 
through infra-solr-env config (#826)
b6290ba is described below

commit b6290bab17a3857ff6a9b9b3444467234e4f284b
Author: Olivér Szabó <[email protected]>
AuthorDate: Thu Mar 29 16:30:58 2018 +0200

    AMBARI-23402. Make nproc and nolimit values configurable through 
infra-solr-env config (#826)
    
    * AMBARI-23402. Make nproc and nolimit values configurable through 
infra-solr-env config
    
    * AMBARI-23402. Remove unneded '_' char
---
 .../0.1.0/configuration/infra-solr-env.xml              | 13 +++++++++++++
 .../AMBARI_INFRA_SOLR/0.1.0/package/scripts/params.py   |  4 ++++
 .../0.1.0/package/scripts/setup_infra_solr.py           |  9 ++++++++-
 .../0.1.0/package/templates/infra-solr.conf.j2          | 17 +++++++++++++++++
 .../python/stacks/2.4/AMBARI_INFRA/test_infra_solr.py   |  5 +++++
 5 files changed, 47 insertions(+), 1 deletion(-)

diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/configuration/infra-solr-env.xml
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/configuration/infra-solr-env.xml
index ece834c..a616c37 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/configuration/infra-solr-env.xml
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/configuration/infra-solr-env.xml
@@ -265,6 +265,19 @@
     <on-ambari-upgrade add="false"/>
   </property>
 
+  <property>
+    <name>infra_solr_user_nofile_limit</name>
+    <value>128000</value>
+    <description>Max open files limit setting for infra-solr 
user.</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>infra_solr_user_nproc_limit</name>
+    <value>65536</value>
+    <description>Max number of processes limit setting for infra-solr 
user.</description>
+    <on-ambari-upgrade add="true"/>
+  </property>
+
   <!-- infra-solr-env.sh -->
   <property>
     <name>content</name>
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/params.py
index 6119ee8..b7f16cb 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/params.py
@@ -63,6 +63,10 @@ prev_infra_solr_pidfile = 
status_params.prev_infra_solr_pidfile
 user_group = config['configurations']['cluster-env']['user_group']
 fetch_nonlocal_groups = 
config['configurations']['cluster-env']["fetch_nonlocal_groups"]
 
+limits_conf_dir = "/etc/security/limits.d"
+infra_solr_user_nofile_limit = 
default("/configurations/infra-solr-env/infra_solr_user_nofile_limit", "128000")
+infra_solr_user_nproc_limit = 
default("/configurations/infra-solr-env/infra_solr_user_nproc_limit", "65536")
+
 # shared configs
 java_home = config['ambariLevelParams']['java_home']
 ambari_java_home = default("/ambariLevelParams/ambari_java_home", None)
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/setup_infra_solr.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/setup_infra_solr.py
index ef7cadd..5155950 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/setup_infra_solr.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/scripts/setup_infra_solr.py
@@ -17,6 +17,7 @@ limitations under the License.
 
 """
 
+import os
 from resource_management.core.exceptions import Fail
 from resource_management.core.resources.system import Directory, File
 from resource_management.core.source import InlineTemplate, Template
@@ -24,7 +25,6 @@ from resource_management.libraries.functions import 
solr_cloud_util
 from resource_management.libraries.functions.decorator import retry
 from resource_management.libraries.functions.format import format
 
-
 def setup_infra_solr(name = None):
   import params
 
@@ -92,6 +92,13 @@ def setup_infra_solr(name = None):
            group=params.user_group,
            mode=0640)
 
+    File(os.path.join(params.limits_conf_dir, 'infra-solr.conf'),
+         owner='root',
+         group='root',
+         mode=0644,
+         content=Template("infra-solr.conf.j2")
+         )
+
   elif name == 'client':
     solr_cloud_util.setup_solr_client(params.config)
 
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/templates/infra-solr.conf.j2
 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/templates/infra-solr.conf.j2
new file mode 100644
index 0000000..2e385c0
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_INFRA_SOLR/0.1.0/package/templates/infra-solr.conf.j2
@@ -0,0 +1,17 @@
+# 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.
+
+{{infra_solr_user}}   - nofile {{infra_solr_user_nofile_limit}}
+{{infra_solr_user}}   - nproc  {{infra_solr_user_nproc_limit}}
\ No newline at end of file
diff --git 
a/ambari-server/src/test/python/stacks/2.4/AMBARI_INFRA/test_infra_solr.py 
b/ambari-server/src/test/python/stacks/2.4/AMBARI_INFRA/test_infra_solr.py
index 8ddfe29..6dc409b 100644
--- a/ambari-server/src/test/python/stacks/2.4/AMBARI_INFRA/test_infra_solr.py
+++ b/ambari-server/src/test/python/stacks/2.4/AMBARI_INFRA/test_infra_solr.py
@@ -104,6 +104,11 @@ class TestInfraSolr(RMFTestCase):
                                 content = 
InlineTemplate(self.getConfig()['configurations']['infra-solr-security-json']['content']),
                                 mode = 0640
                                 )
+      self.assertResourceCalled('File', 
'/etc/security/limits.d/infra-solr.conf',
+                                owner = 'root',
+                                group='root',
+                                content = Template('infra-solr.conf.j2')
+                                )
 
       self.assertResourceCalled('Execute', 'ambari-sudo.sh 
JAVA_HOME=/usr/jdk64/jdk1.7.0_45 
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string 
c6401.ambari.apache.org:2181 --znode /infra-solr --create-znode --retry 30 
--interval 5')
       self.assertResourceCalled('Execute', 'ambari-sudo.sh 
JAVA_HOME=/usr/jdk64/jdk1.7.0_45 
/usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string 
c6401.ambari.apache.org:2181/infra-solr --remove-admin-handlers --collection 
hadoop_logs --retry 5 --interval 10')

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to