第一个word程序

来源:互联网 发布:eve mac 外服 编辑:程序博客网 时间:2024/05/14 13:50

测试mapreduce程序
第一步:创建一个wc.input文件
hadoop hadoop
hello world hello world world
hive hive hive hive hive
spark apark hadoop

第二步:上传wc.input到hdfs
hdfsdfsmkdir/fangtaoma/input hdfs dfs -put wc.input /nicole/input

第三步:运行mapreduce任务
$ hadoop jar /opt/modules/hadoop-2.5.0/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.0.jar wordcount /nicole/input/wc.input /nicole/output1

注意:
如果再次运行此任务,那么需要更换一个新的目录,或者
将原来的输出目录删除,否则会报错:
Output directory hdfs://nicole02.com.cn:8020/nicole/output1 already exists

0 0