注意:开启日志聚集功能,需要重新启动NodeManager 、ResourceManager和HistoryServer。
配置yarn-site.xml
增加配置
<!-- 开启日志聚集功能 -->
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<!-- 设置日志聚集服务器地址 -->
<property>
<name>yarn.log.server.url</name>
<value>http://hadoop102:19888/jobhistory/logs</value>
</property>
<!-- 设置日志保留时间为7天 -->
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>604800</value>
</property>
同步各个节点
2、关闭NodeManager 、ResourceManager和HistoryServer 并重新启动
stop-yarn.sh
mapred --daemon stop historyserver
start-yarn.sh
mapred --daemon start historyserver