在yarn-site.xml配置文件中添加如下内容:
##开启日志聚集功能
<property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property>##日志保存7天(单位秒) <property> <name>yarn.log-aggregation.retain-seconds</name> <value>600000</value> </property>重启resourcemanager、nodemanager和historyserver守护进程:
sbin/yarn-daemon.sh start|stop resourcemanager sbin/yarn-daemon.sh start|stop nodemanager 或者 sbin/start-yarn.sh sbin/stop-yarn.sh sbin/mr-jobhistory-daemon.sh start|stop historyserver