hadoop单机,伪分布搭建运行总结

1. hadoop的搭建

hadoop的搭建可参考文章 http://www.powerxing.com/install-hadoop/,文章比较完整且详细的介绍了单机和伪分布的搭建。


2. mapreduce的学习

mapreduce程序的学习,可参考官方的mapreduce tutorial。同样附上链接http://hadoop.apache.org/docs/r2.8.3/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html

(由于我本地装的是hadoop2.8所以参考的是2.8系列的,别的版本可以参考别的对应版本下的指导文档)


3. 调试遇到的问题总结:

在调试2中的wordcount的程序的时候,遇到了两个问题吧。

(1).   Output directory hdfs://localhost:9000/output2 already exists

执行命令 ./bin/hadoop jar wc.jar WordCount2 /input1 /output2

之后提示  Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:9000/output2 already exists

从报错信息可以看出输出目录output2已经存在了。在hadoop执行mapreduce的输出路径一定要先保证是不存在的,如果存在就会有这样的问题。删除掉./bin/hadoop dfs -rm -r output2之后,就成功了。

(2).   Input path does not exist: hdfs://localhost:9000/input1

在执行命令./bin/hadoop jar wc.jar WordCount2 /input1 /output2之后提示出了这样的一个错误。

使用./bin/hadoop dfs -ls查看确实存在了input1文件,那提示这样的原因是什么呢?原来是命令的路径前不用加 /,可能hdfs文件系统不需要加/吧。

所以命令改成 ./bin/hadoop jar wc.jar WordCount2 input1 output2  这样再执行后,成功。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容