Przeglądaj źródła

AMBARI-8522. Enable Flume metrics sink to AMS. Missing stack changes. (Szilard Nemethy via mpapirkovskyy)

Myroslav Papirkovskyy 10 lat temu
rodzic
commit
86b0ce46c6

+ 2 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-env.xml

@@ -69,7 +69,8 @@ export JAVA_HOME={{java_home}}
 # export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"
 # export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"
 
 
 # Note that the Flume conf directory is always included in the classpath.
 # Note that the Flume conf directory is always included in the classpath.
-#FLUME_CLASSPATH=""
+#TODO temporary addition
+export FLUME_CLASSPATH=$FLUME_CLASSPATH:/usr/lib/flume/lib/*
 
 
 export HIVE_HOME={{flume_hive_home}}
 export HIVE_HOME={{flume_hive_home}}
 export HCAT_HOME={{flume_hcat_home}}
 export HCAT_HOME={{flume_hcat_home}}

+ 8 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py

@@ -65,6 +65,12 @@ def flume(action = None):
            content=InlineTemplate(params.flume_env_sh_template)
            content=InlineTemplate(params.flume_env_sh_template)
       )
       )
 
 
+      if params.has_metric_collector:
+        File(os.path.join(flume_agent_conf_dir, "flume-metrics2.properties"),
+             owner=params.flume_user,
+             content=Template("flume-metrics2.properties.j2")
+        )
+
   elif action == 'start':
   elif action == 'start':
     # desired state for service should be STARTED
     # desired state for service should be STARTED
     if len(params.flume_command_targets) == 0:
     if len(params.flume_command_targets) == 0:
@@ -89,6 +95,8 @@ def flume(action = None):
         if params.ganglia_server_host is not None:
         if params.ganglia_server_host is not None:
           extra_args = '-Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts={0}:{1}'
           extra_args = '-Dflume.monitoring.type=ganglia -Dflume.monitoring.hosts={0}:{1}'
           extra_args = extra_args.format(params.ganglia_server_host, '8655')
           extra_args = extra_args.format(params.ganglia_server_host, '8655')
+        if params.has_metric_collector:
+          extra_args = '-Dflume.monitoring.type=org.apache.hadoop.metrics2.sink.flume.FlumeTimelineMetricsSink'
 
 
         flume_cmd = flume_base.format(agent, flume_agent_conf_dir,
         flume_cmd = flume_base.format(agent, flume_agent_conf_dir,
            flume_agent_conf_file, extra_args)
            flume_agent_conf_file, extra_args)

+ 5 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py

@@ -73,3 +73,8 @@ if 0 != len(ganglia_server_hosts):
 hostname = None
 hostname = None
 if config.has_key('hostname'):
 if config.has_key('hostname'):
   hostname = config['hostname']
   hostname = config['hostname']
+
+ams_collector_hosts = default("/clusterHostInfo/metric_collector_hosts", [])
+has_metric_collector = not len(ams_collector_hosts) == 0
+if has_metric_collector:
+  metric_collector_host = ams_collector_hosts[0]

+ 22 - 0
ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/flume-metrics2.properties.j2

@@ -0,0 +1,22 @@
+{#
+# 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.
+#}
+
+collector={{metric_collector_host}}:8188
+collectionFrequency=60000
+maxRowCacheSize=10000
+sendInterval=59000

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/AMS/configuration/ams-site.xml

@@ -205,7 +205,7 @@
   </property>
   </property>
   <property>
   <property>
     <name>timeline.metrics.service.checkpointDelay</name>
     <name>timeline.metrics.service.checkpointDelay</name>
-    <value>120</value>
+    <value>60</value>
     <description>
     <description>
       Time in seconds to sleep on the first run or when the checkpoint is
       Time in seconds to sleep on the first run or when the checkpoint is
       too old.
       too old.