【发布时间】:2018-06-27 21:28:41
【问题描述】:
我正在尝试学习 hadoop,我正在学习来自复数视觉的“hadoop 的构建块”课程,当我运行以下命令时,我正在尝试通过伪分布式模式运行 hadoop:
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.3.jar grep input output 'dfs[a-z.]+'
我得到以下输出:
Application application_1530031734419_0001 failed 2 times due to AM Container for appattempt_1530031734419_0001_000002 exited with exitCode: 1
Failing this attempt.Diagnostics: [2018-06-26 16:50:21.067]Exception from container-launch.
Container id: container_1530031734419_0001_02_000001
Exit code: 1
[2018-06-26 16:50:21.076]Container exited with a non-zero exit code 1. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
Please check whether your etc/hadoop/mapred-site.xml contains the below configuration:
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
[2018-06-26 16:50:21.077]Container exited with a non-zero exit code 1. Error file: prelaunch.err.
Last 4096 bytes of prelaunch.err :
Last 4096 bytes of stderr :
Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
Please check whether your etc/hadoop/mapred-site.xml contains the below configuration:
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
For more detailed output, check the application tracking page: http://homestead:8088/cluster/app/application_1530031734419_0001 Then click on links to logs of each attempt.
. Failing the application.
我已经尝试关注这个日志,也搜索过类似的问题,基本上看起来错误是在一些配置文件中,所以他们在这里:
mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=~/hadoop-install/hadoop-3.0.3</value>
</property>
<property>
<name>mapreduce.application.classpath</name>
<value>$HADOOP_MAPRED_HOME/,$HADOOP_MAPRED_HOME/lib/,$MR2_CLASS</value>
</property>
</configuration>
hadoop-env.sh //因为这个文件很大,我只带了我从默认文件中改变的东西
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export HADOOP_HOME=~/hadoop-install/hadoop-3.0.3
export YARN_HOME=$HADOOP_HOME
plus:来自 sbin/start-all.sh 的所有进程都在运行。操作系统是 ubuntu,但通过 Windows 10 计算机上的虚拟机运行。 hadoop 版本是 3.0.3
【问题讨论】: