配置日志的聚集
1.配置 yarn-site.xm
[admin@hadoop1002 hadoop-3.1.3]$ vim etc/hadoop/yarn-site.xml
编辑如下
<!-- 开启日志聚集功能 -->
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value> </property>
<!-- 设置日志聚集服务器地址 -->
<property>
<name>yarn.log.server.url</name>
<value>http://hadoop1002:19888/jobhistory/lo
gs</value>
</property>
<!-- 设置日志保留时间为 7 天 -->
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>604800</value>
</property>
2.分发配置
[admin@hadoop1002 hadoop-3.1.3]$ cd etc/hadoop/
[admin@hadoop1002 hadoop]$ xsync yarn-site.xml
3.关闭 NodeManager 、ResourceManager 和 HistoryServer
[admin@hadoop1003 hadoop-3.1.3]$ sbin/stop-yarn.sh
[admin@hadoop1002 hadoop-3.1.3]$ bin/mapred --daemon stop historyserver
4.启动 NodeManager 、ResourceManage 和 HistoryServer
[admin@hadoop1003 hadoop-3.1.3]$ sbin/start-yarn.sh
[admin@hadoop1002 hadoop-3.1.3]$ bin/mapred --daemon start historyserver
5.删除 HDFS 上已经存在的输出文件
[admin@hadoop1002 hadoop-3.1.3]$ hadoop fs -rm -r /output
6.执行 WordCount 程序
[admin@hadoop1002 hadoop-3.1.3]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /input /output2
7.查看
http://hadoop1002:9870
以上是就是hadoop配置日志的聚集的具体操作了,如有疑问请留言!!