在单个节点上安装Hadoop 2.2后,我尝试使用命令运行Scalding教程,第1部分:
$ yarn jar target/scalding-tutorial-0.8.11.jar Tutorial0 --hdfs
https://github.com/Cascading/scalding-tutorial/
在运行教程之前,我已将所需文件hello.txt
复制到HDFS:
$ hdfs dfs -ls /data
Found 2 items
drwxr-xr-x - hdfs hdfs 0 2014-02-04 16:35 /data/10gsort
-rw-r--r-- 3 hdfs hdfs 26 2014-07-03 15:07 /data/hello.txt
看起来教程无法找到输入文件:
Exception in thread "main" com.twitter.scalding.InvalidSourceException:[TextLine(data/hello.txt)] Data is missing from one or more paths in: List(data/hello.txt)
at com.twitter.scalding.FileSource.validateTaps(FileSource.scala:102)
at com.twitter.scalding.Job$$anonfun$validateSources$1.apply(Job.scala:158)
at com.twitter.scalding.Job$$anonfun$validateSources$1.apply(Job.scala:153)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at com.twitter.scalding.Job.validateSources(Job.scala:153)
at com.twitter.scalding.Job.buildFlow(Job.scala:91)
at com.twitter.scalding.Job.run(Job.scala:126)
at com.twitter.scalding.Tool.start$1(Tool.scala:109)
at com.twitter.scalding.Tool.run(Tool.scala:125)
at com.twitter.scalding.Tool.run(Tool.scala:72)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at JobRunner$.main(JobRunner.scala:27)
at JobRunner.main(JobRunner.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
任何想法如何使其发挥作用?
答案 0 :(得分:0)
TextLine最终根据给定的路径和配置构建Hadoop路径。
Hadoop Path API显示“路径字符串是绝对的,如果它以斜杠开头。”
教程我将输入修复为“data / hello.txt”,实际上以相对路径结束。将添加当前工作目录以形成绝对且可靠的路径。