Java hadoop流,使用-libjars包含jar文件

Java hadoop流,使用-libjars包含jar文件,java,python,hadoop,hadoop-streaming,Java,Python,Hadoop,Hadoop Streaming,我正在学习hadoop,并编写了map/reduce步骤来处理我的一些avro文件。我认为我遇到的问题可能是由于我安装了hadoop。我试图在笔记本电脑上以独立模式进行测试,而不是在分布式集群上 下面是我运行作业的bash调用: #!/bin/bash reducer=/home/hduser/python-hadoop/test/reducer.py mapper=/home/hduser/python-hadoop/test/mapper.py avrohdjar=/home/hdus

我正在学习hadoop,并编写了map/reduce步骤来处理我的一些avro文件。我认为我遇到的问题可能是由于我安装了hadoop。我试图在笔记本电脑上以独立模式进行测试,而不是在分布式集群上

下面是我运行作业的bash调用:

#!/bin/bash

reducer=/home/hduser/python-hadoop/test/reducer.py  
mapper=/home/hduser/python-hadoop/test/mapper.py
avrohdjar=/home/hduser/python-hadoop/test/avro-mapred-1.7.4-hadoop1.jar
avrojar=/home/hduser/hadoop/share/hadoop/tools/lib/avro-1.7.4.jar


hadoop jar ~/hadoop/share/hadoop/tools/lib/hadoop-streaming* \
  -D mapreduce.job.name="hd1" \
  -libjars ${avrojar},${avrohdjar} \ 
  -files   ${avrojar},${avrohdjar},${mapper},${reducer} \
  -input   ~/tmp/data/* \
  -output  ~/tmp/data-output \
  -mapper  ${mapper} \
  -reducer ${reducer} \
  -inputformat org.apache.avro.mapred.AvroAsTextInputFormat
以下是输出:

15/04/23 11:02:54 INFO Configuration.deprecation: session.id is
deprecated. Instead, use dfs.metrics.session-id
15/04/23 11:02:54 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
15/04/23 11:02:54 INFO jvm.JvmMetrics: Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized
15/04/23 11:02:54 INFO mapreduce.JobSubmitter: Cleaning up the staging area file:/home/hduser/tmp/mapred/staging/hduser1337717111/.staging/job_local1337717111_0001
15/04/23 11:02:54 ERROR streaming.StreamJob: Error launching job , bad input path : File does not exist: hdfs://localhost:54310/home/hduser/hadoop/share/hadoop/tools/lib/avro-1.7.4.jar
Streaming Command Failed!
我尝试了很多不同的修复方法,但不知道下一步要尝试什么。由于某些原因,hadoop找不到-libjars指定的jar文件。此外,我已经成功地运行了发布的wordcount示例,因此我的hadoop安装或配置可以很好地实现这一点。谢谢

编辑 下面是我的hdfs-site.xml内容的更改

<property>
  <name>dfs.replication</name>
  <value>1</value>
  <description>Default block replication.
   The actual number of replications can be specified when the file is created.
  The default is used if replication is not specified in create time.
  </description>
</property>

dfs.replication
1.
默认块复制。
创建文件时,可以指定实际的复制次数。
如果在创建时未指定复制,则使用默认值。
下面是core-site.xml

<property>
  <name>hadoop.tmp.dir</name>
  <value>/home/hduser/tmp</value>
  <description>A base for other temporary directories.</description>
</property>

<property>
  <name>fs.default.name</name>
  <value>hdfs://localhost:54310</value>
  <description>The name of the default file system.  A URI whose
  scheme and authority determine the FileSystem implementation.  The
  uri's scheme determines the config property (fs.SCHEME.impl) naming
  the FileSystem implementation class.  The uri's authority is used to
  determine the host, port, etc. for a filesystem.</description>
</property>

hadoop.tmp.dir
/主页/hduser/tmp
其他临时目录的基础。
fs.default.name
hdfs://localhost:54310
默认文件系统的名称。其
方案和权限决定文件系统的实现。这个
uri的方案决定了配置属性(fs.scheme.impl)的命名
文件系统实现类。uri的权限用于
确定文件系统的主机、端口等。

您的群集正在分布式模式下运行。它试图在以下路径中查找输入,但该路径不存在

hdfs://localhost:54310/home/hduser/hadoop/share/hadoop/tools/lib/avro-1.7.4.jar

哦,嗯。我按照本教程(最上面的答案)进行了设置:如何将其更改为非分布式模式?还有,检查我运行的是哪种模式的方法?您可以检查core-site.xml和hdfs-site.xml并将其发布到这里吗。它将指向指向hdfs:///的文件系统。如果您想在独立模式下运行,它应该是file://。。。检查一下这个。改变hdfs://.... 到文件:///已修复它。现在我有新的错误要修复。非常感谢。