ResourceManager REST API 允许用户获取有关集群的信息 - 集群状态、集群指标、调度程序信息、集群中节点的信息以及集群中应用程序的信息。
要仅为 RM 启用跨源支持 (CORS)(不为 NM 启用),请设置以下配置参数
在 core-site.xml 中,将 org.apache.hadoop.security.HttpCrossOriginFilterInitializer 添加到 hadoop.http.filter.initializers。在 yarn-site.xml 中,将 yarn.resourcemanager.webapp.cross-origin.enabled 设置为 true。
集群信息资源提供有关集群的整体信息。
以下两个 URI 均可提供集群信息。
None
项目 | 数据类型 | 描述 |
---|---|---|
id | long | 集群 ID |
startedOn | long | 集群启动时间(自纪元以来的毫秒数) |
state | string | ResourceManager 状态 - 有效值:NOTINITED、INITED、STARTED、STOPPED |
haState | string | ResourceManager HA 状态 - 有效值:INITIALIZING、ACTIVE、STANDBY、STOPPED |
rmStateStoreName | string | 实现 ResourceManager 状态存储的类的完全限定名 |
resourceManagerVersion | string | ResourceManager 版本 |
resourceManagerBuildVersion | string | 包含构建版本、用户和校验和的 ResourceManager 构建字符串 |
resourceManagerVersionBuiltOn | string | ResourceManager 构建时间(自纪元以来的毫秒数) |
hadoopVersion | string | hadoop common 版本 |
hadoopBuildVersion | string | 包含构建版本、用户和校验和的 Hadoop common 构建字符串 |
hadoopVersionBuiltOn | string | hadoop common 构建时间(自纪元以来的毫秒数) |
haZooKeeperConnectionState | string | 高可用性服务 ZooKeeper 连接状态 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/info
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "clusterInfo": { "id":1324053971963, "startedOn":1324053971963, "state":"STARTED", "haState":"ACTIVE", "rmStateStoreName":"org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore", "resourceManagerVersion":"3.0.0-SNAPSHOT", "resourceManagerBuildVersion":"3.0.0-SNAPSHOT from unknown by user1 source checksum 11111111111111111111111111111111", "resourceManagerVersionBuiltOn":"2016-01-01T01:00Z", "hadoopVersion":"3.0.0-SNAPSHOT", "hadoopBuildVersion":"3.0.0-SNAPSHOT from unknown by user1 source checksum 11111111111111111111111111111111", "hadoopVersionBuiltOn":"2016-01-01T01:00Z", "haZooKeeperConnectionState": "ResourceManager HA is not enabled." } }
XML 响应
HTTP 请求
Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/info
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 712 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <clusterInfo> <id>1476912658570</id> <startedOn>1476912658570</startedOn> <state>STARTED</state> <haState>ACTIVE</haState> <rmStateStoreName>org.apache.hadoop.yarn.server.resourcemanager.recovery.NullRMStateStore</rmStateStoreName> <resourceManagerVersion>3.0.0-SNAPSHOT</resourceManagerVersion> <resourceManagerBuildVersion>3.0.0-SNAPSHOT from unknown by user1 source checksum 11111111111111111111111111111111</resourceManagerBuildVersion> <resourceManagerVersionBuiltOn>2016-01-01T01:00Z</resourceManagerVersionBuiltOn> <hadoopVersion>3.0.0-SNAPSHOT</hadoopVersion> <hadoopBuildVersion>3.0.0-SNAPSHOT from unknown by user1 source checksum 11111111111111111111111111111111</hadoopBuildVersion> <hadoopVersionBuiltOn>2016-01-01T01:00Z</hadoopVersionBuiltOn> <haZooKeeperConnectionState>ResourceManager HA is not enabled.</haZooKeeperConnectionState> </clusterInfo>
集群指标资源提供有关集群的一些总体指标。更详细的指标应从 jmx 接口检索。
None
项目 | 数据类型 | 描述 |
---|---|---|
appsSubmitted | int | 提交的应用程序数 |
appsCompleted | int | 已完成的应用程序数 |
appsPending | int | 挂起的应用程序数 |
appsRunning | int | 正在运行的应用程序数 |
appsFailed | int | 失败的应用程序数 |
appsKilled | int | 已终止的应用程序数 |
reservedMB | long | 预留的内存量(MB) |
availableMB | long | 可用的内存量(MB) |
allocatedMB | long | 已分配的内存量(MB) |
totalMB | long | 总内存量(MB) |
reservedVirtualCores | long | 预留的虚拟内核数 |
availableVirtualCores | long | 可用的虚拟内核数 |
allocatedVirtualCores | long | 已分配的虚拟内核数 |
totalVirtualCores | long | 总虚拟内核数 |
containersAllocated | int | 已分配的容器数 |
containersReserved | int | 已预留的容器数 |
containersPending | int | 挂起的容器数 |
totalNodes | int | 总节点数 |
activeNodes | int | 活动节点数 |
lostNodes | int | 丢失节点数 |
unhealthyNodes | int | 不健康节点数 |
decommissioningNodes | int | 正在退役的节点数 |
decommissionedNodes | int | 已退役的节点数 |
rebootedNodes | int | 已重启的节点数 |
shutdownNodes | int | 已关闭的节点数 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/metrics
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "clusterMetrics": { "appsSubmitted":0, "appsCompleted":0, "appsPending":0, "appsRunning":0, "appsFailed":0, "appsKilled":0, "reservedMB":0, "availableMB":17408, "allocatedMB":0, "reservedVirtualCores":0, "availableVirtualCores":7, "allocatedVirtualCores":1, "containersAllocated":0, "containersReserved":0, "containersPending":0, "totalMB":17408, "totalVirtualCores":8, "totalNodes":1, "lostNodes":0, "unhealthyNodes":0, "decommissioningNodes":0, "decommissionedNodes":0, "rebootedNodes":0, "activeNodes":1, "shutdownNodes":0 } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/metrics Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 432 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <clusterMetrics> <appsSubmitted>0</appsSubmitted> <appsCompleted>0</appsCompleted> <appsPending>0</appsPending> <appsRunning>0</appsRunning> <appsFailed>0</appsFailed> <appsKilled>0</appsKilled> <reservedMB>0</reservedMB> <availableMB>17408</availableMB> <allocatedMB>0</allocatedMB> <reservedVirtualCores>0</reservedVirtualCores> <availableVirtualCores>7</availableVirtualCores> <allocatedVirtualCores>1</allocatedVirtualCores> <containersAllocated>0</containersAllocated> <containersReserved>0</containersReserved> <containersPending>0</containersPending> <totalMB>17408</totalMB> <totalVirtualCores>8</totalVirtualCores> <totalNodes>1</totalNodes> <lostNodes>0</lostNodes> <unhealthyNodes>0</unhealthyNodes> <decommissioningNodes>0</decommissioningNodes> <decommissionedNodes>0</decommissionedNodes> <rebootedNodes>0</rebootedNodes> <activeNodes>1</activeNodes> <shutdownNodes>0</shutdownNodes> </clusterMetrics>
调度程序资源包含有关群集中配置的当前调度程序的信息。它目前支持 Fifo、容量和公平调度程序。根据配置的调度程序,您将获得不同的信息,因此请务必查看类型信息。
None
容量调度程序支持分层队列。此请求将打印有关所有队列及其拥有的任何子队列的信息。实际上可以向其提交作业的队列称为叶队列。这些队列具有与之关联的其他数据。
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 调度程序类型 - capacityScheduler |
capacity | 浮点数 | 相对于其父队列的配置队列容量(百分比) |
usedCapacity | 浮点数 | 已使用的队列容量(百分比) |
maxCapacity | 浮点数 | 相对于其父队列的配置最大队列容量(百分比) |
queueName | string | 队列名称 |
queues | 队列数组(JSON)/零个或更多队列对象(XML) | 队列资源集合 |
health | 单个健康对象 | 容量调度程序的健康指标。此指标自 2.8.0 起存在,但输出格式不佳。因此,用户无法干净地使用此字段,此字段从 3.2.0 起进行了优化。 |
项目 | 数据类型 | 描述 |
---|---|---|
capacity | 浮点数 | 相对于其父队列的配置队列容量(百分比) |
usedCapacity | 浮点数 | 已使用的队列容量(百分比) |
maxCapacity | 浮点数 | 相对于其父队列的配置最大队列容量(百分比) |
absoluteCapacity | 浮点数 | 此队列可使用的整个群集的绝对容量百分比 |
absoluteMaxCapacity | 浮点数 | 此队列可使用的整个群集的绝对最大容量百分比 |
absoluteUsedCapacity | 浮点数 | 此队列正在使用的整个群集的绝对已用容量百分比 |
numApplications | int | 当前在队列中的应用程序数 |
usedResources | string | 描述队列当前使用的资源的字符串 |
queueName | string | 队列名称 |
state | QueueState 字符串 | 队列状态 |
queues | 队列数组(JSON)/零个或更多队列对象(XML) | 子队列信息的集合。如果队列没有子队列,则省略。 |
resourcesUsed | 单个资源对象 | 此队列使用的总资源量 |
项目 | 数据类型 | 描述 |
---|---|---|
type | 字符串 | 队列类型 - capacitySchedulerLeafQueueInfo |
numActiveApplications | int | 此队列中的活动应用程序数 |
numPendingApplications | int | 此队列中的挂起应用程序数 |
numContainers | int | 正在使用的容器数 |
allocatedContainers | int | 此队列中的已分配容器数 |
reservedContainers | int | 此队列中的已预留容器数 |
pendingContainers | int | 此队列中的挂起容器数 |
maxApplications | int | 此队列可容纳的最大应用程序数 |
maxApplicationsPerUser | int | 此队列中每个用户可容纳的最大应用程序数 |
maxActiveApplications | int | 此队列可容纳的最大活动应用程序数 |
maxActiveApplicationsPerUser | int | 此队列中每个用户可容纳的最大活动应用程序数 |
userLimit | int | 配置中设置的最小用户限制百分比 |
userLimitFactor | 浮点数 | 配置中设置的用户限制因子 |
users | 用户数组 (JSON)/零个或多个用户对象 (XML) | 包含已用资源的用户对象集合 |
项目 | 数据类型 | 描述 |
---|---|---|
username | 字符串 | 使用资源的用户的用户名 |
resourcesUsed | 单个资源对象 | 此队列中用户使用的资源量 |
numActiveApplications | int | 此队列中此用户的活动应用程序数 |
numPendingApplications | int | 此队列中此用户的挂起应用程序数 |
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 已用内存量 (以 MB 为单位) |
vCores | int | 虚拟内核数 |
项目 | 数据类型 | 描述 |
---|---|---|
lastrun | long | 应用程序启动时间(自纪元以来的毫秒数) |
operationsInfo | 操作数组 (JSON)/操作对象 (XML) | 操作对象集合 |
lastRunDetails | lastRunDetails 数组 (JSON)/lastRunDetail 对象 (XML) | lastRunDetail 对象集合 |
项目 | 数据类型 | 描述 |
---|---|---|
operation | string | 操作类型 |
nodeId | string | 操作涉及的节点 ID |
containerId | string | 操作涉及的容器 ID |
queue | string | 操作涉及的队列名称 |
项目 | 数据类型 | 描述 |
---|---|---|
operation | string | 操作类型 |
count | long | 操作涉及的节点 ID |
resources | 单个资源对象 | 操作涉及的资源 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/scheduler
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "scheduler": { "schedulerInfo": { "capacity": 100.0, "maxCapacity": 100.0, "queueName": "root", "queues": { "queue": [ { "absoluteCapacity": 10.5, "absoluteMaxCapacity": 50.0, "absoluteUsedCapacity": 0.0, "capacity": 10.5, "maxCapacity": 50.0, "numApplications": 0, "queueName": "a", "queues": { "queue": [ { "absoluteCapacity": 3.15, "absoluteMaxCapacity": 25.0, "absoluteUsedCapacity": 0.0, "capacity": 30.000002, "maxCapacity": 50.0, "numApplications": 0, "queueName": "a1", "queues": { "queue": [ { "absoluteCapacity": 2.6775, "absoluteMaxCapacity": 25.0, "absoluteUsedCapacity": 0.0, "capacity": 85.0, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 1, "maxApplications": 267, "maxApplicationsPerUser": 267, "maxCapacity": 100.0, "numActiveApplications": 0, "numApplications": 0, "numContainers": 0, "numPendingApplications": 0, "queueName": "a1a", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 1.0, "users": null }, { "absoluteCapacity": 0.47250003, "absoluteMaxCapacity": 25.0, "absoluteUsedCapacity": 0.0, "capacity": 15.000001, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 1, "maxApplications": 47, "maxApplicationsPerUser": 47, "maxCapacity": 100.0, "numActiveApplications": 0, "numApplications": 0, "numContainers": 0, "numPendingApplications": 0, "queueName": "a1b", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 1.0, "users": null } ] }, "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>" }, { "absoluteCapacity": 7.35, "absoluteMaxCapacity": 50.0, "absoluteUsedCapacity": 0.0, "capacity": 70.0, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 100, "maxApplications": 735, "maxApplicationsPerUser": 73500, "maxCapacity": 100.0, "numActiveApplications": 0, "numApplications": 0, "numContainers": 0, "numPendingApplications": 0, "queueName": "a2", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 100.0, "users": null } ] }, "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>" }, { "absoluteCapacity": 89.5, "absoluteMaxCapacity": 100.0, "absoluteUsedCapacity": 0.0, "capacity": 89.5, "maxCapacity": 100.0, "numApplications": 2, "queueName": "b", "queues": { "queue": [ { "absoluteCapacity": 53.7, "absoluteMaxCapacity": 100.0, "absoluteUsedCapacity": 0.0, "capacity": 60.000004, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 100, "maxApplications": 5370, "maxApplicationsPerUser": 537000, "maxCapacity": 100.0, "numActiveApplications": 1, "numApplications": 2, "numContainers": 0, "numPendingApplications": 1, "queueName": "b1", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 100.0, "users": { "user": [ { "numActiveApplications": 0, "numPendingApplications": 1, "resourcesUsed": { "memory": 0, "vCores": 0 }, "username": "user2" }, { "numActiveApplications": 1, "numPendingApplications": 0, "resourcesUsed": { "memory": 0, "vCores": 0 }, "username": "user1" } ] } }, { "absoluteCapacity": 35.3525, "absoluteMaxCapacity": 100.0, "absoluteUsedCapacity": 0.0, "capacity": 39.5, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 100, "maxApplications": 3535, "maxApplicationsPerUser": 353500, "maxCapacity": 100.0, "numActiveApplications": 0, "numApplications": 0, "numContainers": 0, "numPendingApplications": 0, "queueName": "b2", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 100.0, "users": null }, { "absoluteCapacity": 0.4475, "absoluteMaxCapacity": 100.0, "absoluteUsedCapacity": 0.0, "capacity": 0.5, "maxActiveApplications": 1, "maxActiveApplicationsPerUser": 100, "maxApplications": 44, "maxApplicationsPerUser": 4400, "maxCapacity": 100.0, "numActiveApplications": 0, "numApplications": 0, "numContainers": 0, "numPendingApplications": 0, "queueName": "b3", "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "type": "capacitySchedulerLeafQueueInfo", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>", "userLimit": 100, "userLimitFactor": 100.0, "users": null } ] }, "resourcesUsed": { "memory": 0, "vCores": 0 }, "state": "RUNNING", "usedCapacity": 0.0, "usedResources": "<memory:0, vCores:0>" } ] }, "health": { "lastrun": 1326381444693, "operationsInfo": [ { "operation": "last-allocation", "nodeId": "N/A", "containerId": "N/A", "queue": "N/A" }, { "operation": "last-release", "nodeId": "host.domain.com:8041", "containerId": "container_1326821518301_0005_01_000001", "queue": "root.default" }, { "operation": "last-preemption", "nodeId": "N/A", "containerId": "N/A", "queue": "N/A" }, { "operation": "last-reservation", "nodeId": "N/A", "containerId": "N/A", "queue": "N/A" } ], "lastRunDetails": [ { "operation": "releases", "count": 0, "resources": { "memory": 0, "vCores": 0 } }, { "operation": "allocations", "count": 0, "resources": { "memory": 0, "vCores": 0 } }, { "operation": "reservations", "count": 0, "resources": { "memory": 0, "vCores": 0 } } ] }, "type": "capacityScheduler", "usedCapacity": 0.0 } } } ```json **XML response** HTTP Request: Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/scheduler Response Header: HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 5778 Server: Jetty(6.1.26) Response Body: ```xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <scheduler> <schedulerInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="capacityScheduler"> <capacity>100.0</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <queueName>root</queueName> <queues> <queue> <capacity>10.5</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>50.0</maxCapacity> <absoluteCapacity>10.5</absoluteCapacity> <absoluteMaxCapacity>50.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>a</queueName> <state>RUNNING</state> <queues> <queue> <capacity>30.000002</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>50.0</maxCapacity> <absoluteCapacity>3.15</absoluteCapacity> <absoluteMaxCapacity>25.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>a1</queueName> <state>RUNNING</state> <queues> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>85.0</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>2.6775</absoluteCapacity> <absoluteMaxCapacity>25.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>a1a</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>0</numActiveApplications> <numPendingApplications>0</numPendingApplications> <numContainers>0</numContainers> <maxApplications>267</maxApplications> <maxApplicationsPerUser>267</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>1</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users/> <userLimitFactor>1.0</userLimitFactor> </queue> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>15.000001</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>0.47250003</absoluteCapacity> <absoluteMaxCapacity>25.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>a1b</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>0</numActiveApplications> <numPendingApplications>0</numPendingApplications> <numContainers>0</numContainers> <maxApplications>47</maxApplications> <maxApplicationsPerUser>47</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>1</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users/> <userLimitFactor>1.0</userLimitFactor> </queue> </queues> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> </queue> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>70.0</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>7.35</absoluteCapacity> <absoluteMaxCapacity>50.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>a2</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>0</numActiveApplications> <numPendingApplications>0</numPendingApplications> <numContainers>0</numContainers> <maxApplications>735</maxApplications> <maxApplicationsPerUser>73500</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>100</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users/> <userLimitFactor>100.0</userLimitFactor> </queue> </queues> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> </queue> <queue> <capacity>89.5</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>89.5</absoluteCapacity> <absoluteMaxCapacity>100.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>2</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>b</queueName> <state>RUNNING</state> <queues> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>60.000004</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>53.7</absoluteCapacity> <absoluteMaxCapacity>100.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>2</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>b1</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>1</numActiveApplications> <numPendingApplications>1</numPendingApplications> <numContainers>0</numContainers> <maxApplications>5370</maxApplications> <maxApplicationsPerUser>537000</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>100</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users> <user> <username>user2</username> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numPendingApplications>1</numPendingApplications> <numActiveApplications>0</numActiveApplications> </user> <user> <username>user1</username> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numPendingApplications>0</numPendingApplications> <numActiveApplications>1</numActiveApplications> </user> </users> <userLimitFactor>100.0</userLimitFactor> </queue> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>39.5</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>35.3525</absoluteCapacity> <absoluteMaxCapacity>100.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>b2</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>0</numActiveApplications> <numPendingApplications>0</numPendingApplications> <numContainers>0</numContainers> <maxApplications>3535</maxApplications> <maxApplicationsPerUser>353500</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>100</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users/> <userLimitFactor>100.0</userLimitFactor> </queue> <queue xsi:type="capacitySchedulerLeafQueueInfo"> <capacity>0.5</capacity> <usedCapacity>0.0</usedCapacity> <maxCapacity>100.0</maxCapacity> <absoluteCapacity>0.4475</absoluteCapacity> <absoluteMaxCapacity>100.0</absoluteMaxCapacity> <absoluteUsedCapacity>0.0</absoluteUsedCapacity> <numApplications>0</numApplications> <usedResources><memory:0, vCores:0></usedResources> <queueName>b3</queueName> <state>RUNNING</state> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> <numActiveApplications>0</numActiveApplications> <numPendingApplications>0</numPendingApplications> <numContainers>0</numContainers> <maxApplications>44</maxApplications> <maxApplicationsPerUser>4400</maxApplicationsPerUser> <maxActiveApplications>1</maxActiveApplications> <maxActiveApplicationsPerUser>100</maxActiveApplicationsPerUser> <userLimit>100</userLimit> <users/> <userLimitFactor>100.0</userLimitFactor> </queue> </queues> <resourcesUsed> <memory>0</memory> <vCores>0</vCores> </resourcesUsed> </queue> </queues> <health> <lastrun>1326381444693</lastrun> <operationsInfo> <operation>last-allocation</operation> <nodeId>N/A</nodeId> <containerId>N/A</containerId> <queue>N/A</queue> </operationsInfo> <operationsInfo> <operation>last-release</operation> <nodeId>host.domain.com:8041</nodeId> <containerId>container_1326821518301_0005_01_000001</containerId> <queue>root.default</queue> </operationsInfo> <operationsInfo> <operation>last-preemption</operation> <nodeId>N/A</nodeId> <containerId>N/A</containerId> <queue>N/A</queue> </operationsInfo> <operationsInfo> <operation>last-reservation</operation> <nodeId>N/A</nodeId> <containerId>N/A</containerId> <queue>N/A</queue> </operationsInfo> <lastRunDetails> <operation>releases</operation> <count>0</count> <resources> <memory>0</memory> <vCores>0</vCores> </resources> </lastRunDetails> <lastRunDetails> <operation>allocations</operation> <count>0</count> <resources> <memory>0</memory> <vCores>0</vCores> </resources> </lastRunDetails> <lastRunDetails> <operation>reservations</operation> <count>0</count> <resources> <memory>0</memory> <vCores>0</vCores> </resources> </lastRunDetails> </health> </schedulerInfo> </scheduler>
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 调度程序类型 - fifoScheduler |
capacity | 浮点数 | 队列容量(百分比) |
usedCapacity | 浮点数 | 已使用的队列容量(百分比) |
qstate | string | 队列状态 - 有效值包括:已停止、正在运行 |
minQueueMemoryCapacity | int | 最小队列内存容量 |
maxQueueMemoryCapacity | int | 最大队列内存容量 |
numNodes | int | 总节点数 |
usedNodeCapacity | int | 已使用的节点容量 |
availNodeCapacity | int | 可用节点容量 |
totalNodeCapacity | int | 总节点容量 |
numContainers | int | 容器数量 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/scheduler
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "scheduler": { "schedulerInfo": { "type":"fifoScheduler", "capacity":1, "usedCapacity":"NaN", "qstate":"RUNNING", "minQueueMemoryCapacity":1024, "maxQueueMemoryCapacity":10240, "numNodes":0, "usedNodeCapacity":0, "availNodeCapacity":0, "totalNodeCapacity":0, "numContainers":0 } } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/scheduler Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 432 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <scheduler> <schedulerInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="fifoScheduler"> <capacity>1.0</capacity> <usedCapacity>NaN</usedCapacity> <qstate>RUNNING</qstate> <minQueueMemoryCapacity>1024</minQueueMemoryCapacity> <maxQueueMemoryCapacity>10240</maxQueueMemoryCapacity> <numNodes>0</numNodes> <usedNodeCapacity>0</usedNodeCapacity> <availNodeCapacity>0</availNodeCapacity> <totalNodeCapacity>0</totalNodeCapacity> <numContainers>0</numContainers> </schedulerInfo> </scheduler>
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 调度程序类型 - fairScheduler |
rootQueue | 根队列对象 | 根队列资源集合 |
项目 | 数据类型 | 描述 |
---|---|---|
maxApps | int | 队列可拥有的最大应用程序数量 |
minResources | 单个资源对象 | 队列保证的已配置最小资源 |
maxResources | 单个资源对象 | 队列允许的已配置最大资源 |
usedResources | 单个资源对象 | 队列内分配给容器的资源总和 |
fairResources | 单个资源对象 | 队列的公平资源份额 |
clusterResources | 单个资源对象 | 集群容量 |
queueName | string | 队列名称 |
schedulingPolicy | string | 队列使用的调度策略名称 |
childQueues | 队列数组(JSON)/队列对象(XML) | 子队列信息集合。如果队列没有子队列或为叶队列,则省略。 |
allocatedContainers | int | 已分配容器数量 |
demandResources | 单个资源对象 | 此队列中容器请求但调度程序尚未满足的资源 |
pendingContainers | int | 挂起容器数量 |
preemptable | 布尔值 | 如果此队列中的容器可以被抢占,则为 true |
reservedContainers | int | 已保留容器数量 |
steadyFairResources | 单个资源对象 | 队列的稳定公平份额 |
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 队列类型 - fairSchedulerLeafQueueInfo |
numActiveApps | int | 此队列中的活动应用程序数 |
numPendingApps | int | 此队列中的挂起应用程序数 |
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 已用内存量 (以 MB 为单位) |
vCores | int | 虚拟内核数 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/scheduler
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "scheduler": { "schedulerInfo": { "rootQueue": { "allocatedContainers": 0, "childQueues": { "queue": [ { "allocatedContainers": 0, "clusterResources": { "memory": 8192, "vCores": 8 }, "demandResources": { "memory": 0, "vCores": 0 }, "fairResources": { "memory": 0, "vCores": 0 }, "maxApps": 2147483647, "maxResources": { "memory": 8192, "vCores": 8 }, "minResources": { "memory": 0, "vCores": 0 }, "numActiveApps": 0, "numPendingApps": 0, "pendingContainers": 0, "preemptable": true, "queueName": "root.default", "reservedContainers": 0, "schedulingPolicy": "fair", "steadyFairResources": { "memory": 4096, "vCores": 0 }, "type": "fairSchedulerLeafQueueInfo", "usedResources": { "memory": 0, "vCores": 0 } }, { "allocatedContainers": 0, "childQueues": { "queue": [ { "allocatedContainers": 0, "clusterResources": { "memory": 8192, "vCores": 8 }, "demandResources": { "memory": 0, "vCores": 0 }, "fairResources": { "memory": 10000, "vCores": 0 }, "maxApps": 2147483647, "maxResources": { "memory": 8192, "vCores": 8 }, "minResources": { "memory": 5000, "vCores": 0 }, "numActiveApps": 0, "numPendingApps": 0, "pendingContainers": 0, "preemptable": true, "queueName": "root.sample_queue.sample_sub_queue", "reservedContainers": 0, "schedulingPolicy": "fair", "steadyFairResources": { "memory": 4096, "vCores": 0 }, "type": "fairSchedulerLeafQueueInfo", "usedResources": { "memory": 0, "vCores": 0 } } ] }, "clusterResources": { "memory": 8192, "vCores": 8 }, "demandResources": { "memory": 0, "vCores": 0 }, "fairResources": { "memory": 10000, "vCores": 0 }, "maxApps": 50, "maxResources": { "memory": 8192, "vCores": 0 }, "minResources": { "memory": 10000, "vCores": 0 }, "pendingContainers": 0, "preemptable": true, "queueName": "root.sample_queue", "reservedContainers": 0, "schedulingPolicy": "fair", "steadyFairResources": { "memory": 4096, "vCores": 0 }, "usedResources": { "memory": 0, "vCores": 0 } } ] }, "clusterResources": { "memory": 8192, "vCores": 8 }, "demandResources": { "memory": 0, "vCores": 0 }, "fairResources": { "memory": 8192, "vCores": 8 }, "maxApps": 2147483647, "maxResources": { "memory": 8192, "vCores": 8 }, "minResources": { "memory": 0, "vCores": 0 }, "pendingContainers": 0, "preemptable": true, "queueName": "root", "reservedContainers": 0, "schedulingPolicy": "fair", "steadyFairResources": { "memory": 8192, "vCores": 8 }, "usedResources": { "memory": 0, "vCores": 0 } }, "type": "fairScheduler" } } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/scheduler Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 2321 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <scheduler> <schedulerInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="fairScheduler"> <rootQueue> <maxApps>2147483647</maxApps> <minResources> <memory>0</memory> <vCores>0</vCores> </minResources> <maxResources> <memory>8192</memory> <vCores>8</vCores> </maxResources> <usedResources> <memory>0</memory> <vCores>0</vCores> </usedResources> <demandResources> <memory>0</memory> <vCores>0</vCores> </demandResources> <steadyFairResources> <memory>8192</memory> <vCores>8</vCores> </steadyFairResources> <fairResources> <memory>8192</memory> <vCores>8</vCores> </fairResources> <clusterResources> <memory>8192</memory> <vCores>8</vCores> </clusterResources> <pendingContainers>0</pendingContainers> <allocatedContainers>0</allocatedContainers> <reservedContainers>0</reservedContainers> <queueName>root</queueName> <schedulingPolicy>fair</schedulingPolicy> <preemptable>true</preemptable> <childQueues> <queue xsi:type="fairSchedulerLeafQueueInfo"> <maxApps>2147483647</maxApps> <minResources> <memory>0</memory> <vCores>0</vCores> </minResources> <maxResources> <memory>8192</memory> <vCores>8</vCores> </maxResources> <usedResources> <memory>0</memory> <vCores>0</vCores> </usedResources> <demandResources> <memory>0</memory> <vCores>0</vCores> </demandResources> <steadyFairResources> <memory>4096</memory> <vCores>0</vCores> </steadyFairResources> <fairResources> <memory>0</memory> <vCores>0</vCores> </fairResources> <clusterResources> <memory>8192</memory> <vCores>8</vCores> </clusterResources> <pendingContainers>0</pendingContainers> <allocatedContainers>0</allocatedContainers> <reservedContainers>0</reservedContainers> <queueName>root.default</queueName> <schedulingPolicy>fair</schedulingPolicy> <preemptable>true</preemptable> <numPendingApps>0</numPendingApps> <numActiveApps>0</numActiveApps> </queue> <queue> <maxApps>50</maxApps> <minResources> <memory>0</memory> <vCores>0</vCores> </minResources> <maxResources> <memory>8192</memory> <vCores>0</vCores> </maxResources> <usedResources> <memory>0</memory> <vCores>0</vCores> </usedResources> <demandResources> <memory>0</memory> <vCores>0</vCores> </demandResources> <steadyFairResources> <memory>4096</memory> <vCores>0</vCores> </steadyFairResources> <fairResources> <memory>10000</memory> <vCores>0</vCores> </fairResources> <clusterResources> <memory>8192</memory> <vCores>8</vCores> </clusterResources> <pendingContainers>0</pendingContainers> <allocatedContainers>0</allocatedContainers> <reservedContainers>0</reservedContainers> <queueName>root.sample_queue</queueName> <schedulingPolicy>fair</schedulingPolicy> <preemptable>true</preemptable> <childQueues> <queue xsi:type="fairSchedulerLeafQueueInfo"> <maxApps>2147483647</maxApps> <minResources> <memory>5000</memory> <vCores>0</vCores> </minResources> <maxResources> <memory>8192</memory> <vCores>8</vCores> </maxResources> <usedResources> <memory>0</memory> <vCores>0</vCores> </usedResources> <demandResources> <memory>0</memory> <vCores>0</vCores> </demandResources> <steadyFairResources> <memory>4096</memory> <vCores>0</vCores> </steadyFairResources> <fairResources> <memory>10000</memory> <vCores>0</vCores> </fairResources> <clusterResources> <memory>8192</memory> <vCores>8</vCores> </clusterResources> <pendingContainers>0</pendingContainers> <allocatedContainers>0</allocatedContainers> <reservedContainers>0</reservedContainers> <queueName>root.sample_queue.sample_sub_queue</queueName> <schedulingPolicy>fair</schedulingPolicy> <preemptable>true</preemptable> <numPendingApps>0</numPendingApps> <numActiveApps>0</numActiveApps> </queue> </childQueues> </queue> </childQueues> </rootQueue> </schedulerInfo> </scheduler>
使用应用程序 API,您可以获取资源集合,其中每个资源都代表一个应用程序。当您对该资源运行 GET 操作时,您会获取应用程序对象集合。
可以为 GET 操作指定多个参数。开始和结束时间具有开始和结束参数,允许您指定范围。例如,可以请求在 2011 年 12 月 19 日上午 1:00 到下午 2:00 之间启动的所有应用程序,其中 startedTimeBegin=1324256400&startedTimeEnd=1324303200。如果未指定开始参数,则默认为 0,如果未指定结束参数,则默认为无穷大。此 API 的所有查询参数都将筛选所有应用程序。但是,queue
查询参数只会隐式筛选当前在给定队列中的未完成应用程序。
当您请求应用程序列表时,信息将作为应用程序对象集合返回。另请参阅 应用程序 API 了解应用程序对象的语法。
项目 | 数据类型 | 描述 |
---|---|---|
app | 应用程序对象数组 (JSON)/零个或多个应用程序对象 (XML) | 应用程序对象集合 |
帮助不需要某些信息的请求者减少开销。
当前支持的项目
项目 | 数据类型 | 描述 |
---|---|---|
resouceRequests | 逗号分隔的字符串 | 在返回中跳过应用程序的资源请求 |
例如
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "apps": { "app": [ { "id": "application_1476912658570_0002", "user": "user2", "name": "word count", "queue": "default", "state": "FINISHED", "finalStatus": "SUCCEEDED", "progress": 100, "trackingUI": "History", "trackingUrl": "http://host.domain.com:8088/cluster/app/application_1476912658570_0002", "diagnostics": "...", "clusterId": 1476912658570, "applicationType": "MAPREDUCE", "applicationTags": "", "priority": -1, "startedTime": 1476913457320, "finishedTime": 1476913761898, "elapsedTime": 304578, "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_1476912658570_0002_02_000001/user2", "amHostHttpAddress": "host.domain.com:8042", "allocatedMB": 0, "allocatedVCores": 0, "runningContainers": 0, "memorySeconds": 206464, "vcoreSeconds": 201, "queueUsagePercentage": 0, "clusterUsagePercentage": 0, "preemptedResourceMB": 0, "preemptedResourceVCores": 0, "numNonAMContainerPreempted": 0, "numAMContainerPreempted": 0, "logAggregationStatus": "DISABLED", "unmanagedApplication": false, "appNodeLabelExpression": "", "amNodeLabelExpression": "", "resourceRequests": [ { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 0 }, "relaxLocality": true, "resourceName": "*" }, { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 20 }, "relaxLocality": true, "resourceName": "host1.domain.com" }, { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 20 }, "relaxLocality": true, "resourceName": "host2.domain.com" }] }, { "id": "application_1476912658570_0001", "user": "user1", "name": "Sleep job", "queue": "default", "state": "FINISHED", "finalStatus": "SUCCEEDED", "progress": 100, "trackingUI": "History", "trackingUrl": "http://host.domain.com:8088/cluster/app/application_1476912658570_0001", "diagnostics": "...", "clusterId": 1476912658570, "applicationType": "YARN", "applicationTags": "", "priority": -1, "startedTime": 1476913464750, "finishedTime": 1476913863175, "elapsedTime": 398425, "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_1476912658570_0001_02_000001/user1", "amHostHttpAddress": "host.domain.com:8042", "allocatedMB": 0, "allocatedVCores": 0, "runningContainers": 0, "memorySeconds": 205410, "vcoreSeconds": 200, "queueUsagePercentage": 0, "clusterUsagePercentage": 0, "preemptedResourceMB": 0, "preemptedResourceVCores": 0, "numNonAMContainerPreempted": 0, "numAMContainerPreempted": 0, "logAggregationStatus": "DISABLED", "unmanagedApplication": false, "appNodeLabelExpression": "", "amNodeLabelExpression": "", "resourceRequests": [ { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 0 }, "relaxLocality": true, "resourceName": "*" }, { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 20 }, "relaxLocality": true, "resourceName": "host3.domain.com" }, { "capability": { "memory": 4096, "virtualCores": 1 }, "nodeLabelExpression": "", "numContainers": 0, "priority": { "priority": 20 }, "relaxLocality": true, "resourceName": "host4.domain.com" }] } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 2459 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <apps> <app> <id>application_1476912658570_0002</id> <user>user2</user> <name>word count</name> <queue>default</queue> <state>FINISHED</state> <finalStatus>SUCCEEDED</finalStatus> <progress>100.0</progress> <trackingUI>History</trackingUI> <trackingUrl>http://host.domain.com:8088/cluster/app/application_1476912658570_0002</trackingUrl> <diagnostics>...</diagnostics> <clusterId>1476912658570</clusterId> <applicationType>YARN</applicationType> <applicationTags></applicationTags> <priority>-1</priority> <startedTime>1476913457320</startedTime> <finishedTime>1476913761898</finishedTime> <elapsedTime>304578</elapsedTime> <amContainerLogs>http://host.domain.com:8042/node/containerlogs/container_1476912658570_0002_02_000001/user2</amContainerLogs> <amHostHttpAddress>host.domain.com:8042</amHostHttpAddress> <allocatedMB>-1</allocatedMB> <allocatedVCores>-1</allocatedVCores> <runningContainers>-1</runningContainers> <memorySeconds>206464</memorySeconds> <vcoreSeconds>201</vcoreSeconds> <queueUsagePercentage>0.0</queueUsagePercentage> <clusterUsagePercentage>0.0</clusterUsagePercentage> <preemptedResourceMB>0</preemptedResourceMB> <preemptedResourceVCores>0</preemptedResourceVCores> <numNonAMContainerPreempted>0</numNonAMContainerPreempted> <numAMContainerPreempted>0</numAMContainerPreempted> <logAggregationStatus>DISABLED</logAggregationStatus> <unmanagedApplication>false</unmanagedApplication> <appNodeLabelExpression></appNodeLabelExpression> <amNodeLabelExpression></amNodeLabelExpression> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>0</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>*</resourceName> </resourceRequests> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>20</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>host1.domain.com</resourceName> </resourceRequests> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>20</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>host2.domain.com</resourceName> </resourceRequests> </app> <app> <id>application_1476912658570_0001</id> <user>user1</user> <name>Sleep job</name> <queue>default</queue> <state>FINISHED</state> <finalStatus>SUCCEEDED</finalStatus> <progress>100.0</progress> <trackingUI>History</trackingUI> <trackingUrl>http://host.domain.com:8088/cluster/app/application_1476912658570_0001</trackingUrl> <diagnostics>...</diagnostics> <clusterId>1476912658570</clusterId> <applicationType>YARN</applicationType> <applicationTags></applicationTags> <priority>-1</priority> <startedTime>1476913464750</startedTime> <finishedTime>1476913863175</finishedTime> <elapsedTime>398425</elapsedTime> <amContainerLogs>http://host.domain.com:8042/node/containerlogs/container_1476912658570_0001_02_000001/user1</amContainerLogs> <amHostHttpAddress>host.domain.com:8042</amHostHttpAddress> <allocatedMB>-1</allocatedMB> <allocatedVCores>-1</allocatedVCores> <runningContainers>-1</runningContainers> <memorySeconds>205410</memorySeconds> <vcoreSeconds>200</vcoreSeconds> <queueUsagePercentage>0.0</queueUsagePercentage> <clusterUsagePercentage>0.0</clusterUsagePercentage> <preemptedResourceMB>0</preemptedResourceMB> <preemptedResourceVCores>0</preemptedResourceVCores> <numNonAMContainerPreempted>0</numNonAMContainerPreempted> <numAMContainerPreempted>0</numAMContainerPreempted> <logAggregationStatus>DISABLED</logAggregationStatus> <unmanagedApplication>false</unmanagedApplication> <appNodeLabelExpression></appNodeLabelExpression> <amNodeLabelExpression></amNodeLabelExpression> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>0</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>*</resourceName> </resourceRequests> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>20</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>host1.domain.com</resourceName> </resourceRequests> <resourceRequests> <capability> <memory>4096</memory> <virtualCores>1</virtualCores> </capability> <nodeLabelExpression/> <numContainers>0</numContainers> <priority> <priority>20</priority> </priority> <relaxLocality>true</relaxLocality> <resourceName>host2.domain.com</resourceName> </resourceRequests> </app> </apps>
使用应用程序统计信息 API,您可以获取一个三元组集合,其中每个三元组包含应用程序类型、应用程序状态以及 ResourceManager 上下文中此类型和此状态的应用程序数。请注意,出于性能考虑,我们目前每个查询仅支持最多一种 applicationType。我们可能会在未来支持每个查询的多个 applicationType 以及更多统计信息。当您对此资源运行 GET 操作时,您会获取一个 statItem 对象集合。
可以指定两个参数。参数不区分大小写。
当您请求统计项列表时,信息将作为 statItem 对象的集合返回
项目 | 数据类型 | 描述 |
---|---|---|
statItem | statItem 对象数组 (JSON)/零个或多个 statItem 对象 (XML) | statItem 对象的集合 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/appstatistics?states=accepted,running,finished&applicationTypes=mapreduce
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "appStatInfo": { "statItem": [ { "state" : "accepted", "type" : "mapreduce", "count" : 4 }, { "state" : "running", "type" : "mapreduce", "count" : 1 }, { "state" : "finished", "type" : "mapreduce", "count" : 7 } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/appstatistics?states=accepted,running,finished&applicationTypes=mapreduce Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 2459 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appStatInfo> <statItem> <state>accepted</state> <type>mapreduce</type> <count>4</count> </statItem> <statItem> <state>running</state> <type>mapreduce</type> <count>1</count> </statItem> <statItem> <state>finished</state> <type>mapreduce</type> <count>7</count> </statItem> </appStatInfo>
应用程序资源包含有关提交到群集的特定应用程序的信息。
使用以下 URI 从由 appid 值标识的应用程序获取 app 对象。
None
请注意,根据安全设置,用户可能无法看到所有字段。
项目 | 数据类型 | 描述 |
---|---|---|
id | string | 应用程序 ID |
user | string | 启动应用程序的用户 |
name | string | 应用程序名称 |
queue | string | 应用程序提交到的队列 |
state | string | 根据 ResourceManager 的应用程序状态 - 有效值是 YarnApplicationState 枚举的成员:NEW、NEW_SAVING、SUBMITTED、ACCEPTED、RUNNING、FINISHED、FAILED、KILLED |
finalStatus | string | 如果已完成,则应用程序的最终状态 - 由应用程序本身报告 - 有效值是 FinalApplicationStatus 枚举的成员:UNDEFINED、SUCCEEDED、FAILED、KILLED |
progress | 浮点数 | 应用程序的进度(以百分比表示) |
trackingUI | string | 跟踪 URL 当前指向的位置 - 历史记录(对于历史记录服务器)或 ApplicationMaster |
trackingUrl | string | 可用于跟踪应用程序的 Web URL |
diagnostics | string | 详细的诊断信息 |
clusterId | long | 集群 ID |
applicationType | string | 应用程序类型 |
applicationTags | string | 应用程序的逗号分隔标记 |
priority | string | 已提交应用程序的优先级 |
startedTime | long | 应用程序启动时间(自纪元以来的毫秒数) |
finishedTime | long | 应用程序完成的时间(自纪元以来的毫秒数) |
elapsedTime | long | 自应用程序启动以来的经过时间(以毫秒为单位) |
amContainerLogs | string | 应用程序主容器日志的 URL |
amHostHttpAddress | string | 应用程序主节点的 HTTP 地址 |
amRPCAddress | string | 应用程序主 RPC 地址 |
allocatedMB | int | 分配给应用程序正在运行的容器的内存总和(以 MB 为单位) |
allocatedVCores | int | 分配给应用程序正在运行的容器的虚拟内核总和 |
runningContainers | int | 当前为应用程序运行的容器数 |
memorySeconds | long | 应用程序已分配的内存量(兆字节秒) |
vcoreSeconds | long | 应用程序已分配的 CPU 资源量(虚拟内核秒) |
queueUsagePercentage | 浮点数 | 应用程序正在使用的队列资源百分比 |
clusterUsagePercentage | 浮点数 | 应用程序正在使用的集群资源百分比。 |
preemptedResourceMB | long | 被抢占容器使用的内存 |
preemptedResourceVCores | long | 被抢占容器使用的虚拟核心数 |
numNonAMContainerPreempted | int | 被抢占的标准容器数 |
numAMContainerPreempted | int | 被抢占的应用程序主容器数 |
logAggregationStatus | string | 日志聚合状态 - 有效值是 LogAggregationStatus 枚举的成员:DISABLED、NOT_START、RUNNING、RUNNING_WITH_FAILURE、SUCCEEDED、FAILED、TIME_OUT |
unmanagedApplication | 布尔值 | 应用程序是否为非托管。 |
appNodeLabelExpression | string | 节点标签表达式,用于识别应用程序容器默认情况下应在哪些节点上运行。 |
amNodeLabelExpression | string | 节点标签表达式,用于识别应用程序 AM 容器应在哪个节点上运行。 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1476912658570_0002
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "app": { "id": "application_1476912658570_0002", "user": "user2", "name": "word count", "queue": "default", "state": "FINISHED", "finalStatus": "SUCCEEDED", "progress": 100, "trackingUI": "History", "trackingUrl": "http://host.domain.com:8088/cluster/app/application_1476912658570_0002", "diagnostics": "...", "clusterId": 1476912658570, "applicationType": "YARN", "applicationTags": "", "priority": -1, "startedTime": 1476913457320, "finishedTime": 1476913761898, "elapsedTime": 304578, "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_1476912658570_0002_02_000001/dr.who", "amHostHttpAddress": "host.domain.com:8042", "allocatedMB": -1, "allocatedVCores": -1, "runningContainers": -1, "memorySeconds": 206464, "vcoreSeconds": 201, "queueUsagePercentage": 0, "clusterUsagePercentage": 0, "preemptedResourceMB": 0, "preemptedResourceVCores": 0, "numNonAMContainerPreempted": 0, "numAMContainerPreempted": 0, "logAggregationStatus": "DISABLED", "unmanagedApplication": false, "appNodeLabelExpression": "", "amNodeLabelExpression": "" } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1326821518301_0005 Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 847 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <app> <id>application_1476912658570_0002</id> <user>user2</user> <name>word count</name> <queue>default</queue> <state>FINISHED</state> <finalStatus>SUCCEEDED</finalStatus> <progress>100.0</progress> <trackingUI>History</trackingUI> <trackingUrl>http://host.domain.com:8088/cluster/app/application_1476912658570_0002</trackingUrl> <diagnostics>...</diagnostics> <clusterId>1476912658570</clusterId> <applicationType>YARN</applicationType> <applicationTags></applicationTags> <priority>-1</priority> <startedTime>1476913457320</startedTime> <finishedTime>1476913761898</finishedTime> <elapsedTime>304578</elapsedTime> <amContainerLogs>http://host.domain.com:8042/node/containerlogs/container_1476912658570_0002_02_000001/dr.who</amContainerLogs> <amHostHttpAddress>host.domain.com:8042</amHostHttpAddress> <allocatedMB>-1</allocatedMB> <allocatedVCores>-1</allocatedVCores> <runningContainers>-1</runningContainers> <memorySeconds>206464</memorySeconds> <vcoreSeconds>201</vcoreSeconds> <queueUsagePercentage>0.0</queueUsagePercentage> <clusterUsagePercentage>0.0</clusterUsagePercentage> <preemptedResourceMB>0</preemptedResourceMB> <preemptedResourceVCores>0</preemptedResourceVCores> <numNonAMContainerPreempted>0</numNonAMContainerPreempted> <numAMContainerPreempted>0</numAMContainerPreempted> <logAggregationStatus>DISABLED</logAggregationStatus> <unmanagedApplication>false</unmanagedApplication> <appNodeLabelExpression></appNodeLabelExpression> <amNodeLabelExpression></amNodeLabelExpression> </app>
使用应用程序尝试 API,您可以获取表示应用程序尝试的资源集合。当您对该资源运行 GET 操作时,您将获得应用程序尝试对象集合。
None
当您请求应用程序尝试列表时,信息将作为应用程序尝试对象数组返回。
appAttempts
项目 | 数据类型 | 描述 |
---|---|---|
appAttempt | 应用程序尝试对象数组(JSON)/零个或多个应用程序尝试对象(XML) | 应用程序尝试对象集合 |
项目 | 数据类型 | 描述 |
---|---|---|
id | string | 应用程序尝试 ID |
nodeId | string | 尝试运行所在的节点的节点 ID |
nodeHttpAddress | string | 尝试运行所在的节点的节点 HTTP 地址 |
logsLink | string | 应用程序尝试日志的 HTTP 链接 |
containerId | string | 应用程序尝试的容器 ID |
startTime | long | 尝试的开始时间(自纪元以来的毫秒数) |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1326821518301_0005/appattempts
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "appAttempts" : { "appAttempt" : [ { "nodeId" : "host.domain.com:8041", "nodeHttpAddress" : "host.domain.com:8042", "startTime" : 1326381444693, "id" : 1, "logsLink" : "http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001/user1", "containerId" : "container_1326821518301_0005_01_000001" } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1326821518301_0005/appattempts Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 575 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appAttempts> <appttempt> <nodeHttpAddress>host.domain.com:8042</nodeHttpAddress> <nodeId>host.domain.com:8041</nodeId> <id>1</id> <startTime>1326381444693</startTime> <containerId>container_1326821518301_0005_01_000001</containerId> <logsLink>http://host.domain.com:8042/node/containerlogs/container_1326821518301_0005_01_000001/user1</logsLink> </appAttempt> </appAttempts>
使用容器获取应用程序尝试 API,您可以获取属于应用程序尝试的容器列表。
None
当您请求容器列表时,信息将作为容器对象数组返回。
容器
项目 | 数据类型 | 描述 |
---|---|---|
容器 | 应用程序容器对象数组 (JSON)/零个或多个容器对象 (XML) | 应用程序容器对象的集合 |
项目 | 数据类型 | 描述 | |
---|---|---|---|
containerId | string | 容器 ID | |
allocatedMB | long | 分配给容器的内存量(单位:MB) | |
allocatedVCores | int | 分配给容器的虚拟内核数 | |
assignedNodeId | string | 尝试运行所在的节点的节点 ID | |
priority | int | 容器的分配优先级 | |
startedTime | long | 尝试的开始时间(自纪元以来的毫秒数) | |
finishedTime | long | 尝试完成时间(自纪元以来的毫秒数),如果未完成,则为 0 | |
elapsedTime | long | 自 startedTime 以来经过的毫秒数 | |
logUrl | string | 可用于检查容器日志的 Web URL | |
containerExitStatus | int | 容器的最终退出状态 | |
containerState | string | 容器状态,可以是 NEW、RUNNING 或 COMPLETE | |
nodeHttpAddress | string | 尝试运行所在的节点的节点 HTTP 地址 | |
nodeId | string | 尝试运行所在的节点的节点 ID | |
allocatedResources | 资源数组 (JSON)/零个或多个资源对象 (XML) | 分配给容器的资源 |
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 容器的最大内存 |
vCores | int | 容器的最大 vcore 数 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/appattempts/{appAttemptId}/containers
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "containers" : { "container": [ { "containerId": "container_1531404209605_0008_01_000001", "allocatedMB": "1536", "allocatedVCores": "1", "assignedNodeId": "host.domain.com:37814", "priority": "0", "startedTime": "1531405909444", "finishedTime": "0", "elapsedTime": "4112", "logUrl": "http://host.domain.com:8042/node/containerlogs/container_1531404209605_0008_01_000001/systest", "containerExitStatus": "0", "containerState": "RUNNING", "nodeHttpAddress": "http://host.domain.com:8042", "nodeId": "host.domain.com:37814", "allocatedResources": [ { "key": "memory-mb", "value": "1536" }, { "key": "vcores", "value": "1" } ] } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/appattempts/{appAttemptId}/containers Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 1104 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <containers> <container> <containerId>container_1531404209605_0008_01_000001</containerId> <allocatedMB>1536</allocatedMB> <allocatedVCores>1</allocatedVCores> <assignedNodeId>host.domain.com:37814</assignedNodeId> <priority>0</priority> <startedTime>1531405909444</startedTime> <finishedTime>0</finishedTime> <elapsedTime>4112</elapsedTime> <logUrl> http://host.domain.com:8042/node/containerlogs/container_1531404209605_0008_01_000001/systest </logUrl> <containerExitStatus>0</containerExitStatus> <containerState>RUNNING</containerState> <nodeHttpAddress>http://host.domain.com:8042</nodeHttpAddress> <nodeId>host.domain.com:37814</nodeId> <allocatedResources> <entry> <key>memory-mb</key> <value>1536</value> </entry> <entry> <key>vcores</key> <value>1</value> </entry> </allocatedResources> </container> </containers>
使用应用程序尝试 API 的特定容器,您可以获取有关特定容器的信息,该容器属于应用程序尝试并由容器 ID 选择。
None
项目 | 数据类型 | 描述 | |
---|---|---|---|
containerId | string | 容器 ID | |
allocatedMB | long | 分配给容器的内存量(单位:MB) | |
allocatedVCores | int | 分配给容器的虚拟内核数 | |
assignedNodeId | string | 尝试运行所在的节点的节点 ID | |
priority | int | 容器的分配优先级 | |
startedTime | long | 尝试的开始时间(自纪元以来的毫秒数) | |
finishedTime | long | 尝试完成时间(自纪元以来的毫秒数),如果未完成,则为 0 | |
elapsedTime | long | 自 startedTime 以来经过的毫秒数 | |
logUrl | string | 可用于检查容器日志的 Web URL | |
containerExitStatus | int | 容器的最终退出状态 | |
containerState | string | 容器状态,可以是 NEW、RUNNING 或 COMPLETE | |
nodeHttpAddress | string | 尝试运行所在的节点的节点 HTTP 地址 | |
nodeId | string | 尝试运行所在的节点的节点 ID | |
allocatedResources | 资源数组 (JSON)/零个或多个资源对象 (XML) | 分配给容器的资源 |
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 容器的最大内存 |
vCores | int | 容器的最大 vcore 数 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/appattempts/{appAttemptId}/containers/{containerId}
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "container": { "containerId": "container_1531404209605_0008_01_000001", "allocatedMB": "1536", "allocatedVCores": "1", "assignedNodeId": "host.domain.com:37814", "priority": "0", "startedTime": "1531405909444", "finishedTime": "0", "elapsedTime": "4112", "logUrl": "http://host.domain.com:8042/node/containerlogs/container_1531404209605_0008_01_000001/systest", "containerExitStatus": "0", "containerState": "RUNNING", "nodeHttpAddress": "http://host.domain.com:8042", "nodeId": "host.domain.com:37814", "allocatedResources": [ { "key": "memory-mb", "value": "1536" }, { "key": "vcores", "value": "1" } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/appattempts/{appAttemptId}/containers/{containerId} Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 1104 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <container> <containerId>container_1531404209605_0008_01_000001</containerId> <allocatedMB>1536</allocatedMB> <allocatedVCores>1</allocatedVCores> <assignedNodeId>host.domain.com:37814</assignedNodeId> <priority>0</priority> <startedTime>1531405909444</startedTime> <finishedTime>0</finishedTime> <elapsedTime>4112</elapsedTime> <logUrl> http://host.domain.com:8042/node/containerlogs/container_1531404209605_0008_01_000001/systest </logUrl> <containerExitStatus>0</containerExitStatus> <containerState>RUNNING</containerState> <nodeHttpAddress>http://host.domain.com:8042</nodeHttpAddress> <nodeId>host.domain.com:37814</nodeId> <allocatedResources> <entry> <key>memory-mb</key> <value>1536</value> </entry> <entry> <key>vcores</key> <value>1</value> </entry> </allocatedResources> </container>
使用节点 API,您可以获取资源集合,其中每个资源都表示一个节点。当您对此资源运行 GET 操作时,您将获得节点对象集合。
当您请求节点列表时,信息将以节点对象集合的形式返回。另请参阅 Node API 了解节点对象的语法。
项目 | 数据类型 | 描述 |
---|---|---|
node | 节点对象数组 (JSON)/零个或多个节点对象 (XML) | 节点对象集合 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/nodes
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "nodes": { "node": [ { "rack":"\/default-rack", "state":"RUNNING", "id":"host.domain.com:54158", "nodeHostName":"host.domain.com", "nodeHTTPAddress":"host.domain.com:8042", "lastHealthUpdate": 1476995346399, "version": "3.0.0-alpha2-SNAPSHOT", "healthReport":"", "numContainers":0, "usedMemoryMB":0, "availMemoryMB":8192, "usedVirtualCores":0, "availableVirtualCores":8, "resourceUtilization": { "nodePhysicalMemoryMB":1027, "nodeVirtualMemoryMB":1027, "nodeCPUUsage":0.016661113128066063, "aggregatedContainersPhysicalMemoryMB":0, "aggregatedContainersVirtualMemoryMB":0, "containersCPUUsage":0 } }, { "rack":"\/default-rack", "state":"RUNNING", "id":"host.domain.com:54158", "nodeHostName":"host.domain.com", "nodeHTTPAddress":"host.domain.com:8042", "lastHealthUpdate":1476995346399, "version":"3.0.0-alpha2-SNAPSHOT", "healthReport":"", "numContainers":0, "usedMemoryMB":0, "availMemoryMB":8192, "usedVirtualCores":0, "availableVirtualCores":8, "resourceUtilization": { "nodePhysicalMemoryMB":1027, "nodeVirtualMemoryMB":1027, "nodeCPUUsage":0.016661113128066063, "aggregatedContainersPhysicalMemoryMB":0, "aggregatedContainersVirtualMemoryMB":0, "containersCPUUsage":0 } } ] } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/nodes Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 1104 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <nodes> <node> <rack>/default-rack</rack> <state>RUNNING</state> <id>host1.domain.com:54158</id> <nodeHostName>host1.domain.com</nodeHostName> <nodeHTTPAddress>host1.domain.com:8042</nodeHTTPAddress> <lastHealthUpdate>1476995346399</lastHealthUpdate> <version>3.0.0-SNAPSHOT</version> <healthReport></healthReport> <numContainers>0</numContainers> <usedMemoryMB>0</usedMemoryMB> <availMemoryMB>8192</availMemoryMB> <usedVirtualCores>0</usedVirtualCores> <availableVirtualCores>8</availableVirtualCores> <resourceUtilization> <nodePhysicalMemoryMB>1027</nodePhysicalMemoryMB> <nodeVirtualMemoryMB>1027</nodeVirtualMemoryMB> <nodeCPUUsage>0.006664445623755455</nodeCPUUsage> <aggregatedContainersPhysicalMemoryMB>0</aggregatedContainersPhysicalMemoryMB> <aggregatedContainersVirtualMemoryMB>0</aggregatedContainersVirtualMemoryMB> <containersCPUUsage>0.0</containersCPUUsage> </resourceUtilization> </node> <node> <rack>/default-rack</rack> <state>RUNNING</state> <id>host2.domain.com:54158</id> <nodeHostName>host2.domain.com</nodeHostName> <nodeHTTPAddress>host2.domain.com:8042</nodeHTTPAddress> <lastHealthUpdate>1476995346399</lastHealthUpdate> <version>3.0.0-SNAPSHOT</version> <healthReport></healthReport> <numContainers>0</numContainers> <usedMemoryMB>0</usedMemoryMB> <availMemoryMB>8192</availMemoryMB> <usedVirtualCores>0</usedVirtualCores> <availableVirtualCores>8</availableVirtualCores> <resourceUtilization> <nodePhysicalMemoryMB>1027</nodePhysicalMemoryMB> <nodeVirtualMemoryMB>1027</nodeVirtualMemoryMB> <nodeCPUUsage>0.006664445623755455</nodeCPUUsage> <aggregatedContainersPhysicalMemoryMB>0</aggregatedContainersPhysicalMemoryMB> <aggregatedContainersVirtualMemoryMB>0</aggregatedContainersVirtualMemoryMB> <containersCPUUsage>0.0</containersCPUUsage> </resourceUtilization> </node> </nodes>
节点资源包含群集中某个节点的信息。
使用以下 URI 从由 nodeid 值标识的节点获取节点对象。
None
项目 | 数据类型 | 描述 |
---|---|---|
rack | string | 此节点的机架位置 |
state | string | 节点状态 - 有效值包括:NEW、RUNNING、UNHEALTHY、DECOMMISSIONING、DECOMMISSIONED、LOST、REBOOTED、SHUTDOWN |
id | string | 节点 ID |
nodeHostName | string | 节点的主机名 |
nodeHTTPAddress | string | 节点的 HTTP 地址 |
lastHealthUpdate | long | 节点上次报告其运行状况的时间(自纪元以来的毫秒数) |
version | string | 在节点上运行的 Hadoop 版本 |
healthReport | string | 详细运行状况报告 |
numContainers | int | 当前在节点上运行的容器总数 |
usedMemoryMB | long | 当前在节点上使用的内存总量(以 MB 为单位) |
availMemoryMB | long | 当前在节点上可用的内存总量(以 MB 为单位) |
usedVirtualCores | long | 当前在节点上使用的 vCore 总数 |
availableVirtualCores | long | 节点上可用的 vCore 总数 |
resourceUtilization | 对象 | 节点上的资源利用率 |
totalResource | 对象 | 节点上的资源 |
resourceUtilization 对象包含以下元素
项目 | 数据类型 | 描述 |
---|---|---|
nodePhysicalMemoryMB | int | 节点物理内存利用率 |
nodeVirtualMemoryMB | int | 节点虚拟内存利用率 |
nodeCPUUsage | 双精度浮点数 | 节点 CPU 利用率 |
aggregatedContainersPhysicalMemoryMB | int | 容器的聚合物理内存利用率 |
aggregatedContainersVirtualMemoryMB | int | 容器的聚合虚拟内存利用率 |
containersCPUUsage | 双精度浮点数 | 容器的聚合 CPU 利用率 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/nodes/h2:1235
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "node": { "rack":"\/default-rack", "state":"RUNNING", "id":"host.domain.com:54158", "nodeHostName":"host.domain.com", "nodeHTTPAddress":"host.domain.com:8042", "lastHealthUpdate":1476916746399, "version":"3.0.0-SNAPSHOT", "healthReport":"", "numContainers":0, "usedMemoryMB":0, "availMemoryMB":8192, "usedVirtualCores":0, "availableVirtualCores":8, "resourceUtilization": { "nodePhysicalMemoryMB": 968, "nodeVirtualMemoryMB": 968, "nodeCPUUsage": 0.01332889124751091, "aggregatedContainersPhysicalMemoryMB": 0, "aggregatedContainersVirtualMemoryMB": 0, "containersCPUUsage": 0 }, "totalResource": { "memory": 2048, "vCores": 5 } } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/node/h2:1235 Accept: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 552 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <node> <rack>/default-rack</rack> <state>RUNNING</state> <id>host.domain.com:54158</id> <nodeHostName>host.domain.com</nodeHostName> <nodeHTTPAddress>host.domain.com:8042</nodeHTTPAddress> <lastHealthUpdate>1476916746399</lastHealthUpdate> <version>3.0.0-SNAPSHOT</version> <healthReport></healthReport> <numContainers>0</numContainers> <usedMemoryMB>0</usedMemoryMB> <availMemoryMB>8192</availMemoryMB> <usedVirtualCores>0</usedVirtualCores> <availableVirtualCores>8</availableVirtualCores> <resourceUtilization> <nodePhysicalMemoryMB>968</nodePhysicalMemoryMB> <nodeVirtualMemoryMB>968</nodeVirtualMemoryMB> <nodeCPUUsage>0.01332889124751091</nodeCPUUsage> <aggregatedContainersPhysicalMemoryMB>0</aggregatedContainersPhysicalMemoryMB> <aggregatedContainersVirtualMemoryMB>0</aggregatedContainersVirtualMemoryMB> <containersCPUUsage>0.0</containersCPUUsage> </resourceUtilization> <totalResource> <memory>2048</memory> <vCores>5</vCores> </totalResource> </node>
更新节点中的总资源。
使用以下 URI 更新由 nodeid 值标识的 Node 对象的资源。
http://rm-http-address:port/ws/v1/cluster/nodes/{nodeid}/resource
POST
None
项目 | 数据类型 | 描述 |
---|---|---|
memory | long | 在节点上设置的内存总量(以 MB 为单位) |
vcores | long | 在节点上设置的 vCore 总数 |
overCommitTimeout | long | 抢占容器的超时时间 |
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/nodes/h2:1235/resource
请求正文
{ "resource": { "memory": 1024, "vCores": 3 }, "overCommitTimeout": -1 }
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "resourceInfo": { "memory": 8192, "vCores": 5 } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/node/h2:1235/resource Accept: application/xml
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <resourceOption> <resource> <memory>8192</memory> <vCores>5</vCores> </resource> <overCommitTimeout>1000</overCommitTimeout> </resourceOption>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 552 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <resourceInfo> <memory>8192</memory> <vCores>5</vCores> </resourceInfo>
以下部分引用了允许创建和修改应用程序的 API。这些 API 目前处于 alpha 阶段,将来可能会发生变化。
使用新应用程序 API,您可以获取一个应用程序 ID,然后将其用作 集群提交应用程序 API 的一部分来提交应用程序。响应还包括群集上可用的最大资源功能。
此功能目前处于 alpha 阶段,将来可能会发生变化。
None
NewApplication 响应包含以下元素
项目 | 数据类型 | 描述 |
---|---|---|
application-id | string | 新创建的应用程序 ID |
maximum-resource-capabilities | 对象 | 此群集上可用的最大资源功能 |
maximum-resource-capabilites 对象包含以下元素
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 容器可用的最大内存 |
vCores | int | 容器可用的最大内核数 |
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/apps/new-application
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "application-id":"application_1404198295326_0003", "maximum-resource-capability": { "memory":8192, "vCores":32 } }
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/apps/new-application
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 248 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <NewApplication> <application-id>application_1404198295326_0003</application-id> <maximum-resource-capability> <memory>8192</memory> <vCores>32</vCores> </maximum-resource-capability> </NewApplication>
提交应用程序 API 可用于提交应用程序。在提交应用程序时,您必须首先使用 集群新应用程序 API 获取应用程序 ID。应用程序 ID 必须是请求正文的一部分。响应包含指向应用程序页面的 URL,该 URL 可用于跟踪应用程序的状态和进度。
POST 请求可用于向 ResourceManager 提交应用。如上所述,必须首先获取应用程序 ID。成功提交将产生 202 响应代码和一个 Location 头,指定从哪里获取有关应用的信息。请注意,为了提交应用,您必须为 HTTP 接口设置身份验证过滤器。该功能要求在 HttpServletRequest 中设置用户名。如果未设置过滤器,则响应将为“UNAUTHORIZED”响应。
请注意,此功能目前处于 alpha 阶段,将来可能会发生变化。
项目 | 数据类型 | 描述 |
---|---|---|
application-id | string | 应用程序 ID |
application-name | string | 应用程序名称 |
queue | string | 应向其提交应用程序的队列名称 |
priority | int | 应用程序的优先级 |
am-container-spec | 对象 | 应用程序主容器启动上下文,如下所述 |
unmanaged-AM | 布尔值 | 应用程序是否使用非托管应用程序主服务器 |
max-app-attempts | int | 此应用程序的最大尝试次数 |
resource | 对象 | 应用程序主服务器所需资源,如下所述 |
application-type | string | 应用程序类型(MapReduce、Pig、Hive 等) |
keep-containers-across-application-attempts | 布尔值 | YARN 是否应保留此应用程序使用的容器,而不是销毁它们 |
application-tags | 对象 | 应用程序标签列表,请参阅请求示例以了解如何指定标签 |
log-aggregation-context | 对象 | 表示 NodeManager 处理此应用程序的日志所需的所有信息 |
attempt-failures-validity-interval | long | 失败次数不会将超出有效性间隔发生的尝试失败计入失败次数 |
reservation-id | string | 表示调度器中相应保留资源分配的唯一 ID |
am-black-listing-requests | 对象 | 包含黑名单信息,例如“启用/禁用 AM 黑名单”和“禁用故障阈值” |
am-container-spec 对象的元素
am-container-spec 对象应用于为应用程序主服务器提供容器启动上下文。
项目 | 数据类型 | 描述 |
---|---|---|
local-resources | 对象 | 描述需要本地化的资源的对象,如下所述 |
environment | 对象 | 容器的环境变量,指定为键值对 |
commands | 对象 | 用于启动容器的命令,按应执行的顺序排列 |
service-data | 对象 | 应用程序特定的服务数据;键是辅助服务的名称,值是要传递的数据的 base-64 编码 |
credentials | 对象 | 应用程序运行所需的凭据,如下所述 |
application-acls | objec | 应用程序的 ACL;键可以是“VIEW_APP”或“MODIFY_APP”,值是具有权限的用户列表 |
local-resources 对象的元素
该对象是键值对的集合。键是待本地化的资源的标识符,值是资源的详细信息。值的元素如下所述
项目 | 数据类型 | 描述 |
---|---|---|
resource | string | 待本地化的资源的位置 |
type | string | 资源类型;选项为“ARCHIVE”、“FILE”和“PATTERN” |
visibility | string | 要本地化的资源可见性;选项为“PUBLIC”、“PRIVATE”和“APPLICATION” |
size | long | 要本地化的资源大小 |
timestamp | long | 要本地化的资源时间戳 |
credentials 对象的元素
credentials 对象应用于传递应用程序进行自我身份验证所需的数据,例如委派令牌和密钥。
项目 | 数据类型 | 描述 |
---|---|---|
tokens | 对象 | 您希望传递给应用程序的令牌,指定为键值对。键是令牌的标识符,值是令牌(应使用相应的 Web 服务获取) |
secrets | 对象 | 您希望在应用程序中使用的密钥,指定为键值对。键是标识符,值是密钥的 base-64 编码 |
POST 请求正文 resource 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 每个容器所需的内存 |
vCores | int | 每个容器所需的虚拟内核 |
POST 请求正文 log-aggregation-context 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
log-include-pattern | string | 与定义的 include 模式匹配的日志文件将在应用程序完成后上传 |
log-exclude-pattern | string | 与定义的 exclude 模式匹配的日志文件将在应用程序完成后不会上传 |
rolled-log-include-pattern | string | 与定义的 include 模式匹配的日志文件将以滚动方式聚合 |
rolled-log-exclude-pattern | string | 与定义的 exclude 模式匹配的日志文件将不会以滚动方式聚合 |
log-aggregation-policy-class-name | string | NodeManager 将使用该策略聚合日志 |
log-aggregation-policy-parameters | string | 传递给策略类的参数 |
POST 请求正文 am-black-listing-requests 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
am-black-listing-enabled | 布尔值 | AM 黑名单是否启用 |
disable-failure-threshold | 浮点数 | AM 黑名单禁用失败阈值 |
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/apps Accept: application/json Content-Type: application/json { "application-id":"application_1404203615263_0001", "application-name":"test", "am-container-spec": { "local-resources": { "entry": [ { "key":"AppMaster.jar", "value": { "resource":"hdfs://hdfs-namenode:9000/user/testuser/DistributedShell/demo-app/AppMaster.jar", "type":"FILE", "visibility":"APPLICATION", "size": 43004, "timestamp": 1405452071209 } } ] }, "commands": { "command":"{{JAVA_HOME}}/bin/java -Xmx10m org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster --container_memory 10 --container_vcores 1 --num_containers 1 --priority 0 1><LOG_DIR>/AppMaster.stdout 2><LOG_DIR>/AppMaster.stderr" }, "environment": { "entry": [ { "key": "DISTRIBUTEDSHELLSCRIPTTIMESTAMP", "value": "1405459400754" }, { "key": "CLASSPATH", "value": "{{CLASSPATH}}<CPS>./*<CPS>{{HADOOP_CONF_DIR}}<CPS>{{HADOOP_COMMON_HOME}}/share/hadoop/common/*<CPS>{{HADOOP_COMMON_HOME}}/share/hadoop/common/lib/*<CPS>{{HADOOP_HDFS_HOME}}/share/hadoop/hdfs/*<CPS>{{HADOOP_HDFS_HOME}}/share/hadoop/hdfs/lib/*<CPS>{{HADOOP_YARN_HOME}}/share/hadoop/yarn/*<CPS>{{HADOOP_YARN_HOME}}/share/hadoop/yarn/lib/*<CPS>./log4j.properties" }, { "key": "DISTRIBUTEDSHELLSCRIPTLEN", "value": "6" }, { "key": "DISTRIBUTEDSHELLSCRIPTLOCATION", "value": "hdfs://hdfs-namenode:9000/user/testuser/demo-app/shellCommands" } ] } }, "unmanaged-AM":false, "max-app-attempts":2, "resource": { "memory":1024, "vCores":1 }, "application-type":"YARN", "keep-containers-across-application-attempts":false, "log-aggregation-context": { "log-include-pattern":"file1", "log-exclude-pattern":"file2", "rolled-log-include-pattern":"file3", "rolled-log-exclude-pattern":"file4", "log-aggregation-policy-class-name":"org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation.AllContainerLogAggregationPolicy", "log-aggregation-policy-parameters":"" }, "attempt-failures-validity-interval":3600000, "reservation-id":"reservation_1454114874_1", "am-black-listing-requests": { "am-black-listing-enabled":true, "disable-failure-threshold":0.01 } }
响应标头
HTTP/1.1 202 Transfer-Encoding: chunked Location: http://rm-http-address:port/ws/v1/cluster/apps/application_1404203615263_0001 Content-Type: application/json Server: Jetty(6.1.26)
响应正文
No response body
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/apps Accept: application/xml Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <application-submission-context> <application-id>application_1404204891930_0002</application-id> <application-name>test</application-name> <queue>testqueue</queue> <priority>3</priority> <am-container-spec> <local-resources> <entry> <key>example</key> <value> <resource>hdfs://hdfs-namenode:9000/user/testuser/DistributedShell/demo-app/AppMaster.jar</resource> <type>FILE</type> <visibility>APPLICATION</visibility> <size>43004</size> <timestamp>1405452071209</timestamp> </value> </entry> </local-resources> <environment> <entry> <key>DISTRIBUTEDSHELLSCRIPTTIMESTAMP</key> <value>1405459400754</value> </entry> <entry> <key>CLASSPATH</key> <value>{{CLASSPATH}}<CPS>./*<CPS>{{HADOOP_CONF_DIR}}<CPS>{{HADOOP_COMMON_HOME}}/share/hadoop/common/*<CPS>{{HADOOP_COMMON_HOME}}/share/hadoop/common/lib/*<CPS>{{HADOOP_HDFS_HOME}}/share/hadoop/hdfs/*<CPS>{{HADOOP_HDFS_HOME}}/share/hadoop/hdfs/lib/*<CPS>{{HADOOP_YARN_HOME}}/share/hadoop/yarn/*<CPS>{{HADOOP_YARN_HOME}}/share/hadoop/yarn/lib/*<CPS>./log4j.properties</value> </entry> <entry> <key>DISTRIBUTEDSHELLSCRIPTLEN</key> <value>6</value> </entry> <entry> <key>DISTRIBUTEDSHELLSCRIPTLOCATION</key> <value>hdfs://hdfs-namenode:9000/user/testuser/demo-app/shellCommands</value> </entry> </environment> <commands> <command>{{JAVA_HOME}}/bin/java -Xmx10m org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster --container_memory 10 --container_vcores 1 --num_containers 1 --priority 0 1><LOG_DIR>/AppMaster.stdout 2><LOG_DIR>/AppMaster.stderr</command> </commands> <service-data> <entry> <key>test</key> <value>dmFsdWUxMg</value> </entry> </service-data> <credentials> <tokens/> <secrets> <entry> <key>secret1</key> <value>c2VjcmV0MQ</value> </entry> </secrets> </credentials> <application-acls> <entry> <key>VIEW_APP</key> <value>testuser3, testuser4</value> </entry> <entry> <key>MODIFY_APP</key> <value>testuser1, testuser2</value> </entry> </application-acls> </am-container-spec> <unmanaged-AM>false</unmanaged-AM> <max-app-attempts>2</max-app-attempts> <resource> <memory>1024</memory> <vCores>1</vCores> </resource> <application-type>YARN</application-type> <keep-containers-across-application-attempts>false</keep-containers-across-application-attempts> <application-tags> <tag>tag 2</tag> <tag>tag1</tag> </application-tags> <log-aggregation-context> <log-include-pattern>file1</log-include-pattern> <log-exclude-pattern>file2</log-exclude-pattern> <rolled-log-include-pattern>file3</rolled-log-include-pattern> <rolled-log-exclude-pattern>file4</rolled-log-exclude-pattern> <log-aggregation-policy-class-name>org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation.AllContainerLogAggregationPolicy</log-aggregation-policy-class-name> <log-aggregation-policy-parameters></log-aggregation-policy-parameters> </log-aggregation-context> <attempt-failures-validity-interval>3600000</attempt-failures-validity-interval> <reservation-id>reservation_1454114874_1</reservation-id> <am-black-listing-requests> <am-black-listing-enabled>true</am-black-listing-enabled> <disable-failure-threshold>0.01</disable-failure-threshold> </am-black-listing-requests> </application-submission-context>
响应标头
HTTP/1.1 202 Transfer-Encoding: chunked Location: http://rm-http-address:port/ws/v1/cluster/apps/application_1404204891930_0002 Content-Type: application/xml Server: Jetty(6.1.26)
响应正文
No response body
使用应用程序状态 API,您可以查询已提交应用程序的状态,还可以通过使用 PUT 请求(其中状态设置为“KILLED”)修改正在运行的应用程序的状态来终止正在运行的应用程序。要执行 PUT 操作,必须为 RM Web 服务设置身份验证。此外,您必须被授权终止该应用程序。目前,您只能将状态更改为“KILLED”;尝试将状态更改为任何其他状态都会导致 400 错误响应。以下是未经授权和错误请求错误的示例。当您执行成功的 PUT 操作时,初始响应可能是 202。您可以通过重复 PUT 请求(直到获得 200)、使用 GET 方法查询状态或查询应用程序信息并检查状态来确认应用程序已终止。在以下示例中,我们重复 PUT 请求并获得 200 响应。
请注意,为了终止应用程序,您必须为 HTTP 接口设置身份验证过滤器。此功能要求在 HttpServletRequest 中设置用户名。如果没有设置过滤器,响应将为“UNAUTHORIZED”响应。
此功能目前处于 alpha 阶段,将来可能会发生变化。
None
当您请求应用程序的状态时,返回的信息具有以下字段
项目 | 数据类型 | 描述 |
---|---|---|
state | string | 应用程序状态 - 可以是“NEW”、“NEW_SAVING”、“SUBMITTED”、“ACCEPTED”、“RUNNING”、“FINISHED”、“FAILED”、“KILLED”之一 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "state":"ACCEPTED" }
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
{ "state":"KILLED" }
响应标头
HTTP/1.1 202 Accepted Content-Type: application/json Transfer-Encoding: chunked Location: http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003 Server: Jetty(6.1.26)
响应正文
{ "state":"ACCEPTED" } PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
{ "state":"KILLED" }
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "state":"KILLED" }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 99 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>ACCEPTED</state> </appstate>
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>KILLED</state> </appstate>
响应标头
HTTP/1.1 202 Accepted Content-Type: application/xml Content-Length: 794 Location: http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>ACCEPTED</state> </appstate>
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>KILLED</state> </appstate>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 917 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>KILLED</state> </appstate>
未经授权的错误响应
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>KILLED</state> </appstate>
响应标头
HTTP/1.1 403 Unauthorized Server: Jetty(6.1.26)
错误请求错误响应
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appstate> <state>RUNNING</state> </appstate>
响应标头
HTTP/1.1 400 Content-Length: 295 Content-Type: application/xml Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RemoteException> <exception>BadRequestException</exception> <message>java.lang.Exception: Only 'KILLED' is allowed as a target state.</message> <javaClassName>org.apache.hadoop.yarn.webapp.BadRequestException</javaClassName> </RemoteException>
使用应用程序队列 API,您可以查询已提交应用程序的队列,还可以使用指定目标队列的 PUT 请求将正在运行的应用程序移动到另一个队列。要执行 PUT 操作,必须为 RM Web 服务设置身份验证。此外,您必须被授权移动该应用程序。目前,只有在您使用容量调度程序或公平调度程序时,您才能移动该应用程序。
请注意,为了移动应用程序,您必须为 HTTP 接口设置身份验证过滤器。此功能要求在 HttpServletRequest 中设置用户名。如果没有设置过滤器,响应将为“UNAUTHORIZED”响应。
此功能目前处于 alpha 阶段,将来可能会发生变化。
None
当您请求应用程序的状态时,返回的信息具有以下字段
项目 | 数据类型 | 描述 |
---|---|---|
queue | string | 应用程序队列 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/queue
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "queue":"default" }
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/queue
请求正文
{ "queue":"test" }
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "queue":"test" }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/queue
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 98 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appqueue> <queue>default</queue> </appqueue>
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/queue
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appqueue> <queue>test</queue> </appqueue>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 95 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <appqueue> <queue>test</queue> </appqueue>
使用应用程序优先级 API,您可以查询已提交应用程序的优先级,以及使用指定目标优先级的 PUT 请求更新正在运行或已接受应用程序的优先级。要执行 PUT 操作,必须为 RM Web 服务设置身份验证。此外,您必须有权更新应用程序优先级。目前,您只能在使用容量调度程序时更新应用程序优先级。
请注意,要更新应用程序的优先级,您必须为 HTTP 接口设置身份验证过滤器。该功能要求在 HttpServletRequest 中设置用户名。如果没有设置过滤器,响应将为“UNAUTHORIZED”响应。
此功能目前处于 alpha 阶段,将来可能会发生变化。
None
当您请求应用程序的状态时,返回的信息具有以下字段
项目 | 数据类型 | 描述 |
---|---|---|
priority | int | 应用程序优先级 |
JSON 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/priority
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "priority":0 }
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/priority
请求正文
{ "priority":8 }
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "priority":8 }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/priority
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 98 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <applicationpriority> <priority>0</priority> </applicationpriority>
HTTP 请求
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/priority
请求正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <applicationpriority> <priority>8</priority> </applicationpriority>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 95 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <applicationpriority> <priority>8</priority> </applicationpriority>
委派令牌 API 可用于创建、续订和取消 YARN ResourceManager 委派令牌。所有委派令牌请求都必须在经过 Kerberos 身份验证的连接(使用 SPNEGO)上执行。在非 Kerberos 连接上执行操作将导致 FORBIDDEN 响应。在续订令牌的情况下,只有在创建令牌时指定的续订者才能续订令牌。其他用户(包括所有者)禁止续订令牌。需要注意的是,在取消或续订令牌时,要取消或续订的令牌是通过设置标头来指定的。
此功能目前处于 alpha 阶段,将来可能会发生变化。
使用以下 URI 创建和取消委派令牌。
使用以下 URI 续订委派令牌。
None
委派令牌 API 的响应包含下面列出的一个字段。
项目 | 数据类型 | 描述 |
---|---|---|
token | string | 委派令牌 |
renewer | string | 允许续订委派令牌的用户 |
owner | string | 委派令牌的所有者 |
kind | string | 委派令牌的类型 |
expiration-time | long | 令牌的到期时间 |
max-validity | long | 令牌的最大有效期 |
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/delegation-token Accept: application/json Content-Type: application/json { "renewer" : "test-renewer" }
响应标头
HTTP/1.1 200 OK WWW-Authenticate: Negotiate ... Date: Sat, 28 Jun 2014 18:08:11 GMT Server: Jetty(6.1.26) Set-Cookie: ... Content-Type: application/json
响应正文
{ "token":"MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUckiEZpigFHSJTKaQECFN9EMM9BzfPoDxu572EVUpzqhnSGE1JNX0RFTEVHQVRJT05fVE9LRU4A", "renewer":"test-renewer", "owner":"[email protected]", "kind":"RM_DELEGATION_TOKEN", "expiration-time":1405153616489, "max-validity":1405672016489 }
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/delegation-token Accept: application/xml Content-Type: application/xml <delegation-token> <renewer>test-renewer</renewer> </delegation-token>
响应标头
HTTP/1.1 200 OK WWW-Authenticate: Negotiate ... Date: Sat, 28 Jun 2014 18:08:11 GMT Content-Length: 423 Server: Jetty(6.1.26) Set-Cookie: ... Content-Type: application/xml
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <delegation-token> <token>MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUckgZ8yigFHSI4jMgcCFDTG8X6XFFn2udQngzSXQL8vWaKIE1JNX0RFTEVHQVRJT05fVE9LRU4A</token> <renewer>test-renewer</renewer> <owner>[email protected]</owner> <kind>RM_DELEGATION_TOKEN</kind> <expiration-time>1405153180466</expiration-time> <max-validity>1405671580466</max-validity> </delegation-token>
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/delegation-token/expiration Accept: application/json Hadoop-YARN-RM-Delegation-Token: MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUbjqcHHigFHB7ZFxwQCFKWD3znCkDSy6SQIjRCLDydxbxvgE1JNX0RFTEVHQVRJT05fVE9LRU4A Content-Type: application/json
响应标头
HTTP/1.1 200 OK WWW-Authenticate: Negotiate ... Date: Sat, 28 Jun 2014 18:08:11 GMT Server: Jetty(6.1.26) Set-Cookie: ... Content-Type: application/json
响应正文
{ "expiration-time":1404112520402 }
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/delegation-token/expiration Accept: application/xml Content-Type: application/xml Hadoop-YARN-RM-Delegation-Token: MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUbjqcHHigFHB7ZFxwQCFKWD3znCkDSy6SQIjRCLDydxbxvgE1JNX0RFTEVHQVRJT05fVE9LRU4A
响应标头
HTTP/1.1 200 OK WWW-Authenticate: Negotiate ... Date: Sat, 28 Jun 2014 18:08:11 GMT Content-Length: 423 Server: Jetty(6.1.26) Set-Cookie: ... Content-Type: application/xml
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <delegation-token> <expiration-time>1404112520402</expiration-time> </delegation-token>
HTTP 请求
DELETE http://rm-http-address:port/ws/v1/cluster/delegation-token Hadoop-YARN-RM-Delegation-Token: MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUbjqcHHigFHB7ZFxwQCFKWD3znCkDSy6SQIjRCLDydxbxvgE1JNX0RFTEVHQVRJT05fVE9LRU4A Accept: application/xml
响应标头
HTTP/1.1 200 OK WWW-Authenticate: Negotiate ... Date: Sun, 29 Jun 2014 07:25:18 GMT Transfer-Encoding: chunked Server: Jetty(6.1.26) Set-Cookie: ... Content-Type: application/xml
无响应正文。
此功能处于 alpha 模式,将来可能会更改。
使用 YARN RM Web 服务时,可以使用委派令牌对自身进行身份验证。但是,这需要设置正确的配置。条件如下
Hadoop 在安全模式下设置,身份验证类型设置为 kerberos。
Hadoop HTTP 身份验证在安全模式下设置,身份验证类型设置为 kerberos
设置后,可以使用上面列出的 Web 服务获取委派令牌,并按以下示例所示使用
PUT http://rm-http-address:port/ws/v1/cluster/apps/application_1399397633663_0003/state X-Hadoop-Delegation-Token: MgASY2xpZW50QEVYQU1QTEUuQ09NDHRlc3QtcmVuZXdlcgCKAUbjqcHHigFHB7ZFxwQCFKWD3znCkDSy6SQIjRCLDydxbxvgE1JNX0RFTEVHQVRJT05fVE9LRU4A Content-Type: application/json; charset=UTF8 { "state":"KILLED" }
群集预留 API 可用于列出预留。列出预留时,用户必须根据队列、预留 ID、开始时间或结束时间指定约束。用户还必须指定是否包括所列预留的全部资源分配。结果页面返回一个响应,其中包含与预留相关的信息,例如接受时间、用户、资源分配、预留 ID 以及预留定义。
项目 | 数据类型 | 描述 |
---|---|---|
reservations | ReservationInfo(JSON) 数组/零个或多个 ReservationInfo 对象(XML) | 使用给定查询列出的预留 |
项目 | 数据类型 | 描述 |
---|---|---|
acceptance-time | long | 接受预留的时间 |
resource-allocations | ResourceAllocationInfo(JSON) 数组/零个或多个 ResourceAllocationInfo 对象(XML) | 预留的资源分配信息 |
reservation-id | 单个 ReservationId 字符串 | 唯一的预留标识符 |
reservation-definition | 单个 ReservationDefinition 对象 | 一组约束,表示用户随时间推移对资源的需求 |
user | string | 进行预订的用户 |
项目 | 数据类型 | 描述 |
---|---|---|
resource | 单个 Resource 对象 | 为预订分配分配的资源 |
startTime | long | 为资源分配的开始时间 |
endTime | long | 为资源分配的结束时间 |
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 为预订分配分配的内存 |
vCores | int | 为预订分配分配的核心数 |
项目 | 数据类型 | 描述 |
---|---|---|
arrival | long | 此预订可从其分配的最早时间的 UTC 时间表示形式。 |
deadline | long | 此预订可分配到的最晚时间的 UTC 时间表示形式。 |
reservation-name | string | 预订的助记名称(不是有效的标识符)。 |
reservation-requests | 对象 | 此预订的“阶段”或阶段列表,每个列表都描述资源需求和持续时间 |
priority | int | 表示预订优先级的整数。优先级的较低数字表示优先级较高的预订。循环预订始终比非循环预订优先级高。非循环预订的优先级仅与非循环预订比较。循环预订也是如此。 |
recurrence-expression | string | 表示周期性作业时间段的循环表达式。目前,仅支持长值。稍后,将添加对表示任意循环模式(例如,每周二和周四)的正则表达式的支持。循环以毫秒为单位表示周期性作业。非周期性作业的循环为 0。周期性作业在明确取消之前有效,并且优先级高于非周期性作业(在初始放置和重新规划期间)。周期性作业分配在各个运行中保持一致(仅在初始放置期间利用分配灵活性,之后分配保持一致)。请注意,循环表达式必须大于预订的持续时间(截止时间 - 到达时间)。另请注意,配置的最大周期必须可以被循环表达式整除。 |
项目 | 数据类型 | 描述 |
---|---|---|
reservation-request-interpreter | int | 如何解释 ReservationRequest 组的数字选择:0 为 ANY,1 为 ALL,2 为 ORDER,3 为 ORDER_NO_GAP |
reservation-request | 对象 | 此预订的阶段/阶段的资源和时间功能的描述 |
项目 | 数据类型 | 描述 |
---|---|---|
duration | long | ReservationRequest 的持续时间,以毫秒为单位(此部分预留应存在的连续毫秒数)。 |
num-containers | int | 此预留阶段中所需的容器数(捕获此阶段中作业的最大并行度)。 |
min-concurrency | int | 为满足此分配而必须同时分配的最小容器数(捕获最小并行度,可用于表示 gang 语义)。 |
capability | 对象 | 允许指定每个容器的大小(内存、vCores)。 |
Get 请求可用于向 ResourceManager 列出预留。如上所述,成功后会返回与预留相关的信息(在答案的正文中)。成功的列表请求将导致 200 响应。请注意,为了提交预留,您必须为 HTTP 接口设置身份验证过滤器。该功能要求在 HttpServletRequest 中设置用户名。如果未设置过滤器,响应将是“UNAUTHORIZED”响应。请注意,此功能目前处于 alpha 阶段,将来可能会发生更改。
JSON 响应
此请求返回在开始时间 1455159355000 和 1475160036000 之内的所有活动预留。由于 include-resource-allocations 设置为 true,因此响应中将包括完整的资源分配集。
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/reservation/list?queue=dedicated&start-time=1455159355000&end-time=1475160036000&include-resource-allocations=true
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Cache-Control: no-cache Content-Encoding: gzip Pragma: no-cache,no-cache Server: Jetty(6.1.26)
响应正文
{ "reservations": { "acceptance-time": "1455160008442", "user": "submitter", "resource-allocations": [ { "resource": { "memory": "0", "vCores": "0" }, "startTime": "1465541532000", "endTime": "1465542250000" }, { "resource": { "memory": "1024", "vCores": "1" }, "startTime": "1465542250000", "endTime": "1465542251000" }, { "resource": { "memory": "0", "vCores": "0" }, "startTime": "1465542251000", "endTime": "1465542252000" } ], "reservation-id": "reservation_1458852875788_0002", "reservation-definition": { "arrival": "1465541532000", "deadline": "1465542252000", "reservation-requests": { "reservation-request-interpreter": "0", "reservation-request": { "capability": { "memory": "1024", "vCores": "1" }, "min-concurrency": "1", "num-containers": "1", "duration": "60" } }, "reservation-name": "res_1" } } }
XML 响应
HTTP 请求
GET http://rm-http-address:port/ws/v1/cluster/reservation/list?queue=dedicated&start-time=1455159355000&end-time=1475160036000&include-resource-allocations=true
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-length: 395 Cache-Control: no-cache Content-Encoding: gzip Pragma: no-cache,no-cache Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <reservationListInfo> <reservations> <acceptance-time>1455233661003</acceptance-time> <user>dr.who</user> <resource-allocations> <resource> <memory>0</memory> <vCores>0</vCores> </resource> <startTime>1465541532000</startTime> <endTime>1465542251000</endTime> </resource-allocations> <resource-allocations> <resource> <memory>1024</memory> <vCores>1</vCores> </resource> <startTime>1465542251000</startTime> <endTime>1465542252000</endTime> </resource-allocations> <reservation-id>reservation_1458852875788_0002</reservation-id> <reservation-definition> <arrival>1465541532000</arrival> <deadline>1465542252000</deadline> <reservation-requests> <reservation-request-interpreter>0</reservation-request-interpreter> <reservation-request> <capability> <memory>1024</memory> <vCores>1</vCores> </capability> <min-concurrency>1</min-concurrency> <num-containers>1</num-containers> <duration>60</duration> </reservation-request> </reservation-requests> <reservation-name>res_1</reservation-name> </reservation-definition> </reservations> </reservationListInfo>
使用新预留 API 获取预留 ID,然后可将其用作 集群预留 API 提交 的一部分来提交预留。
此功能目前处于 alpha 阶段,将来可能会发生变化。
None
new-reservation 响应包含以下元素
项目 | 数据类型 | 描述 |
---|---|---|
reservation-id | string | 新创建的预留 ID |
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/reservation/new-reservation
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "reservation-id":"reservation_1404198295326_0003" }
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/reservation/new-reservation
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 248 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <new-reservation> <reservation-id>reservation_1404198295326_0003</reservation-id> </new-reservation>
集群预留 API 可用于提交预留。在提交预留时,用户指定资源和所需时间方面的约束。如果可以进行预留,则响应结果为成功。如果使用预留 ID 多次提交预留,如果预留定义相同,则请求将成功,但只会创建一个预留。如果预留定义不同,服务器将响应错误响应。进行预留时,用户可以使用用于提交预留的预留 ID,通过将其指定为 集群提交应用程序 API 的一部分来访问资源。
POST 请求可用于向 ResourceManager 提交预留。如上所述,成功后将返回预留 ID(在答案的正文中)。成功提交将产生 200 响应。请注意,要提交预留,您必须为 HTTP 接口设置身份验证过滤器。该功能要求在 HttpServletRequest 中设置用户名。如果未设置过滤器,响应将为“UNAUTHORIZED”响应。
请注意,此功能目前处于 alpha 阶段,将来可能会发生变化。
项目 | 数据类型 | 描述 |
---|---|---|
queue | string | 您要提交到的(可预留)队列 |
reservation-definition | 对象 | 一组约束,表示用户随时间推移对资源的需求。 |
reservation-id | string | 用于提交预留的预留 ID。 |
reservation-definition 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
arrival | long | 此预订可从其分配的最早时间的 UTC 时间表示形式。 |
deadline | long | 此预订可分配到的最晚时间的 UTC 时间表示形式。 |
reservation-name | string | 预订的助记名称(不是有效的标识符)。 |
reservation-requests | 对象 | 此预订的“阶段”或阶段列表,每个列表都描述资源需求和持续时间 |
priority | int | 表示预订优先级的整数。优先级的较低数字表示优先级较高的预订。循环预订始终比非循环预订优先级高。非循环预订的优先级仅与非循环预订比较。循环预订也是如此。 |
reservation-requests 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
reservation-request-interpreter | int | 如何解释 ReservationRequest 组的数字选择:0 为 ANY,1 为 ALL,2 为 ORDER,3 为 ORDER_NO_GAP |
reservation-request | 对象 | 此预订的阶段/阶段的资源和时间功能的描述 |
reservation-request 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
duration | long | ReservationRequeust 的持续时间(以毫秒为单位)(此部分预留的令人满意的分配应存在的连续毫秒数)。 |
num-containers | int | 此预留阶段中所需的容器数(捕获此阶段中作业的最大并行度)。 |
min-concurrency | int | 为满足此分配而必须同时分配的最小容器数(捕获最小并行度,可用于表示 gang 语义)。 |
capability | 对象 | 允许指定每个容器的大小(内存、vCores)。 |
capability 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 此容器的内存 MB 数 |
vCores | int | 此容器的虚拟内核数 |
JSON 响应
此示例包含一个由两个阶段组成的预留(彼此交替,因为 reservation-request-interpreter 设置为 0),因此第一个阶段较短,“较高”且“组”,正好有 220 个容器持续 60 秒,而第二个交替阶段较长,持续 120 秒,较低,有 110 个容器(和 1 个容器的最小并发性,因此没有组语义)。
HTTP 请求
POST http://rmdns:8088/ws/v1/cluster/reservation/submit Content-Type: application/json { "queue" : "dedicated", "reservation-id":"reservation_1404198295326_0003" "reservation-definition" : { "arrival" : 1765541532000, "deadline" : 1765542252000, "reservation-name" : "res_1", "reservation-requests" : { "reservation-request-interpreter" : 0, "reservation-request" : [ { "duration" : 60000, "num-containers" : 220, "min-concurrency" : 220, "capability" : { "memory" : 1024, "vCores" : 1 } }, { "duration" : 120000, "num-containers" : 110, "min-concurrency" : 1, "capability" : { "memory" : 1024, "vCores" : 1 } } ] } } }
响应标头
200 OK Cache-Control: no-cache Expires: Thu, 17 Dec 2015 23:36:34 GMT, Thu, 17 Dec 2015 23:36:34 GMT Date: Thu, 17 Dec 2015 23:36:34 GMT, Thu, 17 Dec 2015 23:36:34 GMT Pragma: no-cache, no-cache Content-Type: application/xml Content-Encoding: gzip Content-Length: 137 Server: Jetty(6.1.26)
响应正文
No response body
XML 响应
HTTP 请求
POST http://rmdns:8088/ws/v1/cluster/reservation/submit Accept: application/xml Content-Type: application/xml <reservation-submission-context> <queue>dedicated</queue> <reservation-id>reservation_1404198295326_0003</reservation-id> <reservation-definition> <arrival>1765541532000</arrival> <deadline>1765542252000</deadline> <reservation-name>res_1</reservation-name> <reservation-requests> <reservation-request-interpreter>0</reservation-request-interpreter> <reservation-request> <duration>60000</duration> <num-containers>220</num-containers> <min-concurrency>220</min-concurrency> <capability> <memory>1024</memory> <vCores>1</vCores> </capability> </reservation-request> <reservation-request> <duration>120000</duration> <num-containers>110</num-containers> <min-concurrency>1</min-concurrency> <capability> <memory>1024</memory> <vCores>1</vCores> </capability> </reservation-request> </reservation-requests> </reservation-definition> </reservation-submission-context>
响应标头
200 OK Cache-Control: no-cache Expires: Thu, 17 Dec 2015 23:49:21 GMT, Thu, 17 Dec 2015 23:49:21 GMT Date: Thu, 17 Dec 2015 23:49:21 GMT, Thu, 17 Dec 2015 23:49:21 GMT Pragma: no-cache, no-cache Content-Type: application/xml Content-Encoding: gzip Content-Length: 137 Server: Jetty(6.1.26)
响应正文
No response body
集群预留 API 更新可用于更新现有预留。预留的更新与上面描述的提交类似,但用户提交要更新的现有预留的预留 ID。语义为尝试并交换,成功操作将根据请求的更新参数修改现有预留,而失败执行将使现有预留保持不变。
POST 请求可用于将预留更新到 ResourceManager。成功提交将导致 200 响应,表示对现有预留就地更新(ID 不变)。请注意,要更新预留,必须为 HTTP 接口设置身份验证过滤器。此功能要求在 HttpServletRequest 中设置用户名。如果未设置过滤器,响应将为“UNAUTHORIZED”响应。
请注意,此功能目前处于 alpha 阶段,将来可能会发生变化。
项目 | 数据类型 | 描述 |
---|---|---|
reservation-id | string | 要更新的预留的 ID(系统会自动从此处查找正确的队列) |
reservation-definition | 对象 | 一组约束,表示用户随时间推移对资源的需求。 |
reservation-definition 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
arrival | long | 此预订可从其分配的最早时间的 UTC 时间表示形式。 |
deadline | long | 此预订可分配到的最晚时间的 UTC 时间表示形式。 |
reservation-name | string | 预订的助记名称(不是有效的标识符)。 |
reservation-requests | 对象 | 此预订的“阶段”或阶段列表,每个列表都描述资源需求和持续时间 |
priority | int | 表示预订优先级的整数。优先级的较低数字表示优先级较高的预订。循环预订始终比非循环预订优先级高。非循环预订的优先级仅与非循环预订比较。循环预订也是如此。 |
reservation-requests 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
reservation-request-interpreter | int | 如何解释 ReservationRequest 组的数字选择:0 为 ANY,1 为 ALL,2 为 ORDER,3 为 ORDER_NO_GAP |
reservation-request | 对象 | 此预订的阶段/阶段的资源和时间功能的描述 |
reservation-request 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
duration | long | ReservationRequeust 的持续时间(以毫秒为单位)(此部分预留的令人满意的分配应存在的连续毫秒数)。 |
num-containers | int | 此预留阶段中所需的容器数(捕获此阶段中作业的最大并行度)。 |
min-concurrency | int | 为满足此分配而必须同时分配的最小容器数(捕获最小并行度,可用于表示 gang 语义)。 |
capability | 对象 | 允许指定每个容器的大小(内存、vCores)。 |
capability 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
memory | int | 此容器的内存 MB 数 |
vCores | int | 此容器的虚拟内核数 |
JSON 响应
此示例通过两个阶段(按顺序,因为 reservation-request-interpreter 已设置为 2)更新由 reservation_1449259268893_0005 标识的现有预留,其中第一阶段是 10 个容器的“组”,持续 5 分钟(最小并发性为 10 个容器),然后是 50 个容器,持续 10 分钟(最小并发性为 1 个容器,因此没有组语义)。
HTTP 请求
POST http://rmdns:8088/ws/v1/cluster/reservation/update Accept: application/json Content-Type: application/json { "reservation-id" : "reservation_1449259268893_0005", "reservation-definition" : { "arrival" : 1765541532000, "deadline" : 1765542252000, "reservation-name" : "res_1", "reservation-requests" : { "reservation-request-interpreter" : 2, "reservation-request" : [ { "duration" : 300000, "num-containers" : 10, "min-concurrency" : 10, "capability" : { "memory" : 1024, "vCores" : 1 } }, { "duration" : 60000, "num-containers" : 50, "min-concurrency" : 1, "capability" : { "memory" : 1024, "vCores" : 1 } } ] } } }
响应标头
200 OK Cache-Control: no-cache Expires: Thu, 17 Dec 2015 23:36:34 GMT, Thu, 17 Dec 2015 23:36:34 GMT Date: Thu, 17 Dec 2015 23:36:34 GMT, Thu, 17 Dec 2015 23:36:34 GMT Pragma: no-cache, no-cache Content-Type: application/json Content-Encoding: gzip Content-Length: 137 Server: Jetty(6.1.26)
响应正文
No response body
XML 响应
HTTP 请求
POST http://rmdns:8088/ws/v1/cluster/reservation/update Accept: application/xml Content-Type: application/xml <reservation-update-context> <reservation-id>reservation_1449259268893_0005</reservation-id> <reservation-definition> <arrival>1765541532000</arrival> <deadline>1765542252000</deadline> <reservation-name>res_1</reservation-name> <reservation-requests> <reservation-request-interpreter>2</reservation-request-interpreter> <reservation-request> <duration>300000</duration> <num-containers>10</num-containers> <min-concurrency>10</min-concurrency> <capability> <memory>1024</memory> <vCores>1</vCores> </capability> </reservation-request> <reservation-request> <duration>60000</duration> <num-containers>50</num-containers> <min-concurrency>1</min-concurrency> <capability> <memory>1024</memory> <vCores>1</vCores> </capability> </reservation-request> </reservation-requests> </reservation-definition> </reservation-update-context>
响应标头
200 OK Cache-Control: no-cache Expires: Thu, 17 Dec 2015 23:49:21 GMT, Thu, 17 Dec 2015 23:49:21 GMT Date: Thu, 17 Dec 2015 23:49:21 GMT, Thu, 17 Dec 2015 23:49:21 GMT Pragma: no-cache, no-cache Content-Type: application/xml Content-Encoding: gzip Content-Length: 137 Server: Jetty(6.1.26)
响应正文
No response body
集群预留 API 删除可用于删除现有预留。删除操作类似于更新。请求包含预留 ID,如果成功,则取消预留,否则预留将保留在系统中。
POST 请求可用于将预留删除到 ResourceManager。成功提交将导致 200 响应,表示删除成功。请注意,要删除预留,必须为 HTTP 接口设置身份验证过滤器。此功能要求在 HttpServletRequest 中设置用户名。如果未设置过滤器,响应将为“UNAUTHORIZED”响应。
请注意,此功能目前处于 alpha 阶段,将来可能会发生变化。
项目 | 数据类型 | 描述 |
---|---|---|
reservation-id | string | 要删除的预留的 ID(系统会自动从此处查找正确的队列) |
JSON 响应
此示例通过 reservation_1449259268893_0006 标识删除现有预留
HTTP 请求
POST http://10.200.91.98:8088/ws/v1/cluster/reservation/delete Accept: application/json Content-Type: application/json { "reservation-id" : "reservation_1449259268893_0006" }
响应标头
200 OK Cache-Control: no-cache Expires: 星期五,2015 年 12 月 18 日 01:31:05 GMT,星期五,2015 年 12 月 18 日 01:31:05 GMT Date: 星期五,2015 年 12 月 18 日 01:31:05 GMT,星期五,2015 年 12 月 18 日 01:31:05 GMT Pragma: no-cache, no-cache Content-Type: application/json Content-Encoding: gzip Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
No response body
XML 响应
HTTP 请求
POST http://10.200.91.98:8088/ws/v1/cluster/reservation/delete Accept: application/xml Content-Type: application/xml <reservation-delete-context> <reservation-id>reservation_1449259268893_0006</reservation-id> </reservation-delete-context>
响应标头
200 OK Cache-Control: no-cache Expires: 星期五,2015 年 12 月 18 日 01:33:23 GMT,星期五,2015 年 12 月 18 日 01:33:23 GMT Date: 星期五,2015 年 12 月 18 日 01:33:23 GMT,星期五,2015 年 12 月 18 日 01:33:23 GMT Pragma: no-cache, no-cache Content-Type: application/xml Content-Encoding: gzip Content-Length: 101 Server: Jetty(6.1.26)
响应正文
No response body
集群应用程序超时 API 可用于获取应用程序的所有已配置超时。当您对该资源运行 GET 操作时,将返回超时对象集合。每个超时对象由超时类型、到期时间和剩余时间(以秒为单位)组成。
当您请求应用程序超时列表时,信息将作为超时对象集合返回。另请参阅 集群应用程序超时 API,了解超时对象的语法。
项目 | 数据类型 | 描述 |
---|---|---|
timeout | 超时对象数组 (JSON)/零个或多个应用程序对象 (XML) | 应用程序超时对象集合 |
JSON 响应
HTTP 请求
Accept: application/json GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeouts
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "timeouts": { "timeout": [ { "type": "LIFETIME", "expiryTime": "2016-12-05T22:51:00.104+0530", "remainingTimeInSeconds": 27 } ] } }
XML 响应
HTTP 请求
Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeouts
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 712 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <timeouts> <timeout> <type>LIFETIME</type> <expiryTime>2016-12-05T22:51:00.104+0530</expiryTime> <remainingTimeInSeconds>27</remainingTimeInSeconds> </timeout> </timeouts>
集群应用程序超时资源包含有关超时的信息。
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 超时类型。有效值为 ApplicationTimeoutType 枚举的成员。LIFETIME 目前是唯一有效的值。 |
expiryTime | string | 应用程序将在 ISO8601 yyyy-MM-dd’T’HH:mm:ss.SSSZ 格式到期的时刻。如果为 UNLIMITED,则应用程序将永久运行。 |
remainingTimeInSeconds | long | 已配置应用程序超时的剩余时间。-1 表示应用程序未配置超时。0 表示应用程序已使用已配置的超时类型过期。 |
JSON 响应
HTTP 请求
Accept: application/json GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeouts/LIFETIME
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "timeout": { "type": "LIFETIME", "expiryTime": "2016-12-05T22:51:00.104+0530", "remainingTimeInSeconds": 27 } }
XML 响应
HTTP 请求
Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeouts/LIFETIME
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 712 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <timeout> <type>LIFETIME</type> <expiryTime>2016-12-05T22:51:00.104+0530</expiryTime> <remainingTimeInSeconds>27</remainingTimeInSeconds> </timeout>
更新给定超时类型的应用程序超时。
项目 | 数据类型 | 描述 |
---|---|---|
type | string | 超时类型。有效值为 ApplicationTimeoutType 枚举的成员。LIFETIME 目前是唯一有效的值。 |
expiryTime | string | 应用程序将在 ISO8601 yyyy-MM-dd’T’HH:mm:ss.SSSZ 格式到期的时刻。 |
JSON 响应
HTTP 请求
Accept: application/json PUT http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeout Content-Type: application/json { "timeout": { "type": "LIFETIME", "expiryTime": "2016-11-27T09:36:16.678+05:30" } }
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "timeout": { "type": "LIFETIME", "expiryTime": "2016-11-27T09:36:16.678+05:30", "remainingTimeInSeconds": 90 } }
XML 响应
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/apps/{appid}/timeout Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <timeout> <type>LIFETIME</type> <expiryTime>2016-11-27T09:36:16.678+05:30</expiryTime> </timeout>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 712 Server: Jetty(6.1.26)
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <timeout> <type>LIFETIME</type> <expiryTime>2016-11-27T09:36:16.678+05:30</expiryTime> <remainingTimeInSeconds>90</remainingTimeInSeconds> </timeout>
调度程序配置变更 API 提供了一种修改调度程序/队列配置和队列层次结构的方法。
请注意,此功能目前处于 alpha 阶段,可能会发生更改。
项目 | 数据类型 | 描述 |
---|---|---|
update-queue | 对象 | 应更新其配置的队列 |
add-queue | 对象 | 要添加到调度程序的队列及其配置 |
remove-queue | string | 要移除的队列的全路径名 |
global-updates | map | 用于更新调度程序全局配置的关键值对映射 |
GET 请求用于检索当前加载到调度程序上下文的调度程序配置。
XML 响应
HTTP 请求
Accept: application/xml Content-Type: application/xml GET http://rm-http-address:port/ws/v1/cluster/scheduler-conf
响应标头
TTP/1.1 200 OK Content-Type: application/xml; charset=utf-8 Transfer-Encoding: chunked
响应正文
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <configuration> <property> <name>yarn.scheduler.capacity.root.queues</name> <value>default</value> </property> <property> <name>yarn.scheduler.capacity.maximum-applications</name> <value>10000</value> </property> <property> <name>yarn.scheduler.capacity.root.default.capacity</name> <value>100</value> </property> </configuration>
PUT 请求用于修改调度程序配置。成功的修改将得到 200 响应。格式错误的请求或导致无效调度程序配置的请求将得到 400 响应。
更新队列配置
更新队列配置的请求。
update-queue 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
queue-name | string | 要更新的队列的全路径名 |
params | map | 用于更新此队列的关键值配置对映射 |
假设我们正在使用容量调度程序,当前队列配置是单个队列 root.default,此示例将 root.default 的最大应用程序数设置为 100,其最小用户限制百分比设置为 10。
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <update-queue> <queue-name>root.default</queue-name> <params> <entry> <key>maximum-applications</key> <value>100</value> </entry> <entry> <key>minimum-user-limit-percent</key> <value>10</value> </entry> </params> </update-queue> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
添加队列
添加队列/更新队列配置的请求。
add-queue 对象的元素
项目 | 数据类型 | 描述 |
---|---|---|
queue-name | string | 要添加的队列的全路径名 |
params | map | 用于设置此队列的关键值配置对映射 |
假设我们正在使用容量调度程序,当前队列配置是单个队列 root.default,此示例添加一个队列 root.a,其容量/最大容量为 10,并将 root.default 的容量/最大容量调整为 90。(更复杂的示例包括添加一个其父队列也在同一请求中被添加的队列,或添加多个同级队列。)
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <add-queue> <queue-name>root.a</queue-name> <params> <entry> <key>capacity</key> <value>10</value> </entry> <entry> <key>maximum-capacity</key> <value>10</value> </entry> </params> </add-queue> <update-queue> <queue-name>root.default</queue-name> <params> <entry> <key>capacity</key> <value>90</value> </entry> <entry> <key>maximum-capacity</key> <value>90</value> </entry> </params> </update-queue> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
移除队列
从队列层次结构中移除队列的请求。
假设我们正在使用容量调度程序,当前队列配置是三个队列 root.default、root.a 和 root.b,此示例将移除 root.a 和 root.b。(更复杂的示例包括移除父队列及其子队列。)
注意:队列必须先置于 STOPPED
状态,然后才能删除。任何更新的队列配置都应是有效的,即每个 级别 的队列容量应等于 100%。
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <remove-queue>root.a</remove-queue> <remove-queue>root.b</remove-queue> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
更新全局调度程序配置
更新全局调度程序配置的请求。假设我们正在使用容量调度程序,此示例将启用队列映射。对于全局配置更新,必须指定完整配置密钥。
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <global-updates> <entry> <key>yarn.scheduler.capacity.queue-mappings-override.enable</key> <value>true</value> </entry> </global-updates> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
向队列添加节点标签
假设我们正在使用容量调度程序,当前队列配置是两个队列 root.default 和 root.a,此示例将节点标签 x 添加到队列 root.a。使用以下命令创建节点标签 x 并分配节点。
yarn rmadmin -addToClusterNodeLabels "x(exclusive=true)"
yarn rmadmin -replaceLabelsOnNode "<nodeId>=x"
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <update-queue> <queue-name>root.a</queue-name> <params> <entry> <key>accessible-node-labels</key> <value>x</value> </entry> <entry> <key>accessible-node-labels.x.capacity</key> <value>100</value> </entry> </params> </update-queue> <update-queue> <queue-name>root</queue-name> <params> <entry> <key>accessible-node-labels.x.capacity</key> <value>100</value> </entry> </params> </update-queue> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
从队列中移除节点标签
假设我们正在使用容量调度程序,并且当前队列配置为两个队列 root.default 和 root.a,并且节点标签 x 已分配给队列 root.a。此示例取消了队列 root.a 中的节点标签 x 并将其删除。
HTTP 请求
Accept: application/xml PUT http://rm-http-address:port/ws/v1/cluster/scheduler-conf Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <sched-conf> <update-queue> <queue-name>root.a</queue-name> <params> <entry> <key>accessible-node-labels</key> <value></value> </entry> </params> </update-queue> </sched-conf>
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Transfer-Encoding: chunked
yarn rmadmin -removeFromClusterNodeLabels x
使用容器信号 API,您可以使用以下命令之一向指定容器发送信号:OUTPUT_THREAD_DUMP、GRACEFUL_SHUTDOWN 和 FORCEFUL_SHUTDOWN。
http://rm-http-address:port/ws/v1/cluster/containers/{containerId}/signal/{command}
POST
None
JSON 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/containers/container_1531404209605_0008_01_000001/signal/OUTPUT_THREAD_DUMP Accept: application/json Content-Type: application/json
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
无响应正文。
XML 响应
HTTP 请求
POST http://rm-http-address:port/ws/v1/cluster/containers/container_1531404209605_0008_01_000001/signal/OUTPUT_THREAD_DUMP Accept: application/xml Content-Type: application/xml
响应标头
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: 552 Server: Jetty(6.1.26)
无响应正文。
如果您使用的是容量调度程序,则调度程序活动 RESTful API 可用,并且可以获取在调度周期中记录的调度程序活动信息。API 返回一条消息,其中包含重要的调度活动信息,该信息具有以下字段的分层布局
可以为 GET 操作指定多个参数。
项目 | 数据类型 | 描述 |
---|---|---|
nodeId | string | 调度程序尝试分配容器的节点 ID。 |
timestamp | long | 活动的 Timestamp。 |
dateTime | string | 活动日期时间。 |
诊断 | string | 关于空结果、不可用环境或非法输入参数的活动顶级诊断,例如“等待显示”、“等待下一个分配”、“群集中没有正在运行的节点管理器”、“获取无效的 groupBy: xx,有效的 groupBy 类型:DIAGNOSTICS” |
分配 | 分配数组 | 分配对象集合。 |
项目 | 数据类型 | 描述 |
---|---|---|
分区 | string | 分配的分区。 |
updatedContainerId | string | 分配中更新的(已分配或预留)容器 ID。 |
finalAllocationState | string | 分配的最终分配状态,包括已分配、已从预留分配、已预留和已跳过。 |
root | 队列 | 队列对象 |
项目 | 数据类型 | 描述 |
---|---|---|
name | string | 队列名称。 |
allocationState | string | 队列的最终分配状态,包括已接受、已拒绝和已跳过。 |
诊断 | string | 队列诊断。 |
children | 队列或应用程序数组 | 队列对象(对于父队列)或应用程序对象(对于叶队列)集合 |
项目 | 数据类型 | 描述 |
---|---|---|
name | string | 应用程序名称。 |
appPriority | string | 应用程序优先级。 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 应用程序诊断。 |
children | 请求数组 | 请求对象集合 |
项目 | 数据类型 | 描述 |
---|---|---|
name | string | 请求名称,值格式为“request_<requestPriority>_<allocationRequestId>”,可用于识别不同的请求。 |
requestPriority | string | 请求优先级。 |
allocationRequestId | string | 请求的分配请求 ID。 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 请求诊断。 |
children | 节点数组 | 节点对象集合。 |
项目 | 数据类型 | 描述 |
---|---|---|
name | string | 容器信息,这是可选的,并且可以在分配状态为已分配、已预留或已从预留分配时显示。 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 关于正常模式中的节点或聚合模式中的节点的诊断 |
nodeId | string | 调度过程所基于的节点 ID 不会显示在具有 groupBy 参数的聚合查询中。 |
nodeIds | 字符串数组 | 聚合活动节点 ID 的集合,仅显示在具有 groupBy 参数的聚合查询中。 |
count | int | 节点 ID 的数量,仅显示在具有 groupBy 参数的聚合查询中。 |
JSON 响应
HTTP 请求
Accept: application/json GET http://rm-http-address:port/ws/v1/cluster/scheduler/activities
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
以下是在启用全局调度时的一个输出示例,对于单个请求,在节点级别有多个活动。对于单节点放置,不同之处在于 nodeId 将显示为活动字段,并且对于每个请求,在节点级别应该只有一个活动。
{ "activities": { "timestamp": 1562296830912, "dateTime": "Fri Jul 05 11:20:30 CST 2019", "allocations": [ { "partition": "", "finalAllocationState": "ALLOCATED", "root": { "name": "root", "allocationState": "ACCEPTED", "children": [ { "name": "a", "allocationState": "SKIPPED", "diagnostic": "Queue does not need more resources" }, { "name": "b", "allocationState": "ACCEPTED", "children": [ { "name": "application_1562296828063_0001", "appPriority": 0, "allocationState": "ALLOCATED", "children": [ { "name": "request_1_-1", "requestPriority": 1, "allocationRequestId": -1, "allocationState": "ALLOCATED", "children": [ { "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.2:1234" }, { "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.3:1234" }, { "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.4:1234" }, { "name": "Container: [ContainerId: null, AllocationRequestId: -1, Version: 0, NodeId: 127.0.0.1:1234, NodeHttpAddress: 127.0.0.1:2, Resource: <memory:3072, vCores:1>, Priority: 1, Token: null, ExecutionType: GUARANTEED, ]", "allocationState": "ALLOCATED", "nodeId": "127.0.0.1:1234" } ] } ] } ] } ] } } ] } }
当我们使用查询参数(“groupBy=diagnostic”)查询调度程序活动 REST API 时,4 个节点活动信息将被分组为 2 组:具有相同诊断“节点的总资源不足以满足请求,资源不足=[memory-mb]”的 SKIPPED 组和 ALLOCATED 组,输出应如下所示
{ "activities": { "timestamp": 1562297536893, "dateTime": "Fri Jul 05 11:32:16 CST 2019", "allocations": [ { "partition": "", "finalAllocationState": "ALLOCATED", "root": { "name": "root", "allocationState": "ACCEPTED", "children": [ { "name": "a", "allocationState": "SKIPPED", "diagnostic": "Queue does not need more resources" }, { "name": "b", "allocationState": "ACCEPTED", "children": [ { "name": "application_1562297533892_0001", "appPriority": 0, "allocationState": "ALLOCATED", "children": [ { "name": "request_1_-1", "requestPriority": 1, "allocationRequestId": -1, "allocationState": "ALLOCATED", "children": [ { "allocationState": "ALLOCATED", "count": 1, "nodeIds": [ "127.0.0.1:1234" ] }, { "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]", "count": 3, "nodeIds": [ "127.0.0.2:1234", "127.0.0.3:1234", "127.0.0.4:1234" ] } ] } ] } ] } ] } } ] } }
XML 响应
HTTP 请求
Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/scheduler/activities
响应标头
HTTP/1.1 200 OK Content-Type: application/xml; charset=utf-8 Transfer-Encoding: chunked
响应正文
<?xml version="1.0" encoding="utf-8"?> <activities> <timestamp>1562296830912</timestamp> <dateTime>Fri Jul 05 11:20:30 CST 2019</dateTime> <allocations> <partition></partition> <finalAllocationState>ALLOCATED</finalAllocationState> <root> <name>root</name> <allocationState>ACCEPTED</allocationState> <children> <name>a</name> <allocationState>SKIPPED</allocationState> <diagnostic>Queue does not need more resource</diagnostic> </children> <children> <name>b</name> <allocationState>ACCEPTED</allocationState> <children> <name>application_1562296828063_0001</name> <appPriority>0</appPriority> <allocationState>ACCEPTED</allocationState> <children> <name>request_1_-1</name> <requestPriority>1</requestPriority> <allocationRequestId>-1</allocationRequestId> <allocationState>ALLOCATED</allocationState> <children> <allocationState>SKIPPED</allocationState> <diagnostic>Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.2:1234</nodeId> </children> <children> <allocationState>SKIPPED</allocationState> <diagnostic>Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.3:1234</nodeId> </children> <children> <allocationState>SKIPPED</allocationState> <diagnostic>Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:3072, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.4:1234</nodeId> </children> <children> <name>Container: [ContainerId: null, AllocationRequestId: -1, Version: 0, NodeId: 127.0.0.1:1234, NodeHttpAddress: 127.0.0.1:2, Resource: <memory:3072, vCores:1>, Priority: 1, Token: null, ExecutionType: GUARANTEED, ]</name> <allocationState>ALLOCATED</allocationState> <nodeId>127.0.0.1:1234</nodeId> </children> </children> </children> </children> </root> </allocations> </activities>
如果您使用容量调度程序,则应用程序活动 RESTful API 可用,并且可以获取指定应用程序的有用调度信息,响应具有以下字段的分层布局
可以为 GET 操作指定多个参数。
项目 | 数据类型 | 描述 |
---|---|---|
applicationId | string | 指定的应用程序 ID。 |
分配 | 分配数组 | 按时间降序排列的分配对象集合。 |
项目 | 数据类型 | 描述 |
---|---|---|
nodeId | string | 节点的 ID。 |
timestamp | long | 分配的时间戳。 |
dateTime | string | 分配的日期时间。 |
queueName | string | 应用程序的队列名称。 |
appPriority | int | 应用程序的优先级 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 应用程序诊断。 |
children | 请求数组 | 请求对象集合 |
项目 | 数据类型 | 描述 |
---|---|---|
requestPriority | string | 请求优先级。 |
allocationRequestId | string | 请求的分配请求 ID。 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 请求诊断。 |
children | 节点数组 | 节点对象集合。 |
项目 | 数据类型 | 描述 |
---|---|---|
name | string | 已更新容器的 ID,如果未分配,将显示“Container-Id-Not-Assigned”。 |
allocationState | string | 应用程序的最终分配状态,包括已分配、已预留、已重新预留和已跳过。 |
诊断 | string | 关于正常模式中的节点或聚合模式中的节点的诊断 |
nodeId | string | 调度过程所基于的节点 ID 不会显示在具有 groupBy 参数的聚合查询中。 |
nodeIds | 字符串数组 | 聚合应用程序活动的节点 ID 集合,仅显示具有 groupBy 参数的聚合查询。 |
count | int | 节点 ID 的数量,仅显示在具有 groupBy 参数的聚合查询中。 |
JSON 响应
HTTP 请求
Accept: application/json GET http://rm-http-address:port/ws/v1/cluster/scheduler/app-activities/{appid}
响应标头
HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked Server: Jetty(6.1.26)
响应正文
{ "appActivities": { "applicationId": "application_1562312049195_0001", "allocations": [ { "timestamp": 1562312052039, "dateTime": "Fri Jul 05 15:34:12 CST 2019", "queueName": "b", "appPriority": 0, "allocationState": "RESERVED", "children": [ { "requestPriority": 1, "allocationRequestId": -1, "allocationState": "RESERVED", "children": [ { "name": "Container-Id-Not-Assigned", "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.3:1234" }, { "name": "Container-Id-Not-Assigned", "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.4:1234" }, { "name": "Container-Id-Not-Assigned", "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2>", "nodeId": "127.0.0.2:1234" }, { "name": "Container-Id-Not-Assigned", "allocationState": "RESERVED", "diagnostic": "Node does not have sufficient resource for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:1024, vCores:3>", "nodeId": "127.0.0.1:1234" } ] } ] }, { "timestamp": 1562312052031, "dateTime": "Fri Jul 05 15:34:12 CST 2019", "queueName": "b", "appPriority": 0, "allocationState": "ALLOCATED", "children": [ { "requestPriority": 0, "allocationRequestId": -1, "allocationState": "ALLOCATED", "children": [ { "name": "Container-Id-Not-Assigned", "allocationState": "ALLOCATED", "nodeId": "127.0.0.2:1234" } ] } ] } ] } }
当我们使用查询参数(“groupBy=diagnostic”)查询调度程序活动 REST API 时,4 个节点活动将分为两组:具有相同诊断信息“节点的总资源不足以满足请求,资源不足=[memory-mb]”的 SKIPPED 组和 ALLOCATED 组,输出应如下所示
{ "appActivities": { "applicationId": "application_1562312658870_0001", "allocations": [ { "timestamp": 1562312661536, "dateTime": "Fri Jul 05 15:44:21 CST 2019", "queueName": "b", "appPriority": 0, "allocationState": "RESERVED", "children": [ { "requestPriority": 1, "allocationRequestId": -1, "allocationState": "RESERVED", "children": [ { "allocationState": "SKIPPED", "diagnostic": "Node's total resource is insufficient for request, insufficient resources=[memory-mb]", "count": 3, "nodeIds": [ "127.0.0.3:1234", "127.0.0.4:1234", "127.0.0.2:1234" ] }, { "allocationState": "RESERVED", "diagnostic": "Node does not have sufficient resource for request, insufficient resources=[memory-mb]", "count": 1, "nodeIds": [ "127.0.0.1:1234" ] } ] } ] }, { "timestamp": 1562312661522, "dateTime": "Fri Jul 05 15:44:21 CST 2019", "queueName": "b", "appPriority": 0, "allocationState": "ALLOCATED", "children": [ { "requestPriority": 0, "allocationRequestId": -1, "allocationState": "ALLOCATED", "children": [ { "allocationState": "ALLOCATED", "count": 1, "nodeIds": [ "127.0.0.2:1234" ] } ] } ] } ] } }
XML 响应
HTTP 请求
Accept: application/xml GET http://rm-http-address:port/ws/v1/cluster/scheduler/app-activities/{appid}
响应标头
HTTP/1.1 200 OK Content-Type: application/xml; charset=utf-8 Transfer-Encoding: chunked
响应正文
<?xml version="1.0" encoding="utf-8"?> <appActivities> <applicationId>application_1562312049195_0001</applicationId> <allocations> <timestamp>1562312052039</timestamp> <dateTime>Fri Jul 05 15:34:12 CST 2019</dateTime> <queueName>b</queueName> <appPriority>0</appPriority> <allocationState>RESERVED</allocationState> <children> <requestPriority>1</requestPriority> <allocationRequestId>-1</allocationRequestId> <allocationState>RESERVED</allocationState> <children> <name>Container-Id-Not-Assigned</name> <allocationState>SKIPPED</allocationState> <diagnostic>Node's total resource is insufficient for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.3:1234</nodeId> </children> <children> <name>Container-Id-Not-Assigned</name> <allocationState>SKIPPED</allocationState> <diagnostic>Node does not have sufficient resource for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.4:1234</nodeId> </children> <children> <name>Container-Id-Not-Assigned</name> <allocationState>SKIPPED</allocationState> <diagnostic>Node does not have sufficient resource for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:2048, vCores:2></diagnostic> <nodeId>127.0.0.2:1234</nodeId> </children> <children> <name>Container-Id-Not-Assigned</name> <allocationState>RESERVED</allocationState> <diagnostic>Node does not have sufficient resource for request, insufficient resources=[memory-mb]\nrequired=<memory:4096, vCores:1>, available=<memory:1024, vCores:3></diagnostic> <nodeId>127.0.0.1:1234</nodeId> </children> </children> </allocations> <allocations> <timestamp>1562312052031</timestamp> <dateTime>Fri Jul 05 15:34:12 CST 2019</dateTime> <queueName>b</queueName> <appPriority>0</appPriority> <allocationState>ALLOCATED</allocationState> <children> <requestPriority>0</requestPriority> <allocationRequestId>-1</allocationRequestId> <allocationState>ALLOCATED</allocationState> <children> <name>Container-Id-Not-Assigned</name> <allocationState>ALLOCATED</allocationState> <nodeId>127.0.0.2:1234</nodeId> </children> </children> </allocations> </appActivitiesInfo>