我正在尝试学习 hadoop,我正在学习 pluralsight 的“hadoop 构建 block ”类(class),我正在尝试通过伪分布式模式运行 hadoop,当我运行以下命令时:
bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.3.jar grep 输入输出 '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
另外:sbin/start-all.sh 中的所有进程都在运行。操作系统是 ubuntu,但通过 Windows 10 计算机上的虚拟机运行。 hadoop版本是3.0.3
最佳答案
当它说
${您的 hadoop 分发目录的完整路径}
1) 你需要保证路径在Hadoop集群中的每台机器上都是相同的
2) 完整路径表示路径中没有~/
关于linux - hadoop 配置 : couldn load or find main class org. apache.hadoop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51062192/