MapReduce+Yarn
部署Yarn:
ResourceManager
NodeManager
1.Yarn部署
[root@hadoop02 hadoop]# cp mapred-site.xml.template mapred-site.xml
[root@hadoop02 hadoop]# vi mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
[root@hadoop02 hadoop]# vi yarn-site.xml
<?xml version="1.0"?>
<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
~
[root@hadoop02 hadoop]# chown hadoop:hadoop *
[root@hadoop02 hadoop]# su - hadoop
[hadoop@hadoop02 ~]$
[hadoop@hadoop02 ~]$ cd /opt/software/hadoop
[hadoop@hadoop02 hadoop]$
[hadoop@hadoop02 hadoop]$ sbin/start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /opt/software/hadoop-2.8.1/logs/yarn-hadoop-resourcemanager-rzdatahadoop002.out
hadoop002: starting nodemanager, logging to /opt/software/hadoop-2.8.1/logs/yarn-hadoop-nodemanager-rzdatahadoop002.out
[hadoop@hadoop02 hadoop]$
web界面: http://192.168.137.201:8088/
2.MR Job测试
MapReduce: java代码写的,map(映射)函数和reduce(归约)函数
[hadoop@hadoop02 hadoop]$ find ./ -name "*example*"
./share/hadoop/mapreduce/lib-examples
./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.1.jar
./share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.8.1-sources.jar
./share/hadoop/mapreduce/sources/hadoop-mapreduce-examples-2.8.1-test-sources.jar
./lib/native/examples
./etc/hadoop/ssl-client.xml.example
./etc/hadoop/ssl-server.xml.example
[hadoop@rhadoop02 hadoop]$
[hadoop@hadoop02 hadoop]$ bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.1.jar pi 5 10
3.停止Yarn
[hadoop@hadoop02 sbin]$ ll
total 92
-rwxr-xr-x. 1 hadoop hadoop 2752 Dec 10 11:54 distribute-exclude.sh
-rwxr-xr-x. 1 hadoop hadoop 6465 Dec 10 11:54 hadoop-daemon.sh
-rwxr-xr-x. 1 hadoop hadoop 1360 Dec 10 11:54 hadoop-daemons.sh
-rwxr-xr-x. 1 hadoop hadoop 1427 Dec 10 11:54 hdfs-config.sh
-rwxr-xr-x. 1 hadoop hadoop 2291 Dec 10 11:54 httpfs.sh
-rwxr-xr-x. 1 hadoop hadoop 3719 Dec 10 11:54 kms.sh
-rwxr-xr-x. 1 hadoop hadoop 4080 Dec 10 11:54 mr-jobhistory-daemon.sh
-rwxr-xr-x. 1 hadoop hadoop 1648 Dec 10 11:54 refresh-namenodes.sh
-rwxr-xr-x. 1 hadoop hadoop 2145 Dec 10 11:54 slaves.sh
-rwxr-xr-x. 1 hadoop hadoop 1471 Dec 10 11:54 start-all.sh
-rwxr-xr-x. 1 hadoop hadoop 1128 Dec 10 11:54 start-balancer.sh
-rwxr-xr-x. 1 hadoop hadoop 3734 Dec 10 11:54 start-dfs.sh
-rwxr-xr-x. 1 hadoop hadoop 1357 Dec 10 11:54 start-secure-dns.sh
-rwxr-xr-x. 1 hadoop hadoop 1347 Dec 10 11:54 start-yarn.sh
-rwxr-xr-x. 1 hadoop hadoop 1462 Dec 10 11:54 stop-all.sh
-rwxr-xr-x. 1 hadoop hadoop 1179 Dec 10 11:54 stop-balancer.sh
-rwxr-xr-x. 1 hadoop hadoop 3206 Dec 10 11:54 stop-dfs.sh
-rwxr-xr-x. 1 hadoop hadoop 1340 Dec 10 11:54 stop-secure-dns.sh
-rwxr-xr-x. 1 hadoop hadoop 1340 Dec 10 11:54 stop-yarn.sh
-rwxr-xr-x. 1 hadoop hadoop 4295 Dec 10 11:54 yarn-daemon.sh
-rwxr-xr-x. 1 hadoop hadoop 1353 Dec 10 11:54 yarn-daemons.sh
[hadoop@hadoop02 sbin]$
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31496956/viewspace-2148957/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31496956/viewspace-2148957/