主要是查看一些节点的历史信息和日志的一篇博客。

1. 修改mapred-site.xml

[root@hadoop102 hadoop-2.10.0]# vim etc/hadoop/mapred-site.xml
<configuration>
<!--指定mr运行在yarn上-->
<property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
</property>
<!-- 历史服务器端地址-->
<property>
        <name>mapreduce.jobhistory.address</name>
        <value>hadoop104:10020</value>
</property>

<!-- 历史服务器web端地址 -->
<property>
        <name>mapreduce.jobhistory.webapp.address</name>
        <value>hadoop104:19888</value>
</property>
</configuration>

2. 配置日志聚集

[root@hadoop102 hadoop-2.10.0]# vim etc/hadoop/yarn-site.xml
<configuration>

<!-- Site specific YARN configuration properties -->

<!-- reducer获取数据的方式-->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- 指定YARN的ResourceManager的地址-->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>hadoop103</value>
</property>
<!--日志聚集功能使用-->
<property>
        <name>yarn.log-aggregation-enable</name>
        <value>true</value>
</property>

<!--日志保留时间设置7天-->
<property>
        <name>yarn.log-aggregation.retain-seconds</name>
        <value>604800</value>
</property>
</configuration>

3. 同步

xsync etc/

4. 启动

102:

[root@hadoop102 hadoop-2.10.0]# start-dfs.sh 
Starting namenodes on [hadoop102]
hadoop102: starting namenode, logging to /opt/module/hadoop-2.10.0/logs/hadoop-root-namenode-hadoop102.out
hadoop102: starting datanode, logging to /opt/module/hadoop-2.10.0/logs/hadoop-root-datanode-hadoop102.out
hadoop103: datanode running as process 3157. Stop it first.
hadoop104: datanode running as process 3414. Stop it first.
Starting secondary namenodes [hadoop104]
hadoop104: starting secondarynamenode, logging to /opt/module/hadoop-2.10.0/logs/hadoop-root-secondarynamenode-hadoop104.out

103:

root@hadoop103 hadoop-2.10.0]# start-yarn.sh 
starting yarn daemons
starting resourcemanager, logging to /opt/module/hadoop-2.10.0/logs/yarn-root-resourcemanager-hadoop103.out
hadoop103: starting nodemanager, logging to /opt/module/hadoop-2.10.0/logs/yarn-root-nodemanager-hadoop103.out
hadoop104: starting nodemanager, logging to /opt/module/hadoop-2.10.0/logs/yarn-root-nodemanager-hadoop104.out
hadoop102: starting nodemanager, logging to /opt/module/hadoop-2.10.0/logs/yarn-root-nodemanager-hadoop102.out

104启动history服务:

[root@hadoop104 hadoop-2.10.0]# mr-jobhistory-daemon.sh start historyserver
starting historyserver, logging to /opt/module/hadoop-2.10.0/logs/mapred-root-historyserver-hadoop104.out

5. 运行一个例子

[root@hadoop102 hadoop-2.10.0]# hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.10.0.jar wordcount /wcinput /ooooo

6. web端查看

http://hadoop103:8088/cluster/apps

点击history,就可以查看一些历史信息。