今天要用mapreduce的wordcount时,yarn配置好了之后,要运行hadoop jar命令报出Container exited with a non-zero exit code 1. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : 错误: 找不到或无法加载主类 org.apache.hadoop.mapred.YarnChild
遇到这个问题首先运行hadoop classpath命令,运行hadoop classpath 命令后,会出现/export/server/hadoop/etc/hadoop:/export/server/hadoop/share/hadoop/common/lib/*:/export/server/hadoop/share/hadoop/common/*:/export/server/hadoop/share/hadoop/hdfs:/export/server/hadoop/share/hadoop/hdfs/lib/*:/export/server/hadoop/share/hadoop/hdfs/*:/export/server/hadoop/share/hadoop/mapreduce/*:/export/server/hadoop/share/hadoop/yarn:/export/server/hadoop/share/hadoop/yarn/lib/*:/export/server/hadoop/share/hadoop/yarn/*这种内容,前面就是你的HADOOP_HOME路径然后复制这些内容到HADOOP_HOME/etc/hadoop/yarn-site.xml 中
对应好name跟value,value值为刚才hadoop classpath运行后输出的内容,之后再用scp命令分发yarn-site.xml到其他从节点上之后再运行wordcount命令即可成功