```shell
vi /opt/hadoop/etc/hadoop/mapred-site.xml
```
```xml
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop03:10020</value>
</property>
<property>
<name>mapreduce.jobhistoryi.webapp.address</name>
<value>hadoop03:19888</value>
</property>
```
启动历史服务器
```shell
/opt/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver
```
配置日志聚集功能保留日志7天
```shell
vi /opt/hadoop/etc/hadoop/yarn-site.xml
```
```xml
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>604800</value>
</property>
```