配置文件:spark-defaults.conf

spark.eventLog.enabled    true
spark.eventLog.dir hdfs://IP:8020/spark-events #提前创建好目录
spark.eventLog.compress true #压缩,减少资源消耗

配置文件:spark-env.sh

Export       SPARK_HISTORY_OPTS=”-Dspark.history.ui.port=180180 -Dspark.history.retainerApplications =250 -Dspark.history.fs.logDirectory=和上目录一致

端口 UI可查看历史记录数 读取历史记录数据目录

启动historyserver      ./sbin/start-history-server.sh