[root@hadoop01 ~]# vim /usr/local/hadoop-2.7.1/etc/hadoop/yarn-site.xml
<!– Site specific YARN configuration properties –>
<property>
<name>yarn.nodemanager.aux-services</name>
<!–注意:这里是下滑线–>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.ha.enabled</name>
<value>true</value>
</property>
<!–失败转移默认开启–>
<property>
<name>yarn.resourcemanager.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.resourcemanager.cluster-id</name>
<value>qianfengyarn</value>
</property>
<property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>rm1,rm2</value>
</property>
<property>
<name>yarn.resourcemanager.hostname.rm1</name>
<value>hadoop01</value>
</property>
<property>
<name>yarn.resourcemanager.hostname.rm2</name>
<value>hadoop02</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm1</name>
<value>hadoop01:8088</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm2</name>
<value>hadoop02:8088</value>
</property>
<property>
<name>yarn.resourcemanager.zk-address</name>
<value>hadoop01:2181,hadoop02:2181,hadoop03:2181</value>
</property>
[root@hadoop01 hadoop-2.7.1]# vim ./etc/hadoop/mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
<final>true</final>
</property>
<property>
<name>mapreduce.map.memory.mb</name>
<value>1024</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop01:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>hadoop01:19888</value>
</property>
发送到集群服务器
[root@hadoop01 hadoop-2.7.1]# scp -r ./etc/hadoop/mapred-site.xml hadoop02:/usr/local/hadoop-2.7.1/etc/hadoop/
mapred-site.xml 100% 1218 1.2KB/s 00:00
[root@hadoop01 hadoop-2.7.1]# scp -r ./etc/hadoop/mapred-site.xml hadoop03:/usr/local/hadoop-2.7.1/etc/hadoop/
mapred-site.xml 100% 1218 1.2KB/s 00:00
[root@hadoop01 hadoop-2.7.1]# scp -r ./etc/hadoop/yarn-site.xml hadoop03:/usr/local/hadoop-2.7.1/etc/hadoop/
yarn-site.xml 100% 1845 1.8KB/s 00:00
[root@hadoop01 hadoop-2.7.1]# scp -r ./etc/hadoop/yarn-site.xml hadoop02:/usr/local/hadoop-2.7.1/etc/hadoop/
yarn-site.xml
[root@hadoop01 hadoop-2.7.1]# start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop-2.7.1/logs/yarn-root-resourcemanager-hadoop01.out
hadoop01: starting nodemanager, logging to /usr/local/hadoop-2.7.1/logs/yarn-root-nodemanager-hadoop01.out
hadoop03: starting nodemanager, logging to /usr/local/hadoop-2.7.1/logs/yarn-root-nodemanager-hadoop03.out
hadoop02: starting nodemanager, logging to /usr/local/hadoop-2.7.1/logs/yarn-root-nodemanager-hadoop02.out
[root@hadoop02 sbin]# yarn-daemon.sh start resourcemanager
starting resourcemanager, logging to /usr/local/hadoop-2.7.1/logs/yarn-root-resourcemanager-hadoop02.out
查看ResourceManager状态
[root@hadoop01 hadoop-2.7.1]# yarn rmadmin -getServiceState rm1
18/01/13 16:17:56 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
active
[root@hadoop02 sbin]# yarn rmadmin -getServiceState rm2
18/01/13 16:20:51 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable
standby
[root@hadoop01 ~]# start-all.sh
[root@hadoop01 ~]# service ntpd start
集群所有机器开启zookeeper,zkServer.sh start
[root@hadoop01 ~]# yarn-daemon.sh start resourcemanager
[root@hadoop01 ~]# start-dfs.sh
所有的进程必须都有,请仔细核对
[root@hadoop01 logs]# jps
8608 JobHistoryServer
16833 DataNode
3155 QuorumPeerMain
17300 ResourceManager
17463 Jps
16727 NameNode
17210 DFSZKFailoverController
17423 NodeManager
17055 JournalNode
[root@hadoop02 ~]# jps
9472 DFSZKFailoverController
7108 ResourceManager
9254 DataNode
9719 Jps
9353 JournalNode
9566 NodeManager
9183 NameNode
2751 QuorumPeerMain
[root@hadoop03 ~]# jps
2546 QuorumPeerMain
6738 Jps
6503 JournalNode
6408 DataNode
6606 NodeManager
8608 JobHistoryServer
[root@hadoop01 logs]# mr-jobhistory-daemon.sh stop historyserver
[root@hadoop01 logs]# mr-jobhistory-daemon.sh start historyserver
7108 ResourceManager
[root@hadoop02 ~]# stop-yarn.sh
stopping yarn daemons
stopping resourcemanager
hadoop02: no nodemanager to stop
hadoop01: no nodemanager to stop
hadoop03: no nodemanager to stop
no proxyserver to stop
[root@hadoop02 sbin]# yarn-daemon.sh start resourcemanager
[root@hadoop02 ~]# hadoop-daemon.sh start namenode
starting namenode, logging to /usr/local/hadoop-2.7.1/logs/hadoop-root-namenode-hadoop02.out
测试
hadoop jar /usr/local/hadoop-2.7.1/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.jar wordcount /README.txt /out/05
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/194086.html