Rest API
spark可以通过UI查看指标。这样就能开发一些可视化图表工具来收集展示所有任务的概况,这样就能从整体上看到集群的运行情况,以及业务的增长情况。这些命令同时也只支持正在运行的应用。对于history server,访问的地址是http://:18080/api/v1
,对于正在运行的任务,可以访问http://localhost:4040/api/v1
在这些api中,应用的标识为ID[app-id]
。当通过YARN启动时,每个应用可能会有多次尝试,只有在cluster模式下才有 应用尝试的id,client模式是没有的。如果是集群模式,那么app-id
其实是[base-app-id]/[attempt-id]
,其中base-app-id
是yarn的appid
。
?status=[active|complete|pending|failed]
可以列出对应的状态
端点 | 含义 |
---|---|
/applications | 所有应用的列表 |
/applications/[app-id]/jobs | 给定应用的全部作业列表 |
/applications/[app-id]/jobs/[job-id] | 给定作业的细节 |
/applications/[app-id]/stages | 给定应用的stage列表 |
/applications/[app-id]/stages/[stage-id] | 给定stage的所有attempt列表 |
/applications/[app-id]/stages/[stage-id]/[stage-attempt-id] | 给定attempt的详细信息 |
/applications/[app-id]/stages/[stage-id]/[stage-attempt-id]/taskSummary | 指定attempt对应的所有task的概要度量信息 |
/applications/[app-id]/stages/[stage-id]/[stage-attempt-id]/taskList | 指定的attempt的所有task的列表 |
/applications/[app-id]/executors | 给定应用的所有执行器 |
/applications/[app-id]/storage/rdd | 给定应用的已保存的RDD列表 |
/applications/[app-id]/storage/rdd/[rdd-id] | 给定的RDD的存储详细信息 |
/applications/[app-id]/logs | 将给定应用的所有attempt对应的event log以zip格式打包下载 |
/applications/[app-id]/[attempt-id]/logs | 将给定attempt的所有attempt对应的event log以zip格式打包下载 |
API链接: https://spark.apache.org/docs/2.2.0/monitoring.html#rest-api.