MAPREDUCE服务 MRS-Spark REST API接口介绍:REST接口
REST接口
通过以下命令可跳过REST接口过滤器获取相应的应用信息。
- 获取JobHistory中所有应用信息:
- 命令:
curl https://192.168.227.16:18080/api/v1/applications?mode=monitoring --insecure
其中192.168.227.16为JobHistory节点的业务IP,18080为JobHistory的端口号。
- 结果:
[ { "id" : "application_1478570725074_0042", "name" : "Spark-JD BCS erver", "attempts" : [ { "startTime" : "2016-11-09T16:57:15.237 CS T", "endTime" : "2016-11-09T17:01:22.573CST", "lastUpdated" : "2016-11-09T17:01:22.614CST", "duration" : 247336, "sparkUser" : "spark", "completed" : true } ] }, { "id" : "application_1478570725074_0047-part1", "name" : "SparkSQL::192.168.169.84", "attempts" : [ { "startTime" : "2016-11-10T11:57:36.626CST", "endTime" : "1969-12-31T07:59:59.999CST", "lastUpdated" : "2016-11-10T11:57:48.613CST", "duration" : 0, "sparkUser" : "admin", "completed" : false } ] }]
- 结果分析:
通过这个命令,可以查询当前集群中所有的Spark应用(包括正在运行的应用和已经完成的应用),每个应用的信息如下表 1 。
- 命令:
- 获取JobHistory中某个应用的信息:
- 命令:
curl https://192.168.227.16:18080/api/v1/applications/application_1478570725074_0042?mode=monitoring --insecure
其中192.168.227.16为JobHistory节点的业务IP,18080为JobHistory的端口号,application_1478570725074_0042为应用的id。
- 结果:
{ "id" : "application_1478570725074_0042", "name" : "Spark-JDBCServer", "attempts" : [ { "startTime" : "2016-11-09T16:57:15.237CST", "endTime" : "2016-11-09T17:01:22.573CST", "lastUpdated" : "2016-11-09T17:01:22.614CST", "duration" : 247336, "sparkUser" : "spark", "completed" : true } ] }
- 结果分析:
通过这个命令,可以查询某个Spark应用的信息,显示的信息如表1所示。
- 命令:
- 获取正在执行的某个应用的Executor信息:
- 针对alive executor命令:
curl https://192.168.169.84:26001/proxy/application_1478570725074_0046/api/v1/applications/application_1478570725074_0046/executors?mode=monitoring --insecure
- 针对全部executor(alive&dead)命令:
curl https://192.168.169.84:26001/proxy/application_1478570725074_0046/api/v1/applications/application_1478570725074_0046/allexecutors?mode=monitoring --insecure
其中192.168.195.232为ResourceManager主节点的业务IP,26001为ResourceManager的端口号,application_1478570725074_0046为在YARN中的应用ID。
- 结果:
[{ "id" : "driver", "hostPort" : "192.168.169.84:23886", "isActive" : true, "rddBlocks" : 0, "memoryUsed" : 0, "diskUsed" : 0, "activeTasks" : 0, "failedTasks" : 0, "completedTasks" : 0, "totalTasks" : 0, "totalDuration" : 0, "totalInputBytes" : 0, "totalShuffleRead" : 0, "totalShuffleWrite" : 0, "maxMemory" : 278019440, "executorLogs" : { } }, { "id" : "1", "hostPort" : "192.168.169.84:23902", "isActive" : true, "rddBlocks" : 0, "memoryUsed" : 0, "diskUsed" : 0, "activeTasks" : 0, "failedTasks" : 0, "completedTasks" : 0, "totalTasks" : 0, "totalDuration" : 0, "totalInputBytes" : 0, "totalShuffleRead" : 0, "totalShuffleWrite" : 0, "maxMemory" : 555755765, "executorLogs" : { "stdout" : "https://XTJ-224:26010/node/containerlogs/container_1478570725074_0049_01_000002/admin/stdout?start=-4096", "stderr" : "https://XTJ-224:26010/node/containerlogs/container_1478570725074_0049_01_000002/admin/stderr?start=-4096" } } ]
- 结果分析:
通过这个命令,可以查询当前应用的所有Executor信息(包括Driver),每个Executor的信息包含如下表 2所示的常用信息。
- 针对alive executor命令: