Elukey has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/368820 )

Change subject: hive: remove etc default config in favor of hive-env.sh
......................................................................


hive: remove etc default config in favor of hive-env.sh

Bug: T172107
Change-Id: I5c0c044ee982843443c6e2c5a2f1fa6ddc949a6f
---
M manifests/hive.pp
M manifests/hive/defaults.pp
M manifests/hive/metastore.pp
M manifests/hive/server.pp
A templates/hive/hive-env.sh.erb
D templates/hive/hive-metastore.default.erb
D templates/hive/hive-server2.default.erb
7 files changed, 34 insertions(+), 79 deletions(-)

Approvals:
  Ottomata: Looks good to me, but someone else must approve
  Elukey: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/hive.pp b/manifests/hive.pp
index 1f187e9..9f2c779 100644
--- a/manifests/hive.pp
+++ b/manifests/hive.pp
@@ -83,7 +83,14 @@
 
     $hive_site_template          = $cdh::hive::defaults::hive_site_template,
     $hive_log4j_template         = $cdh::hive::defaults::hive_log4j_template,
-    $hive_exec_log4j_template    = 
$cdh::hive::defaults::hive_exec_log4j_template
+    $hive_exec_log4j_template    = 
$cdh::hive::defaults::hive_exec_log4j_template,
+    $hive_env_template           = $cdh::hive::defaults::hive_env_template,
+
+    $hive_metastore_heap_size    = 
$cdh::hive::defaults::hive_metastore_heap_size,
+    $hive_server_heap_size       = $cdh::hive::defaults::hive_server_heap_size,
+    $hive_metastore_jmx_port     = 
$cdh::hive::defaults::hive_metastore_jmx_port,
+    $hive_server_jmx_port        = $cdh::hive::defaults::hive_server_jmx_port,
+
 ) inherits cdh::hive::defaults
 {
     Class['cdh::hadoop'] -> Class['cdh::hive']
@@ -117,6 +124,13 @@
         $::fqdn => '0440',
         default => '0444',
     }
+    file { "${config_directory}/hive-env.sh":
+        content => template($hive_env_template),
+        mode    => '0444',
+        owner   => 'root',
+        group   => 'hdfs',
+        require => Package['hive'],
+    }
     file { "${config_directory}/hive-site.xml":
         content => template($hive_site_template),
         mode    => $hive_site_mode,
diff --git a/manifests/hive/defaults.pp b/manifests/hive/defaults.pp
index 276077b..1513b2b 100644
--- a/manifests/hive/defaults.pp
+++ b/manifests/hive/defaults.pp
@@ -47,8 +47,11 @@
     $hive_site_template          = 'cdh/hive/hive-site.xml.erb'
     $hive_log4j_template         = 'cdh/hive/hive-log4j.properties.erb'
     $hive_exec_log4j_template    = 'cdh/hive/hive-exec-log4j.properties.erb'
+    $hive_env_template           = 'cdh/hive/hive-env.sh.erb'
 
     # Jmx ports
     $hive_server_jmx_port        = 9978
     $hive_metastore_jmx_port     = 9979
+    $hive_metastore_opts         = '-Xmx2048m'
+    $hive_server_opts            = '-Xmx2048m'
 }
\ No newline at end of file
diff --git a/manifests/hive/metastore.pp b/manifests/hive/metastore.pp
index b519955..e8bfbf6 100644
--- a/manifests/hive/metastore.pp
+++ b/manifests/hive/metastore.pp
@@ -4,24 +4,15 @@
 #
 # == Parameters
 # $port       - Port on which hive-metastore listens.  Default: undef
-# $heapsize   - -Xmx in MB. Default: undef
 #
 class cdh::hive::metastore(
     $port             = undef,
-    $heapsize         = undef,
-    $jmx_port         = $cdh::hive::defaults::hive_metastore_jmx_port,
-    $default_template = 'cdh/hive/hive-metastore.default.erb',
 )
 {
     Class['cdh::hive'] -> Class['cdh::hive::metastore']
 
     package { 'hive-metastore':
         ensure => 'installed',
-    }
-
-    file { '/etc/default/hive-metastore':
-        content => template($default_template),
-        require => Package['hive-metastore'],
     }
 
     # If the metastore will use MySQL for storage, then
diff --git a/manifests/hive/server.pp b/manifests/hive/server.pp
index f3a6269..b95bdcf 100644
--- a/manifests/hive/server.pp
+++ b/manifests/hive/server.pp
@@ -6,13 +6,9 @@
 #
 # == Parameters
 # $port       - Port on which hive-server2 listens.  Default: undef
-# $heapsize   - -Xmx in MB. Default: undef
 #
 class cdh::hive::server(
     $port             = undef,
-    $heapsize         = undef,
-    $jmx_port         = $cdh::hive::defaults::hive_server_jmx_port,
-    $default_template = 'cdh/hive/hive-server2.default.erb'
 )
 {
     # cdh::hive::server requires hadoop client and configs are installed.
@@ -22,11 +18,6 @@
     package { 'hive-server2':
         ensure => 'installed',
         alias  => 'hive-server',
-    }
-
-    file { '/etc/default/hive-server2':
-        content => template($default_template),
-        require => Package['hive-server2'],
     }
 
     # sudo -u hdfs hdfs dfs -mkdir /user/hive
diff --git a/templates/hive/hive-env.sh.erb b/templates/hive/hive-env.sh.erb
new file mode 100644
index 0000000..c14f7a0
--- /dev/null
+++ b/templates/hive/hive-env.sh.erb
@@ -0,0 +1,16 @@
+#! /bin/bash
+# Note: This file is managed by Puppet
+
+if [ "$SERVICE" = "metastore" ]; then
+    export HADOOP_OPTS="$HADOOP_OPTS ${hive_metastore_opts}"
+    <% if @hive_metastore_jmx_port -%>
+        export HADOOP_OPTS="$HADOOP_OPTS 
-Dcom.sun.management.jmxremote.port=<%= @hive_metastore_jmx_port %> 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false"
+    <% end -%>
+fi
+
+if [ "$SERVICE" = "hiveserver2" ]; then
+    export HADOOP_OPTS="$HADOOP_OPTS ${hive_server_opts}"
+    <% if @hive_server_jmx_port -%>
+        export HADOOP_OPTS="$HADOOP_OPTS 
-Dcom.sun.management.jmxremote.port=<%= @hive_server_jmx_port %> 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false"
+    <% end -%>
+fi
\ No newline at end of file
diff --git a/templates/hive/hive-metastore.default.erb 
b/templates/hive/hive-metastore.default.erb
deleted file mode 100644
index 0b76249..0000000
--- a/templates/hive/hive-metastore.default.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Note: This file is managed by Puppet.
-
-# 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.
-
-# The port for Hive metastore daemon to listen to.
-# Unfortunatelly, there is no way to specify the interfaces
-# to which the daemon binds.
-#
-<%= @port ? "export PORT=#{@port}" : '#export PORT=' %>
-
-<% if @heapsize -%>
-export HADOOP_OPTS="$HADOOP_OPTS -Xmx<%= @heapsize %>"
-<% end -%>
-
-<% if @jmx_port -%>
-HADOOP_OPTS="$HADOOP_OPTS -Dcom.sun.management.jmxremote.port=<%= @jmx_port %> 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false"
-<% end -%>
\ No newline at end of file
diff --git a/templates/hive/hive-server2.default.erb 
b/templates/hive/hive-server2.default.erb
deleted file mode 100644
index 9c8e675..0000000
--- a/templates/hive/hive-server2.default.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-# Note: This file is managed by Puppet.
-
-# 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.
-
-# The port for Hive server2 daemon to listen to.
-# Unfortunatelly, there is no way to specify the interfaces
-# to which the daemon binds.
-#
-<%= @port ? "export PORT=#{@port}" : '#export PORT=' %>
-
-<% if @heapsize -%>
-export HADOOP_OPTS="$HADOOP_OPTS -Xmx<%= @heapsize %>"
-<% end -%>
-
-<% if @jmx_port -%>
-HADOOP_OPTS="$HADOOP_OPTS -Dcom.sun.management.jmxremote.port=<%= @jmx_port %> 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false"
-<% end -%>

-- 
To view, visit https://gerrit.wikimedia.org/r/368820
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5c0c044ee982843443c6e2c5a2f1fa6ddc949a6f
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet/cdh
Gerrit-Branch: master
Gerrit-Owner: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Ottomata <ao...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to