我是 Hadoop 的新手。我只是以独立模式运行我的 hadoop 应用程序。它工作得很好。我现在决定将其移至伪分布式模式。我如前所述进行了配置更改。显示了我的 xml 文件的片段:
我的 core-site.xml 如下所示:
<name>fs.default.name</name>
<value>hdfs://localhost/</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/tmp/hadoop-onur</value>
<description>A base for other temporary directories.</description>
</property>
我的 hdfs-site.xml 是
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
我的 mapred.xml 是
<property>
<name>mapred.job.tracker</name>
<value>localhost:8021</value>
</property>
我运行了 start-dfs.sh 和 start-mapred.sh 的脚本,它开始正常
root@vissu-desktop:/home/vissu/Raveesh/Hadoop# start-dfs.sh
starting namenode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-namenode-vissu-desktop.out
localhost: starting datanode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-datanode-vissu-desktop.out
localhost: starting secondarynamenode, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-secondarynamenode-vissu-desktop.out
root@vissu-desktop:/home/vissu/Raveesh/Hadoop# start-mapred.sh
starting jobtracker, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-jobtracker-vissu-desktop.out
localhost: starting tasktracker, logging to /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/bin/../logs/hadoop-root-tasktracker-vissu-desktop.out
root@vissu-desktop:/home/vissu/Raveesh/Hadoop#
现在我尝试运行我的应用程序:但出现以下错误。
root@vissu-desktop:/home/vissu/Raveesh/Hadoop/hadoop-0.20.2# hadoop jar ResultAgg_plainjar.jar ProcessInputFile /home/vissu/Raveesh/VotingConfiguration/sample.txt
ARG 0 obtained = ProcessInputFile
12/07/17 17:43:33 INFO preprocessing.ProcessInputFile: Modified File Name is /home/vissu/Raveesh/Hadoop/hadoop-0.20.2/sample.txt_modf
Going to process map reduce jobs
12/07/17 17:43:33 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
12/07/17 17:43:34 ERROR preprocessing.ProcessInputFile: Input path does not exist: hdfs://localhost/home/vissu/Raveesh/Hadoop/hadoop-0.20.2/sample.txt_modf
root@vissu-desktop:/home/vissu/Raveesh/Hadoop/hadoop-0.20.2#
应用程序最初从路径中获取一个文件,然后对其进行修改并创建一个 sample.txt_modf,该文件必须由 map reduce 框架使用。在独立模式下运行时,我给出了绝对路径,因此很好。但我无法弄清楚应该在路径 api 中为 hadoop 指定的路径是什么。如果我提供文件,它会添加 hdfs://localhost/ ..所以我不确定如何在伪分布式模式..我应该简单地确保在该位置创建修改后的文件..
我的查询是关于如何提及路径..
包含路径的片段是
KeyValueTextInputFormat.addInputPath(conf,
new Path(System.getProperty("user.dir")+File.separator+inputFileofhits.getName()));
FileOutputFormat.setOutputPath(
conf,
new Path(ProcessInputFile.resultAggProps
.getProperty("OUTPUT_DIRECTORY")));
谢谢