0%

spark历史服务器

spark历史服务器

由于spark-shell停掉之后页面的4040端口也就无法访问了,那么使用spark-submit执行的任务就无法查看,此时就需要配置历史服务器

首先修改spark-defaults.conf配置文件

1
2
3
# 配置日志存储
spark.eventLog.enabled true
spark.eventLog.dir hdfs://localhost:9000/directory

修改spark-env.sh

1
2
3
4
5
#配置历史服务器
export SPARK_HISTORY_OPTS="
78 -Dspark.history.ui.port=18080
79 -Dspark.history.fs.logDirectory=hdfs://localhost:9000/directory
80 -Dspark.history.retainedApplications=30"

spark.history.fs.logDirectory和spark.eventLog.dir要对应,且这里的目录一定要存在,如果不存在需要在hdfs上创建

之后启动历史服务器(在sbin目录下)

1
./start-history-server.sh

启动之后可以去localhost:18080页面查看

spark历史服务器页面

欢迎关注我的其它发布渠道