run a MapReduce job on YARN in a

2017-09-24  本文已影响0人  tonyemail_st

配置文件

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

etc/hadoop/mapred-site.xml

<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
</configuration>

etc/hadoop/yarn-site.xml

<configuration>

<!-- Site specific YARN configuration properties -->
    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
</configuration>

启动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
上一篇 下一篇

猜你喜欢

热点阅读