Browse Source

AMBARI-10154. Hive Ambari install is missing a limits.d/hive (aonishuk)

Andrew Onishuk 10 years ago
parent
commit
8a24c72027

+ 14 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py

@@ -72,6 +72,20 @@ def hive(name=None):
        content=InlineTemplate(params.hive_env_sh_template)
        content=InlineTemplate(params.hive_env_sh_template)
   )
   )
 
 
+  # 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, 'hive.conf'),
+       owner='root',
+       group='root',
+       mode=0644,
+       content=Template("hive.conf.j2")
+       )
+
   if name == 'metastore' or name == 'hiveserver2':
   if name == 'metastore' or name == 'hiveserver2':
     jdbc_connector()
     jdbc_connector()
 
 

+ 1 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params.py

@@ -93,6 +93,7 @@ hive_conf_dir_prefix = "/etc/hive"
 hive_conf_dir = format("{hive_conf_dir_prefix}/conf")
 hive_conf_dir = format("{hive_conf_dir_prefix}/conf")
 hive_client_conf_dir = format("{hive_conf_dir_prefix}/conf")
 hive_client_conf_dir = format("{hive_conf_dir_prefix}/conf")
 hive_server_conf_dir = format("{hive_conf_dir_prefix}/conf.server")
 hive_server_conf_dir = format("{hive_conf_dir_prefix}/conf.server")
+limits_conf_dir = "/etc/security/limits.d"
 
 
 if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0:
 if hdp_stack_version != "" and compare_versions(hdp_stack_version, "2.1.0.0") < 0:
   hcat_conf_dir = '/etc/hcatalog/conf'
   hcat_conf_dir = '/etc/hcatalog/conf'

+ 35 - 0
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/templates/hive.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.
+
+{{hive_user}}   - nofile 32768
+{{hive_user}}   - nproc  65536

+ 22 - 0
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py

@@ -81,6 +81,17 @@ class TestHiveClient(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
     self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
         content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
         content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
     )
     )
@@ -145,6 +156,17 @@ class TestHiveClient(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
     self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
         content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
         content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
     )
     )

+ 22 - 0
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py

@@ -196,6 +196,17 @@ class TestHiveMetastore(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',
@@ -288,6 +299,17 @@ class TestHiveMetastore(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',

+ 22 - 0
ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py

@@ -316,6 +316,17 @@ class TestHiveServer(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',
@@ -440,6 +451,17 @@ class TestHiveServer(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',

+ 22 - 0
ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py

@@ -215,6 +215,17 @@ class TestHiveMetastore(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',
@@ -299,6 +310,17 @@ class TestHiveMetastore(RMFTestCase):
                               owner = 'hive',
                               owner = 'hive',
                               group = 'hadoop',
                               group = 'hadoop',
                               )
                               )
+    self.assertResourceCalled('Directory', '/etc/security/limits.d',
+                              owner = 'root',
+                              group = 'root',
+                              recursive = True,
+                              )
+    self.assertResourceCalled('File', '/etc/security/limits.d/hive.conf',
+                              content = Template('hive.conf.j2'),
+                              owner = 'root',
+                              group = 'root',
+                              mode = 0644,
+                              )
     self.assertResourceCalled('Execute', ('cp',
     self.assertResourceCalled('Execute', ('cp',
                                           '--remove-destination',
                                           '--remove-destination',
                                           '/usr/share/java/mysql-connector-java.jar',
                                           '/usr/share/java/mysql-connector-java.jar',