Mapreduce运行异常Container exited with a non-zero exit code 1

用idea编写mapreduce读写hbase,并打包jar放到集群服务器上运行时出现下面错误:

[2019-01-05 04:03:01.278]Container exited with a non-zero exit code 1. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
log4j:WARN No appenders could be found for logger (org.apache.hadoop.mapreduce.v2.app.MRAppMaster).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


For more detailed output, check the application tracking page: http://slave1:8088/cluster/app/application_1546695649125_0002 Then click on links to logs of each attempt.

解决方案:

先进入:http://slave1:8042/logs/userlogs这个地址,其中slave1为resourcemanager的服务器,然后进入错误信息里提到的jobid的日志。

Mapreduce运行异常Container exited with a non-zero exit code 1_第1张图片

点开【syslog】,可以看到详细的mapreduce运行过程的日志信息,在当中可以找到下面这个异常信息。

org.apache.hadoop.mapreduce.v2.app.client.MRClientService: Webapps failed to start. Ignoring for now: java.lang.NullPointerException

通过排查发现是新版本的hadoop的yarn中需要配置上正面的内容,于是在yarn-site.xml添加正面内容:


    
        yarn.resourcemanager.webapp.address.rm1
        master
    
    
        yarn.resourcemanager.scheduler.address.rm2
        slave1
    
    
        yarn.resourcemanager.webapp.address.rm2
        slave1
    

保存完同时覆盖集群其他节点上的这个文件,最后重启yarn再启动mapreduce应用,成功运行。

你可能感兴趣的:(大数据架构)