Hadoop 预装示例 Jars

标签 hadoop error-handling terminal

我刚刚在本地机器上成功设置了 Hadoop。我正在关注我刚买的一本畅销书中的一个例子。我正在尝试获取安装附带的所有 hadoop 示例的列表。为此,我键入以下命令:

bin/hadoop jar hadoop-*-examples.jar

输入此内容后,我应该会得到一个 Hadoop 示例列表,对吗?然而,我所看到的只是这条错误信息:

Not a valid JAR: /home/user/hadoop/hadoop-*-examples.jar

我该如何解决这个问题?这只是一个简单的权限问题吗?

最佳答案

这很可能是配置问题或使用了无效的文件路径。

很可能 hadoop-*-examples.jar 的名称不正确,因为在我的 Hadoop (1.0.0) 版本中,文件名是 hadoop-examples-1.0.0.jar。

所以我运行了以下命令来列出所有示例,它就像魅力一样:

bin/hadoop jar hadoop-examples-*.jar 

An example program must be given as the first argument.
Valid program names are:
  aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files.
  aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files.
  dbcount: An example job that count the pageview counts from a database.
  grep: A map/reduce program that counts the matches of a regex in the input.
  join: A job that effects a join over sorted, equally partitioned datasets
  multifilewc: A job that counts words from several files.
  pentomino: A map/reduce tile laying program to find solutions to pentomino problems.
  pi: A map/reduce program that estimates Pi using monte-carlo method.
  randomtextwriter: A map/reduce program that writes 10GB of random textual data per node.
  randomwriter: A map/reduce program that writes 10GB of random data per node.
  secondarysort: An example defining a secondary sort to the reduce.
  sleep: A job that sleeps at each map and reduce task.
  sort: A map/reduce program that sorts the data written by the random writer.
  sudoku: A sudoku solver.
  teragen: Generate data for the terasort
  terasort: Run the terasort
  teravalidate: Checking results of terasort
  wordcount: A map/reduce program that counts the words in the input files.

此外,如果我使用与您相同的文件名模式,我会收到错误消息:

bin/hadoop jar hadoop-*examples.jar 

Exception in thread "main" java.io.IOException: Error opening job jar: hadoop-*examples.jar

HTH

关于Hadoop 预装示例 Jars,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18808895/

相关文章:

hadoop - 普通身份验证失败 : User yarn is not configured for any impersonation. impersonationUser:alluxio mapreduce 中的 root

java - Hadoop如何在 "real-time"针对非陈旧数据运行?

linux - 如何截取终端的屏幕截图

macos - 如何在 MAC OS 上使用终端将多个 CSV 文件合并为一个?

Linux 终端鼠标报告——基本问题

java - 如何将此旧的api mapreduce作业代码转换为新的mapreduce

java - Hadoop 在从 Spring 批处理管理员启 Action 业时获取连接被拒绝的异常

angular - rxjs 错误处理 > 在 catchError 源上停止发射

java - 如何从Spring云流kafka中的ErrorMessage中的有效负载获取failedMessage?

r - 制作向量图时导致错误 "Z matrix not specified"的原因是什么