VMWare 上的 Hadoop - Mapreduce 示例程序运行失败

VMWare 上的 Hadoop - Mapreduce 示例程序运行失败

我正在尝试在 Win10 上以 VM 形式运行的 Ubuntu 18.10 上运行 hadoop 3.2.0。想要执行示例字数统计程序来验证安装是否成功以及 hadoop 是否已正确配置。

当我尝试使用命令运行包含的示例 jar 时:

bharath@ubuntu:/usr/share/hadoop$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.2.0.jar grep 输入输出'dfs[az.]+'

我在终端上得到这个:

2019-05-05 11:51:55,667 INFO impl.MetricsConfig: Loaded properties from hadoop-metrics2.properties
2019-05-05 11:51:55,873 INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s).
2019-05-05 11:51:55,873 INFO impl.MetricsSystemImpl: JobTracker metrics system started
2019-05-05 11:51:56,020 INFO mapreduce.JobSubmitter: Cleaning up the staging area file:/tmp/hadoop/mapred/staging/bharath705403707/.staging/job_local705403707_0001
ENOENT: No such file or directory
    at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmodImpl(Native Method)
    at org.apache.hadoop.io.nativeio.NativeIO$POSIX.chmod(NativeIO.java:234)
    at org.apache.hadoop.fs.RawLocalFileSystem.setPermission(RawLocalFileSystem.java:861)
    at org.apache.hadoop.fs.ChecksumFileSystem$1.apply(ChecksumFileSystem.java:508)
    at org.apache.hadoop.fs.ChecksumFileSystem$FsOperation.run(ChecksumFileSystem.java:489)
    at org.apache.hadoop.fs.ChecksumFileSystem.setPermission(ChecksumFileSystem.java:511)
    at org.apache.hadoop.fs.FileSystem.mkdirs(FileSystem.java:676)
    at org.apache.hadoop.mapreduce.JobResourceUploader.mkdirs(JobResourceUploader.java:658)
    at org.apache.hadoop.mapreduce.JobResourceUploader.uploadResourcesInternal(JobResourceUploader.java:172)
    at org.apache.hadoop.mapreduce.JobResourceUploader.uploadResources(JobResourceUploader.java:133)
    at org.apache.hadoop.mapreduce.JobSubmitter.copyAndConfigureFiles(JobSubmitter.java:99)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:194)
    at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570)
    at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567)
    at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588)
    at org.apache.hadoop.examples.Grep.run(Grep.java:78)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.apache.hadoop.examples.Grep.main(Grep.java:103)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:71)
    at org.apache.hadoop.util.ProgramDriver.run(ProgramDriver.java:144)
    at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:323)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:236)

我对 Hadoop 甚至 Java 都很陌生,所以除了程序无法运行并且某些文件可能丢失之外,我无法理解这一切意味着什么。

有人能指出这里的问题是什么或者提出建议来找出导致该问题的原因吗?

答案1

该命令似乎有错误。语法为:hadoop jar jar-file class-with-Main input-file-hdfs output-dir-hdfs
输出目录不能预先存在

前任:

hadoop jar /opt/mapr/hadoop/hadoop-0.20.2/hadoop-0.20.2-dev-examples.jar 字数 /myvolume/in /myvolume/out

答案2

关键是输入文件的位置在 hdfs 上,而不是在本地硬盘上(在您的计算机上)。因此,您输入的地址是错误的,您应该:首先使用其命令将输入​​文件放在 hdfs 上。其次运行正确的命令来执行该文件。BR,Neda

相关内容