查看YARN任务日志的几种方式
点击上方蓝色字体,选择“设为星标”

通过history server
通过history server,直接在web ui上查看(如果任务异常退出,可能会看不到)


通过yarn命令(用户要和提交任务的用户一致)
yarn application -list -appStates ALL(这个不显示时间信息)
[hdfs@node1 opt]$ yarn application -list -appStates ALL17/07/26 10:51:33 INFO impl.TimelineClientImpl: Timeline service address: http://node2.hde.h3c.com:8188/ws/v1/timeline/17/07/26 10:51:33 INFO client.RMProxy: Connecting to ResourceManager at node2.hde.h3c.com/192.38.0.232:8050Total number of applications (application-types: [] and states: [NEW, NEW_SAVING, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED]):2Application-Id Application-Name Application-Type User Queue State Final-State Progress Tracking-URLapplication_1500702983136_0002 word count MAPREDUCE ambari-qa default FINISHED SUCCEEDED 100% http://node2.hde.h3c.com:19888/jobhistory/job/job_1500702983136_0002application_1500702983136_0001 DistributedShell YARN ambari-qa default FINISHED SUCCEEDED 100% N/A
yarn logs -applicationId application_1493700892407_0007
[ambari-qa@node1 opt]$ yarn logs -applicationId application_1500702983136_000217/07/26 10:56:23 INFO impl.TimelineClientImpl: Timeline service address: http://node2.hde.h3c.com:8188/ws/v1/timeline/17/07/26 10:56:23 INFO client.RMProxy: Connecting to ResourceManager at node2.hde.h3c.com/192.38.0.232:805017/07/26 10:56:25 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library17/07/26 10:56:25 INFO compress.CodecPool: Got brand-new decompressor [.deflate]Container: container_1500702983136_0002_01_000002 on node1.hde.h3c.com_45454==============================================================================LogType:stderrLog Upload Time:Sat Jul 22 01:59:41 -0400 2017LogLength:0Log Contents:End of LogType:stderrLogType:stdoutLog Upload Time:Sat Jul 22 01:59:41 -0400 2017LogLength:0Log Contents:End of LogType:stdoutLogType:syslogLog Upload Time:Sat Jul 22 01:59:41 -0400 2017LogLength:3674Log Contents:2017-07-22 01:59:16,446 WARN [main] org.apache.hadoop.metrics2.impl.MetricsConfig: Cannot locate configuration: tried hadoop-metrics2-maptask.properties,hadoop-metrics2.properties
直接查看hdfs路径的log
查看yarn-site.xml,确定log配置目录
<property><name>yarn.nodemanager.remote-app-log-dirname><value>/app-logsvalue>property>```2)查看日志文件信息(注意日期和时间)[hdfs@node1 root]$ hdfs dfs -ls /app-logs/hdfs/logsFound 1 itemsdrwxrwx--- - hdfs hadoop 0 2017-05-02 04:18 /app-logs/hdfs/logs/application_1493700892407_00073)查看日志详情(注意查看节点重启前的几个敏感app)yarn logs -applicationId application_1493700892407_0007(同2)
文章不错?点个【在看】吧! ?
评论



