hadoop流媒体:应用程序日志在哪里?

2024-09-28 22:32:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我的问题类似于:hadoop streaming: how to see application logs? (答案中的链接当前不起作用。所以我不得不再发一个问题)

我可以看到我的/usr/local/hadoop/logs路径上的所有hadoop日志

但是在哪里可以看到应用程序级别的日志?例如:

在减速器.py-在

import logging
....
logging.basicConfig(level=logging.ERROR, format='MAP %(asctime)s%(levelname)s%(message)s')
logging.error('Test!')  
...

我在stderr中看不到任何日志(警告、错误)。在

在哪里可以找到我的应用程序日志语句?我使用Python和hadoop流媒体。在

附加问题:

如果要使用文件存储/聚合应用程序日志,例如:

在减速器.py-在

^{pr2}$

(假设我测试日志在我的hadoop集群中master和all slaves的$HOME位置)。我能在这样的环境下实现分布式的Hadoop吗?如果是这样,如何才能做到这一点?在

我尝试了此操作并运行了一个流式处理作业示例,但只看到以下错误:

Error: java.lang.RuntimeException: PipeMapRed.waitOutputThreads(): subprocess failed with code 1
    at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:330)
    at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:543)
    at org.apache.hadoop.streaming.PipeReducer.close(PipeReducer.java:134)
    at org.apache.hadoop.io.IOUtils.cleanup(IOUtils.java:237)
    at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:484)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:397)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:175)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:170)

Container killed by the ApplicationMaster.
Container killed on request. Exit code is 143
Container exited with a non-zero exit code 143

请帮助我理解如何在hadoop流作业中实现日志记录。在

谢谢


Tags: orghadoop应用程序apacheloggingcontainercodejava
2条回答

请尝试以下HDFS路径: /yarn/apps/&;{user_name}/logs/application\${appid}/

一般情况下:

Where to store container logs. An application's localized log directory will be found in ${yarn.nodemanager.log-dirs}/application_${appid}. Individual containers' log directories will be below this, in directories named container_{$contid}. Each container directory will contain the files stderr, stdin, and syslog generated by that container.

如果你打印到stderr,你会在上面提到的这个目录下的文件中找到它。每个节点应该有一个文件。在

您必须知道,Hadoop流式处理使用stdout将数据从映射器传递到reducer。因此,如果您的日志系统使用stdout写入,您将遇到麻烦,因为它很可能会破坏您的逻辑和工作。 记录日志的一种方法是在stderr中写入,因此您将在错误日志中看到您的日志。在

相关问题 更多 >