Parcourir la source

AMBARI-10714 - Separate memory configuration for Hive CLI, HiveServer2, Hive Metastore

Artem Baranchuk il y a 10 ans
Parent
commit
5b0acfbdc0

+ 8 - 1
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hadoop-env.xml

@@ -196,7 +196,14 @@ export JSVC_HOME={{jsvc_path}}
 
 
 
 
 # The maximum amount of heap to use, in MB. Default is 1000.
 # The maximum amount of heap to use, in MB. Default is 1000.
-export HADOOP_HEAPSIZE="{{hadoop_heapsize}}"
+if [[ ("$SERVICE" = "hiveserver2") || ("$SERVICE" = "metastore") || ( "$SERVICE" = "cli") ]]; then
+  if [ "$HADOOP_HEAPSIZE" = "" ]; then
+    export HADOOP_HEAPSIZE="{{hadoop_heapsize}}"
+  fi
+else
+  export HADOOP_HEAPSIZE="{{hadoop_heapsize}}"
+fi
+
 
 
 export HADOOP_NAMENODE_INIT_HEAPSIZE="-Xms{{namenode_heapsize}}"
 export HADOOP_NAMENODE_INIT_HEAPSIZE="-Xms{{namenode_heapsize}}"
 
 

+ 6 - 4
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py

@@ -290,13 +290,15 @@ start_metastore_path = format("{tmp_dir}/start_metastore_script")
 
 
 hadoop_heapsize = config['configurations']['hadoop-env']['hadoop_heapsize']
 hadoop_heapsize = config['configurations']['hadoop-env']['hadoop_heapsize']
 
 
-if Script.is_hdp_stack_less_than("2.2"):
-  if 'role' in config and config['role'] in ["HIVE_SERVER", "HIVE_METASTORE"]:
+if 'role' in config and config['role'] in ["HIVE_SERVER", "HIVE_METASTORE"]:
+  if Script.is_hdp_stack_less_than("2.2"):
     hive_heapsize = config['configurations']['hive-site']['hive.heapsize']
     hive_heapsize = config['configurations']['hive-site']['hive.heapsize']
   else:
   else:
-    hive_heapsize = config['configurations']['hive-env']['hive.client.heapsize']
+    hive_heapsize = config['configurations']['hive-env']['hive.heapsize']
+else:
+  hive_heapsize = config['configurations']['hive-env']['hive.client.heapsize']
 
 
-  hive_metastore_heapsize = config['configurations']['hive-env']['hive.metastore.heapsize']
+hive_metastore_heapsize = config['configurations']['hive-env']['hive.metastore.heapsize']
 
 
 java64_home = config['hostLevelParams']['java_home']
 java64_home = config['hostLevelParams']['java_home']
 
 

+ 9 - 7
ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-env.xml

@@ -22,13 +22,9 @@
 
 
 <configuration>
 <configuration>
   <property>
   <property>
-    <name>hive.client.heapsize</name>
-    <deleted>true</deleted>
-  </property>
-
-  <property>
-    <name>hive.metastore.heapsize</name>
-    <deleted>true</deleted>
+    <name>hive.heapsize</name>
+    <value>1024</value>
+    <description>Hive Java heap size</description>
   </property>
   </property>
 
 
   <!-- hive-env.sh -->
   <!-- hive-env.sh -->
@@ -45,6 +41,12 @@
  fi
  fi
 
 
 # The heap size of the jvm stared by hive shell script can be controlled via:
 # The heap size of the jvm stared by hive shell script can be controlled via:
+export SERVICE=$SERVICE
+if [ "$SERVICE" = "metastore" ]; then
+  export HADOOP_HEAPSIZE="{{hive_metastore_heapsize}}"
+else
+  export HADOOP_HEAPSIZE="{{hive_heapsize}}"
+fi
 
 
 # Larger heap size may be required when running queries over large number of files or partitions.
 # Larger heap size may be required when running queries over large number of files or partitions.
 # By default hive shell scripts use a heap size of 256 (MB).  Larger heap size would also be
 # By default hive shell scripts use a heap size of 256 (MB).  Larger heap size would also be