运行 mapreduce 程序,MapReduce 程序打成 jar 包运行在 YARN 上
创建文件
vi /opt/datas/wc.input
创建 hdfs 文件夹
bin/hdfs dfs -mkdir -p mapreduce/wordcount/input
将本地文件上传到 hdfs 中
bin/hdfs dfs -put /opt/datas/wc.input /user/beifeng/mapreduce/wordcount/input
- 输出目录不需要手动创建,但不允许存在:
bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.0.jar wordcount
/user/beifeng/mapreduce/wordcount/input /user/beifeng/mapreduce/wordcount/output
- 查看运行结果
bin/hdfs dfs -text /user/beifeng/mapreduce/wordcount/output/part*