猪错误尝试Edureka的教程

时间:2018-01-09 18:57:45

标签: hadoop hdfs apache-pig

我一直在尝试运行hadoop和PIG等其他组件。

我正在尝试本教程: https://www.edureka.co/blog/pig-programming-create-your-first-apache-pig-script/

一切都是正确的,但是当我在第2步运行脚本时,会抛出此错误:

2018-01-09 13:47:20,682 [JobControl] INFO  org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob - PigLatin:output.pig got an error while submitting 
org.apache.pig.backend.executionengine.ExecException: ERROR 2118: Input path does not exist: hdfs://localhost:9000/carlos/information.txt
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigInputFormat.getSplits(PigInputFormat.java:279)
    at org.apache.hadoop.mapreduce.JobSubmitter.writeNewSplits(JobSubmitter.java:301)
    at org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(JobSubmitter.java:318)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:196)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1290)
    at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1287)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1287)
    at org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.submit(ControlledJob.java:335)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.pig.backend.hadoop23.PigJobControl.submit(PigJobControl.java:128)
    at org.apache.pig.backend.hadoop23.PigJobControl.run(PigJobControl.java:194)
    at java.lang.Thread.run(Thread.java:748)
    at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher$1.run(MapReduceLauncher.java:276)

1 个答案:

答案 0 :(得分:0)

在步骤1之前,您需要此命令

hadoop fs –copyFromLocal /home/carlos/information.txt /carlos

但是,如果该目录尚未存在,则会将您的文件复制到HDFS上名为/carlos文件

如果您希望/carlos成为目录,则需要删除该文件并将其设为

hadoop fs -rm /carlos
hadoop fs -mkdir /carlos

此外,在将文件复制到目录时,通常应使用尾部斜杠,如此

hadoop fs –copyFromLocal /home/carlos/information.txt /carlos/

您也可以将Pig代码加载/carlos作为文件。即使它是一个目录,这仍然可以读取那里的所有文件