run a MapReduce job on YARN in a pseudo-distributed mode

配置文件

[root@hadoop hadoop-2.7.4]# cp etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml

etc/hadoop/mapred-site.xml


    
        mapreduce.framework.name
        yarn
    

etc/hadoop/yarn-site.xml




    
        yarn.nodemanager.aux-services
        mapreduce_shuffle
    

启动hdfs和yarn

[root@hadoop hadoop-2.7.4]# start-yarn.sh 
starting yarn daemons
starting resourcemanager, logging to /usr/hadoop/hadoop-2.7.4/logs/yarn-root-resourcemanager-hadoop.out
localhost: starting nodemanager, logging to /usr/hadoop/hadoop-2.7.4/logs/yarn-root-nodemanager-hadoop.out
[root@hadoop hadoop-2.7.4]# jps
13640 NodeManager
13546 ResourceManager
13867 Jps
[root@hadoop hadoop-2.7.4]# start-dfs.sh 
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/hadoop/hadoop-2.7.4/logs/hadoop-root-namenode-hadoop.out
localhost: starting datanode, logging to /usr/hadoop/hadoop-2.7.4/logs/hadoop-root-datanode-hadoop.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/hadoop/hadoop-2.7.4/logs/hadoop-root-secondarynamenode-hadoop.out
[root@hadoop hadoop-2.7.4]# jps
14049 NameNode
14150 DataNode
14343 SecondaryNameNode
13640 NodeManager
13546 ResourceManager
14458 Jps

执行mapreduce


[root@hadoop hadoop-2.7.4]# hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.4.jar grep input output 'dfs[a-z.]+'
......省略一堆输出

检验结果

[root@hadoop hadoop-2.7.4]# hdfs dfs -cat /user/root/output/*
6       dfs.audit.logger
4       dfs.class
3       dfs.server.namenode.
2       dfs.period
2       dfs.audit.log.maxfilesize
2       dfs.audit.log.maxbackupindex
1       dfsmetrics.log
1       dfsadmin
1       dfs.servers
1       dfs.replication
1       dfs.file

你可能感兴趣的:(run a MapReduce job on YARN in a pseudo-distributed mode)