Bladeren bron

AMBARI-13632 Add normalizer properties for AMS Regions (dsen)

Dmytro Sen 10 jaren geleden
bovenliggende
commit
491a3284e2

+ 17 - 7
ambari-metrics/ambari-metrics-timelineservice/conf/unix/ambari-metrics-collector

@@ -31,7 +31,7 @@ HBASE_CONF_DIR=/etc/ams-hbase/conf
 
 HBASE_CMD=${HBASE_DIR}/bin/hbase
 
-METRIC_TABLE_NAME=METRIC_AGGREGATE_DAILY
+METRIC_TABLES=(METRIC_AGGREGATE_DAILY METRIC_AGGREGATE_HOURLY METRIC_AGGREGATE METRIC_RECORD METRIC_RECORD_DAILY METRIC_RECORD_HOURLY METRIC_RECORD_MINUTE)
 METRIC_COLLECTOR=ambari-metrics-collector
 
 AMS_LOG_DIR=/var/log/ambari-metrics-collector
@@ -82,6 +82,18 @@ function write_pidfile
     fi
 }
 
+# TODO replace this with Phoenix DDL, when normalization support added to Phoenix
+function enable_normalization
+{
+  # Enable normalization for all the tables
+  command=""
+  for table in "${METRIC_TABLES[@]}"
+  do
+    command="$command \n alter_async '$table', {NORMALIZATION_ENABLED => 'true'}"
+  done
+  echo -e ${command} | ${HBASE_CMD} --config ${HBASE_CONF_DIR} shell > /dev/null 2>&1
+}
+
 function hadoop_java_setup
 {
   # Bail if we did not detect it
@@ -201,10 +213,10 @@ function start()
 
   echo "Collector successfully started."
   echo "Initializing Ambari Metrics data model"
-  # Wait until METRIC_RECORD table created
+  # Wait until METRIC_* tables created
   for retry in {1..10}
   do
-    echo 'list' | ${HBASE_CMD} --config ${HBASE_CONF_DIR} shell | grep ^${METRIC_TABLE_NAME} > /dev/null 2>&1
+    echo 'list' | ${HBASE_CMD} --config ${HBASE_CONF_DIR} shell | grep ^${METRIC_TABLES[0]} > /dev/null 2>&1
     if [ $? -eq 0 ]; then
       echo "Ambari Metrics data model initialization completed."
       break
@@ -216,7 +228,8 @@ function start()
     exit -1
   fi
 
-}
+  enable_normalization
+  }
 
 function stop()
 {
@@ -331,6 +344,3 @@ case "$1" in
 	;;
 
 esac
-
-
-

+ 20 - 0
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml

@@ -132,6 +132,26 @@
       if it is not served from (local, client) memory.
     </description>
   </property>
+  <property>
+    <name>hbase.normalizer.enabled</name>
+    <value>true</value>
+    <description>If set to true, Master will try to keep region size
+    within each table approximately the same.</description>
+  </property>
+  <property>
+    <name>hbase.normalizer.period</name>
+    <value>3600000</value>
+    <description>Period in ms at which the region normalizer runs in the Master.</description>
+  </property>
+  <property>
+    <name>hbase.master.normalizer.class</name>
+    <value>org.apache.hadoop.hbase.master.normalizer.SimpleRegionNormalizer</value>
+    <description>
+      Class used to execute the region normalization when the period occurs.
+      See the class comment for more on how it works
+      http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.html
+    </description>
+  </property>
   <property>
     <name>hfile.block.cache.size</name>
     <value>0.3</value>