hadoop学习(5)—— 伪分布下运行一个简单的实例

1.创建目录

[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -mkdir /user
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -mkdir /user/cyhp
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -mkdir /user/cyhp/input
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -ls -R /
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -put etc/hadoop/*.xml /user/cyhp/input
[root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -ls /user/cyhp/input

2.本地运行,注销mapred-site.xml中关于yarn的配置


        
        

3.运行,

    [root@hadoop-yarn hadoop-2.6.5]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.5.jar grep /user/cyhp/input /user/cyhp/output 'dfs[a-z.]+'

4.下载运行结果

    [root@hadoop-yarn hadoop-2.6.5]# bin/hdfs dfs -get /user/cyhp/output/part* . 

5.获取运行结果

[root@hadoop-yarn hadoop-2.6.5]# cat part-r-00000 
1   dfsadmin
1   dfs.replication

你可能感兴趣的:(hadoop,hadoop,实例)