Hadoop3.2.0 YARN Timeline Service

YARN时间线服务器

概观

介绍

通过时间线服务器在YARN中以通用方式存储和检索应用程序的当前和历史信息。它有两个职责:

保留特定应用信息

收集和检索完全特定于应用程序或框架的信息。例如,Hadoop MapReduce框架可以包含一些信息,如地图任务数量,减少任务,计数器等等。应用程序开发人员可以通过Application Master中的TimelineClient 或者 应用程序的容器将特定信息发布到时间轴服务器。

然后,可以通过REST API查询此信息,以便按应用程序/框架特定的UI进行呈现。

保留有关已完成应用程序的通用信息

以前,Application History Server仅支持MapReduce作业。随着时间线服务器的引入,应用程序历史记录服务器只是时间线服务器的一种用途。

通用信息包括应用程序级数据,如

  • 队列名,
  • 在ApplicationSubmissionContext中设置的用户信息等,
  • 为应用程序运行的应用程序尝试列表
  • 有关每次应用程序尝试的信息
  • 每个应用程序尝试下运行的容器列表
  • 有关每个容器的信息。

通用数据由YARN资源管理器发布到时间轴存储,并由其Web-UI用于显示有关已完成应用程序的信息。

现状和未来计划

当前状态

  1. 时间线服务器的核心功能已经完成。
  2. 它适用于安全和非安全集群。
  3. 通用历史记录服务构建在时间轴存储上。
  4. 历史记录可以存储在内存或leveldb数据库存储中; 后者确保在时间轴服务器重新启动时保留历史记录。
  5. 不支持在YARN中安装特定于框架的UI的功能。
  6. 特定于应用程序的信息仅可通过使用JSON类型内容的RESTful API获得。
  7. “Timeline Server v1”REST API已被声明为REST API之一,其兼容性将在未来版本中维护。
  8. 时间线服务器的单服务器实现限制了服务的可伸缩性; 它还会阻止该服务成为YARN基础结构的高可用性组件。

未来的计划

  1. 未来版本将推出可扩展且可靠的下一代时间轴服务“Timeline Service v2”
  2. 使用Timeline Server v1 REST API的应用程序可能无法使用此服务的扩展功能。这包括扩展数据结构以及客户端在Timeline Server实例之间进行故障转移的能力。

时间线结构

时间线结构

时间线域

时间线域为时间轴服务器提供了一个命名空间,允许用户托管多个实体,将它们与其他用户和应用程序隔离。时间线服务器安全性在此级别定义。

“域”主要存储所有者信息,读取和写入ACL信息,创建和修改时间戳信息。每个域都由一个ID标识,该ID必须在YARN群集中的所有用户中都是唯一的。

时间线实体

时间轴实体包含概念实体及其相关事件的元信息。

实体可以是应用程序,应用程序尝试,容器或任何用户定义的对象。

它包含主过滤器,用于索引时间轴存储中的实体。因此,用户/应用程序应仔细选择他们想要存储的信息作为主要过滤器。

剩余数据可以存储为未编制索引的信息。每个实体由EntityId和EntityType唯一标识。

时间线事件

时间轴事件描述与应用程序的特定时间轴实体相关的事件。

用户可以自由定义事件的含义 - 例如启动应用程序,分配容器,操作失败或其他与用户和集群操作员相关的信息。

部署

配置

基本配置

配置属性 描述
yarn.timeline-service.enabled 在服务器端,它指示是否启用时间线服务。在客户端,用户可以启用它来指示客户是否想要使用时间线服务。如果在客户端启用了安全性,则yarn客户端会尝试获取时间线服务器的委托令牌。默认为false。
yarn.resourcemanager.system-metrics-publisher.enabled 控制YARN系统度量标准是否由RM在时间线服务器上发布的设置。默认为false。
yarn.timeline-service.generic-application-history.enabled 向客户指示是否从时间轴历史服务查询通用应用程序数据。如果未启用,则仅从资源管理器查询应用程序数据。默认为false。

时间轴存储和状态存储配置

配置属性 描述
yarn.timeline-service.store-class 存储时间轴商店的类名。默认为org.apache.hadoop.yarn.server.timeline.LeveldbTimelineStore。
yarn.timeline-service.leveldb-timeline-store.path 存储leveldb时间线存储的文件名。默认为$ {hadoop.tmp.dir}/yarn/timeline。
yarn.timeline-service.leveldb-timeline-store.ttl-interval-ms leveldb时间轴存储的删除周期之间等待的时间长度,以毫秒为单位。默认为300000。
yarn.timeline-service.leveldb-timeline-store.read-cache-size leveldb时间轴存储的未压缩块的读缓存大小(以字节为单位)。默认为104857600。
yarn.timeline-service.leveldb-timeline-store.start-time-read-cache-size 最近读取的实体开始时间的高速缓存大小,用于leveldb时间线存储在实体数量中。默认为10000。
yarn.timeline-service.leveldb-timeline-store.start-time-write-cache-size 最近编写的leveldb时间轴实体开始时间的缓存大小以实体数量存储。默认为10000。
yarn.timeline-service.recovery.enabled 默认为false。
yarn.timeline-service.state-store-class 存储时间线状态存储的类名。默认为org.apache.hadoop.yarn.server.timeline.recovery.LeveldbTimelineStateStore。
yarn.timeline-service.leveldb-state-store.path 存储leveldb时间轴状态存储的文件名。

Web和RPC配置

配置属性 描述
yarn.timeline-service.hostname 时间轴服务Web应用程序的主机名。默认为0.0.0.0
yarn.timeline-service.address 时间轴服务器的地址以启动RPC服务器。默认为$ {yarn.timeline-service.hostname}:10200。
yarn.timeline-service.webapp.address 时间轴服务Web应用程序的http地址。默认为$ {yarn.timeline-service.hostname}:8188。
yarn.timeline-service.webapp.https.address 时间轴服务Web应用程序的https地址。默认为$ {yarn.timeline-service.hostname}:8190。
yarn.timeline-service.bind-host 服务器将绑定到的实际地址。如果设置了此可选地址,RPC和webapp服务器将分别绑定到此地址和yarn.timeline-service.address和yarn.timeline-service.webapp.address中指定的端口。这对于通过设置为0.0.0.0使服务侦听所有接口非常有用。
yarn.timeline-service.http-cross-origin.enabled 为需要跨源Web响应标头的Web服务启用跨源支持(CORS)。例如,javascript向时间线服务器发出Web服务请求。默认为false。
yarn.timeline-service.http-cross-origin.allowed-origins 逗号分隔的原始列表是允许的。以regex:为前缀的值被解释为正则表达式。包含通配符(*)的值也是可能的,这里生成正则表达式,不鼓励使用,并且仅支持向后兼容性。默认为*。
yarn.timeline-service.http-cross-origin.allowed-methods 以逗号分隔的方法列表,允许Web服务需要跨源(CORS)支持。默认为GET,POST,HEAD。
yarn.timeline-service.http-cross-origin.allowed-headers 逗号分隔的标头列表,允许用于需要跨域(CORS)支持的Web服务。默认为X-Requested-With,Content-Type,Accept,Origin。
yarn.timeline-service.http-cross-origin.max-age 可以为需要跨源(CORS)支持的Web服务缓存预先请求的请求的秒数。默认为1800。

请注意,HTTP和HTTPS绑定之间的选择是在TimelineClient中根据YARN范围的配置选项yarn.http.policy的值进行的; 如果此策略为HTTPS_ONLY,则将选择HTTPS端点。

高级服务器端配置

配置属性 描述
yarn.timeline-service.ttl-enable 启用时间线存储中的旧数据删除。默认为true。
yarn.timeline-service.ttl-ms 生存时间线的时间以毫秒为单位存储数据。默认为604800000(7天)。
yarn.timeline-service.handler-thread-count 处理程序线程计数为客户端RPC请求提供服务。默认为10。
yarn.timeline-service.client.max-retries 尝试将数据发布到时间轴服务的最大重试次数。默认为30次。
yarn.timeline-service.client.retry-interval-ms 时间轴服务客户端重试之间的间隔(以毫秒为单位)。默认为1000。
yarn.timeline-service.generic-application-history.max-applications 可以使用REST API或应用程序历史协议获取最大应用程序数,并在时间轴服务器web ui中显示。默认为10000。

UI主机配置

如果启用,时间轴服务可以托管多个UI。该服务可以支持目录中托管的静态网站或捆绑的war文件。然后,Web UI将在配置的路径下的时间轴服务HTTP端口上托管。

配置属性 描述
yarn.timeline-service.ui-names 以逗号分隔的将要托管的UI列表。默认为none。
yarn.timeline-service.ui-on-disk-path.$name 对于每个ui-names,应该在磁盘路径上指定目录服务静态内容或Web归档(war文件)的位置。
yarn.timeline-service.ui-web-path.$name 对于每个ui-names,应该相对于Timeline服务器根指定Web路径。路径应以起始斜杠开头。

安全配置

可以通过将yarn.timeline-service.http-authentication.type设置为kerberos来启用安全性,之后可以使用以下配置选项:

配置属性 描述
yarn.timeline-service.http-authentication.type 定义用于时间线服务器HTTP端点的身份验证。支持的值包括:simple / kerberos /#AUTHENTICATION_HANDLER_CLASSNAME#。默认为简单。
yarn.timeline-service.http-authentication.simple.anonymous.allowed 指示使用“简单”身份验证时,时间线服务器是否允许匿名请求。默认为true。
yarn.timeline-service.principal 时间线服务器的Kerberos主体。
yarn.timeline-service.keytab 时间线服务器的Kerberos密钥表。在Unix上默认为/etc/krb5.keytab。
yarn.timeline-service.delegation.key.update-interval 默认为86400000(1天)。
yarn.timeline-service.delegation.token.renew-interval 默认为86400000(1天)。
yarn.timeline-service.delegation.token.max-lifetime 默认为604800000(7天)。
yarn.timeline-service.client.best-effort 如果获取委托令牌的失败被认为是应用程序失败(选项=假),或者客户端是否应该尝试在没有它的情况下继续发布信息(option = true)。默认值:false

启用时间轴服务和通用历史记录服务

以下是启动Timeline服务器的基本配置。

<property>
  <description>Indicate to clients whether Timeline service is enabled or not.
  If enabled, the TimelineClient library used by end-users will post entities
  and events to the Timeline server.</description>
  <name>yarn.timeline-service.enabled</name>
  <value>true</value>
</property>

<property>
  <description>The setting that controls whether yarn system metrics is
  published on the timeline server or not by RM.</description>
  <name>yarn.resourcemanager.system-metrics-publisher.enabled</name>
  <value>true</value>
</property>

<property>
  <description>Indicate to clients whether to query generic application
  data from timeline history-service or not. If not enabled then application
  data is queried only from Resource Manager.</description>
  <name>yarn.timeline-service.generic-application-history.enabled</name>
  <value>true</value>
</property>

运行时间轴服务器

假设所有上述配置都已正确设置,管理员可以使用以下命令启动时间轴服务器/历史服务:

yarn timelineserver

要将时间轴服务器/历史服务作为守护程序启动,命令为

$HADOOP_YARN_HOME/sbin/yarn-daemon.sh start timelineserver

通过命令行访问通用数据

用户可以通过下面的命令行访问应用程序的通用历史数据

$ yarn application -status <Application ID>
$ yarn applicationattempt -list <Application ID>
$ yarn applicationattempt -status <Application Attempt ID>
$ yarn container -list <Application Attempt ID>
$ yarn container -status <Container ID>

请注意,相同的命令可用于获取有关正在运行的应用程序的相应信息。

发布应用程序特定数据

开发人员可以通过构造TimelineEntity和 TimelineEvent对象来定义他们想要为其应用程序记录的信息,然后通过TimelineClient API 将实体和事件发布到时间轴服务器。

这是一个例子:

// Create and start the Timeline client
TimelineClient client = TimelineClient.createTimelineClient();
client.init(conf);
client.start();

try {
  TimelineDomain myDomain = new TimelineDomain();
  myDomain.setId("MyDomain");
  // Compose other Domain info ....

  client.putDomain(myDomain);

  TimelineEntity myEntity = new TimelineEntity();
  myEntity.setDomainId(myDomain.getId());
  myEntity.setEntityType("APPLICATION");
  myEntity.setEntityId("MyApp1");
  // Compose other entity info

  TimelinePutResponse response = client.putEntities(entity);

  TimelineEvent event = new TimelineEvent();
  event.setEventType("APP_FINISHED");
  event.setTimestamp(System.currentTimeMillis());
  event.addEventInfo("Exit Status", "SUCCESS");
  // Compose other Event info ....

  myEntity.addEvent(event);
  TimelinePutResponse response = timelineClient.putEntities(entity);

} catch (IOException e) {
  // Handle the exception
} catch (RuntimeException e) {
  // In Hadoop 2.6, if attempts submit information to the Timeline Server fail more than the retry limit,
  // a RuntimeException will be raised. This may change in future releases, being
  // replaced with a IOException that is (or wraps) that which triggered retry failures.
} catch (YarnException e) {
  // Handle the exception
} finally {
  // Stop the Timeline client
  client.stop();
}
  1. 将数据发布到时间线服务器是一种同步操作; 在成功之前,呼叫不会返回。
  2. 该TimelineClient实现类是纱线的子类服务的API; 它可以放在CompositeService下,以简化其生命周期管理。
  3. putEntities()调用的结果是TimelinePutResponse对象。这包含时间线服务器拒绝的那些时间轴实体的(希望是空的)列表,以及指示每个故障原因的错误代码。

在Hadoop 2.6和2.7中,错误代码是:

错误代码 描述
1 没有开始时间
2 IOException异常
3 系统过滤器冲突(使用保留过滤器密钥)
4 拒绝访问
5 没有域名
6 被禁止的关系

将来可能会定义更多错误代码。

注意:以下是更新实体时需要遵守的要点。

  • 不应为现有实体修改域ID。
  • 修改主过滤器值后,新值将附加到旧值; 原始值不会被替换。
  • 对于实体上的所有更新,建议使用相同的主过滤器。在更新中修改主过滤器的任何操作都将导致具有更新的主过滤器的查询在更新之前不获取信息

通用数据Web UI

用户可以通过Web UI访问应用程序的通用历史信息:

http(s)://<timeline server http(s) address:port>/applicationhistory

时间线服务器REST API V1

目前仅通过REST API调用支持查询时间线服务器; YARN库中没有实现API客户端。在Java中,Jersey客户端在查询服务器时非常有效,即使在安全模式下也是如此(前提是调用者具有相应的Kerberos令牌或密钥表)。

v1 REST API 在时间轴服务器Web服务上的路径/ ws / v1 / timeline /下实现。

以下是API的非规范性描述。

根路径

GET /ws/v1/timeline/

返回描述服务器实例和版本信息的JSON对象。

 {
   About: "Timeline API",
   timeline-service-version: "3.0.0-SNAPSHOT",
   timeline-service-build-version: "3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum e9ec74ea3ff7bc9f3d35e9cac694fb",
   timeline-service-version-built-on: "2015-05-13T19:45Z",
   hadoop-version: "3.0.0-SNAPSHOT",
   hadoop-build-version: "3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum 95874b192923b43cdb96a6e483afd60",
   hadoop-version-built-on: "2015-05-13T19:44Z"
 }

域名/ ws / v1 /时间线/域名

域摘要信息/ ws / v1 / timeline / domain

GET /ws/v1/timeline/domain?owner=$OWNER

在JSON编组的TimelineDomains数据结构中返回属于特定用户的域列表。

该业主必须在未认证的GET来设置。

在经过身份验证的请求中,所有者默认为调用方。

PUT /ws/v1/timeline/domain

此路径的序列化TimelineDomain结构的PUT 将域添加到指定/当前用户拥有的域列表中。成功的操作返回状态代码200和不包含错误的TimelinePutResponse。

有关域/ ws / v1 / timeline / domain / {domainId}的具体信息

返回描述域的JSON编组的TimelineDomain结构。

如果找不到域,则返回HTTP 404响应。

POST新域名/ ws / v1 / timeline / domain

创建新的时间轴域,或覆盖现有域。

尝试创建新域时,提交中的ID必须在群集中的所有域中都是唯一的。

尝试更新现有域时,必须设置该域的ID。提交者必须具有更新域的适当权限。

提交:TimelineDomain

响应:TimelinePutResponse

列出用户的域:GET / ws / v1 / timeline / domain

检索用户的所有域的列表。

如果指定了所有者,则该所有者名称将覆盖调用者的名称。

查询参数 描述
所有者 要列出的域的所有者
GET http://localhost:8188/ws/v1/timeline/domain?owner=alice

{
"domains":
  [
    {
    "id":"DS_DOMAIN_2",
    "owner":"alice",
    "readers":"peter",
    "writers":"john",
    "createdtime":1430425000337,
    "modifiedtime":1430425000337
    },
    {
    "id":"DS_DOMAIN_1",
    "owner":"alice",
    "readers":"bar",
    "writers":"foo",
    "createdtime":1430424955963,
    "modifiedtime":1430424955963
    }
    ,
    {"id":"DEFAULT",
    "description":"System Default Domain",
    "owner":"alice",
    "readers":"*",
    "writers":"*",
    "createdtime":1430424022699,
    "modifiedtime":1430424022699
    }
  ]
}

响应:TimelineDomains

如果用户缺少列出指定所有者的域的权限,则会返回没有域列表的TimelineDomains响应。

检索特定域的详细信息:GET / ws / v1 / timeline / domain / {domainId}

检索单个域的详细信息

GET http://localhost:8188/ws/v1/timeline/domain/DS_DOMAIN_1

响应:TimelineDomain

{
  "id":"DS_DOMAIN_1",
  "owner":"zshen",
  "readers":"bar",
  "writers":"foo",
  "createdtime":1430424955963,
  "modifiedtime":1430424955963
}

如果用户缺少查询该域的详细信息的权限,则返回404未找到的异常 - 如果没有具有该ID的条目,则返回相同的响应。

发布时间轴实体

使用Posting Entities API,您可以将包含要记录的每个框架信息的实体和事件发布到时间线服务器。

URI:

http(s)://<timeline server http(s) address:port>/ws/v1/timeline

支持HTTP操作:

POST

查询参数支持:

没有

响应:TimelinePutResponse

请求示例:

JSON请求

HTTP请求:

POST http://<timeline server http address:port>/ws/v1/timeline

请求标题:

POST /ws/v1/timeline HTTP/1.1
Accept: application/json
Content-Type: application/json
Transfer-Encoding: chunked

请求机构:

{
  "entities" : [ {
    "entity" : "entity id 0",
    "entitytype" : "entity type 0",
    "relatedentities" : {
      "test ref type 2" : [ "test ref id 2" ],
      "test ref type 1" : [ "test ref id 1" ]
    },
    "events" : [ {
      "timestamp" : 1395818851590,
      "eventtype" : "event type 0",
      "eventinfo" : {
        "key2" : "val2",
        "key1" : "val1"
      }
    }, {
      "timestamp" : 1395818851590,
      "eventtype" : "event type 1",
      "eventinfo" : {
        "key2" : "val2",
        "key1" : "val1"
      }
    } ],
    "primaryfilters" : {
      "pkey2" : [ "pval2" ],
      "pkey1" : [ "pval1" ]
    },
    "otherinfo" : {
      "okey2" : "oval2",
      "okey1" : "oval1"
    },
    "starttime" : 1395818851588
  }, {
    "entity" : "entity id 1",
    "entitytype" : "entity type 0",
    "relatedentities" : {
      "test ref type 2" : [ "test ref id 2" ],
      "test ref type 1" : [ "test ref id 1" ]
    },
    "events" : [ {
      "timestamp" : 1395818851590,
      "eventtype" : "event type 0",
      "eventinfo" : {
        "key2" : "val2",
        "key1" : "val1"
      }
    }, {
      "timestamp" : 1395818851590,
      "eventtype" : "event type 1",
      "eventinfo" : {
        "key2" : "val2",
        "key1" : "val1"
      }
    } ],
    "primaryfilters" : {
      "pkey2" : [ "pval2" ],
      "pkey1" : [ "pval1" ]
    },
    "otherinfo" : {
      "okey2" : "oval2",
      "okey1" : "oval1"
    },
    "starttime" : 1395818851590
  } ]
}

必填字段

实体:类型和ID。除非实体包含一个或多个事件,否则需要starttime。事件:类型和时间戳。

时间线实体列表

使用时间轴实体列表API,您可以检索实体对象列表,按实体的起始时间戳排序,降序。实体的起始时间戳可以是您的应用程序指定的时间戳。如果未明确指定,则商店将选择它作为实体的第一篇文章中收到的事件的最早时间戳。

URI:

使用以下URI获取给定entityType的所有实体对象。

http(s)://<timeline server http(s) address:port>/ws/v1/timeline/{entityType}

支持HTTP操作:

GET

查询参数支持:

  1. limit - 要返回的实体数量的限制。如果为null,则默认为100。
  2. windowStart - 要检索的最早开始时间戳(独占)。如果为null,则默认为检索所有实体,直到达到限制。
  3. windowEnd - 要检索的最新开始时间戳(包括)。如果为null,则默认为Long的最大值。
  4. fromId - 如果fromId不为null,则检索早于和包括指定ID的实体。如果未找到指定ID的开始时间,则将返回空的实体列表。该windowEnd如果这个实体的开始时间比下降后的参数将优先windowEnd。
  5. fromTs - 如果fromTs不为null,则忽略在给定时间戳之后插入到存储中的实体。用于此比较的实体的插入时间戳是商店收到实体的第一次放置时的系统时间(而不是实体的开始时间)。
  6. primaryFilter - 仅检索具有指定主过滤器的实体。如果为null,则检索所有实体。这是索引检索,不扫描与过滤器不匹配的实体。
  7. secondaryFilters - 仅检索与其主过滤器或其他信息中的所有指定过滤器具有完全匹配的实体。这不是索引检索,因此扫描所有实体,但仅返回与过滤器匹配的实体。
  8. fields - 指定要检索的实体对象的哪些字段:EVENTS,RELATED_ENTITIES,PRIMARY_FILTERS,OTHER_INFO,LAST_EVENT_ONLY。如果字段集包含LAST_EVENT_ONLY而不包含EVENTS,则会检索每个实体的最新事件。如果为null,则检索所有字段。

请注意,primaryFilter和secondaryFilters参数的键/值对的值可以是不同的数据类型,匹配是数据类型敏感的。用户需要正确格式化值。例如,123和“123”分别表示整数和字符串。如果实体的primaryFilter具有字符串“123”,但参数设置为整​​数123,则实体将不匹配。类似地,true表示布尔值,而“true”表示字符串。通常,该值将作为特定Java类型转换,与解析JSON剪辑的jackson库一致。

实体的元素(时间轴实体列表)对象

当您请求时间轴实体列表时,信息将作为容器对象的集合返回。有关时间轴实体对象的语法,另请参阅时间轴实体。

项目 数据类型 描述
entities array of timeline entity objects(JSON) 时间轴实体对象的集合

响应示例:

JSON响应

HTTP请求:

GET http://localhost:8188/ws/v1/timeline/DS_APP_ATTEMPT

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "entities":[
  {
  "entitytype":"DS_APP_ATTEMPT",
  "entity":"appattempt_1430424020775_0004_000001",
  "events":[
    {
    "timestamp":1430425008796,
    "eventtype":"DS_APP_ATTEMPT_END",
    "eventinfo": { }
    }
    {
    "timestamp":1430425004161,
    "eventtype":"DS_APP_ATTEMPT_START",
    "eventinfo": { }
    }
  ]
  "starttime":1430425004161,
  "domain":"DS_DOMAIN_2",
  "relatedentities": { },
  "primaryfilters":
    {
    "user":["zshen"]
    },
  "otherinfo": { }
  }
  {
  "entitytype":"DS_APP_ATTEMPT",
  "entity":"appattempt_1430424020775_0003_000001",
  "starttime":1430424959169,
  "domain":"DS_DOMAIN_1",
  "events":[
    {
    "timestamp":1430424963836,
    "eventinfo": { }
     }
    {
    "timestamp":1430424959169,
    "eventinfo": { }
    }
   ]
  "relatedentities": { },
  "primaryfilters": {
    "user":["zshen"]
   },
  "otherinfo": { }
   }
  ]
}

时间线实体

使用Timeline Entity API,您可以检索给定实体标识符的实体信息。

URI:

使用以下URI获取entityType值和entityId值标识的实体对象。

http(s)://<timeline server http(s) address:port>/ws/v1/timeline/{entityType}/{entityId}

支持HTTP操作:

GET

查询参数支持:

  1. fields - 指定要检索的实体对象的哪些字段:EVENTS,RELATED_ENTITIES,PRIMARY_FILTERS,OTHER_INFO,LAST_EVENT_ONLY。如果字段集包含LAST_EVENT_ONLY而不包含EVENTS,则会检索每个实体的最新事件。如果为null,则检索所有字段。

实体的元素(时间轴实体)对象:

有关时间轴事件对象的语法,另请参阅时间轴事件列表。需要注意的是价值的primaryfilters和活动促销是一个对象而不是字符串。

项目 数据类型 描述
entity string 实体ID
entitytype string 实体类型
relatedentities map 相关实体的标识符,在entityType的地图中组织:[entity1,entity2,...]
events   实体的事件
primaryfilters map 实体的主要过滤器,按键映射组织:[value1,value2,...]
otherinfo map 实体的其他信息,在key:value的映射中组织
starttime

long

实体的开始时间

响应示例:

JSON响应

HTTP请求:

GET http://localhost:8188/ws/v1/timeline/DS_APP_ATTEMPT/appattempt_1430424020775_0003_000001

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "events":[
    {
    "timestamp":1430424959169,
    "eventtype":"DS_APP_ATTEMPT_START",
    "eventinfo":  {}}],
    "entitytype":"DS_APP_ATTEMPT",
    "entity":"appattempt_1430424020775_0003_000001",
    "starttime":1430424959169,
    "domain":"DS_DOMAIN_1",
    "relatedentities":  {},
    "primaryfilters":  {
        "user":["zshen"]
        },
    "otherinfo":  {}
    }
  ]
}

时间线事件列表

使用Timeline Events API,您可以检索所有相同实体类型的实体列表的事件对象。每个实体的事件按其时间戳的顺序排序,降序。

URI:

使用以下URI获取给定entityType的事件对象。

http(s)://<timeline server http(s) address:port>/ws/v1/timeline/{entityType}/events

支持HTTP操作:

GET

查询参数支持:

  1. entityId - 要检索事件的实体ID。如果为null,则不返回任何事件。可以以逗号分隔值的形式给出多个entityIds。
  2. limit - 每个实体返回的事件数限制。如果为null,则默认为每个实体100个事件。
  3. windowStart - 如果不为null,则仅检索晚于给定时间的事件(不包括)
  4. windowEnd - 如果不为null,则仅检索早于给定时间(包括)的事件
  5. eventType - 限制返回给定类型的事件。如果为null,则返回所有类型的事件。可以以逗号分隔值的形式给出多个eventType。

事件的元素(时间轴实体列表)对象

当您请求时间轴事件列表时,信息将作为事件对象的集合返回。

项目 数据类型 描述
events array of timeline event objects(JSON) 时间轴事件对象的集合

下面是单个事件对象的元素。需要注意的是价值的eventinfo和活动促销是一个对象而不是字符串。

项目 数据类型 描述
eventtype string 事件类型
eventinfo map 事件的信息,在关键字:值的地图中定价
timestamp long 事件的时间戳

响应示例:

JSON响应

HTTP请求:

GET http://localhost:8188/ws/v1/timeline/DS_APP_ATTEMPT/events?entityId=appattempt_1430424020775_0003_000001

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
"events": [
  {
  "entity":"appattempt_1430424020775_0003_000001",
  "entitytype":"DS_APP_ATTEMPT"}
  "events":[
    {
    "timestamp":1430424963836,
    "eventtype":"DS_APP_ATTEMPT_END",
    "eventinfo":{}},
    {
    "timestamp":1430424959169,
    "eventtype":"DS_APP_ATTEMPT_START",
    "eventinfo":{}}
    ],
   }
  ]
}

通用数据REST API

用户可以通过REST API访问应用程序的通用历史信息。

关于

使用about API,您可以获得有关包含通用历史记录REST API描述和版本信息的资源的时间表。

它本质上是YARN TimelineAbout结构的XML / JSON序列化形式。

URI:

使用以下URI获取有关对象的时间轴。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/about

支持HTTP操作:

GET

查询参数支持:

没有

about(Application)对象的元素:

 

Item Data Type Description
About string The description about the service
timeline-service-version string The timeline service version
timeline-service-build-version string The timeline service build version
timeline-service-version-built-on string On what time the timeline service is built
hadoop-version string Hadoop version
hadoop-build-version string Hadoop build version
hadoop-version-built-on string On what time Hadoop is built


响应示例:

JSON响应

HTTP请求:

http://localhost:8188/ws/v1/applicationhistory/about

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  About: "Generic History Service API",
  timeline-service-version: "3.0.0-SNAPSHOT",
  timeline-service-build-version: "3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum e9ec74ea3ff7bc9f3d35e9cac694fb",
  timeline-service-version-built-on: "2015-05-13T19:45Z",
  hadoop-version: "3.0.0-SNAPSHOT",
  hadoop-build-version: "3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum 95874b192923b43cdb96a6e483afd60",
  hadoop-version-built-on: "2015-05-13T19:44Z"
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/about
Accept: application/xml

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 748

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <about>
   <About>Generic History Service API</About>
   <hadoop-build-version>3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum 95874b192923b43cdb96a6e483afd60</hadoop-build-version>
   <hadoop-version>3.0.0-SNAPSHOT</hadoop-version>
   <hadoop-version-built-on>2015-05-13T19:44Z</hadoop-version-built-on>
   <timeline-service-build-version>3.0.0-SNAPSHOT from fcd0702c10ce574b887280476aba63d6682d5271 by zshen source checksum e9ec74ea3ff7bc9f3d35e9cac694fb</timeline-service-build-version>
   <timeline-service-version>3.0.0-SNAPSHOT</timeline-service-version>
   <timeline-service-version-built-on>2015-05-13T19:45Z</timeline-service-version-built-on>
 </about>

申请清单

使用Application List API,您可以获得一组资源,每个资源代表一个应用程序。在此资源上运行GET操作时,您将获得一组应用程序对象。

URI:

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps

支持HTTP操作:

GET

查询参数支持:

  1. states - 与给定应用程序状态匹配的应用程序,指定为以逗号分隔的列表

  2. finalStatus - 应用程序的最终状态 - 由应用程序本身报告

  3. 用户 - 用户名

  4. 队列 - 队列名称

  5. limit - 要返回的app对象的总数

  6. startedTimeBegin - 以此时间开始的开始时间的应用程序,以纪元为单位以ms为单位指定

  7. startedTimeEnd - 以此时间结束的开始时间的应用程序,以epoch开头的ms指定

  8. finishedTimeBegin - 以此时间开始的完成时间的应用程序,以纪元为单位以ms为单位指定

  9. finishedTimeEnd - 完成时间以此时间结束的应用程序,以纪元为单位以ms为单位指定

  10. applicationTypes - 与给定应用程序类型匹配的应用程序,指定为以逗号分隔的列表

应用程序的元素(应用程序列表)对象

当您请求应用程序列表时,信息将作为应用程序对象的集合返回。另请参见应用程序的应用程序对象的语法。

项目 数据类型 描述
app array of app objects(JSON)/zero or more application objects(XML) 应用程序对象的集合

响应示例:

JSON响应

HTTP请求:

GET http://<timeline server http address:port>/ws/v1/applicationhistory/apps

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "app":
  [
      {
      "appId":"application_1430424020775_0004",
      "currentAppAttemptId":"appattempt_1430424020775_0004_000001",
      "user":"zshen",
      "name":"DistributedShell",
      "queue":"default",
      "type":"YARN",
      "host":"d-69-91-129-173.dhcp4.washington.edu/69.91.129.173",
      "rpcPort":-1,
      "appState":"FINISHED",
      "progress":100.0,
      "diagnosticsInfo":"",
      "originalTrackingUrl":"N/A",
      "trackingUrl":"http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0004/",
      "finalAppStatus":"SUCCEEDED",
      "submittedTime":1430425001004,
      "startedTime":1430425001004,
      "finishedTime":1430425008861,
      "elapsedTime":7857,
      "unmanagedApplication":"false",
      "applicationPriority":0,
      "appNodeLabelExpression":"",
      "amNodeLabelExpression":""
      },
      {
      "appId":"application_1430424020775_0003",
      "currentAppAttemptId":"appattempt_1430424020775_0003_000001",
      "user":"zshen",
      "name":"DistributedShell",
      "queue":"default",
      "type":"YARN",
      "host":"d-69-91-129-173.dhcp4.washington.edu/69.91.129.173",
      "rpcPort":-1,
      "appState":"FINISHED",
      "progress":100.0,
      "diagnosticsInfo":"",
      "originalTrackingUrl":"N/A",
      "trackingUrl":"http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0003/",
      "finalAppStatus":"SUCCEEDED",
      "submittedTime":1430424956650,
      "startedTime":1430424956650,
      "finishedTime":1430424963907,
      "elapsedTime":7257,
      "unmanagedApplication":"false",
      "applicationPriority":0,
      "appNodeLabelExpression":"",
      "amNodeLabelExpression":""
      },
      {
      "appId":"application_1430424020775_0002",
      "currentAppAttemptId":"appattempt_1430424020775_0002_000001",
      "user":"zshen",
      "name":"DistributedShell",
      "queue":"default",
      "type":"YARN",
      "host":"d-69-91-129-173.dhcp4.washington.edu/69.91.129.173",
      "rpcPort":-1,
      "appState":"FINISHED",
      "progress":100.0,
      "diagnosticsInfo":"",
      "originalTrackingUrl":"N/A",
      "trackingUrl":"http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0002/",
      "finalAppStatus":"SUCCEEDED",
      "submittedTime":1430424769395,
      "startedTime":1430424769395,
      "finishedTime":1430424776594,
      "elapsedTime":7199,
      "unmanagedApplication":"false",
      "applicationPriority":0,
      "appNodeLabelExpression":"",
      "amNodeLabelExpression":""
      },
      {
      "appId":"application_1430424020775_0001",
      "currentAppAttemptId":"appattempt_1430424020775_0001_000001",
      "user":"zshen",
      "name":"QuasiMonteCarlo",
      "queue":"default",
      "type":"MAPREDUCE",
      "host":"localhost",
      "rpcPort":56264,
      "appState":"FINISHED",
      "progress":100.0,
      "diagnosticsInfo":"",
      "originalTrackingUrl":"http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001",
      "trackingUrl":"http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/",
      "finalAppStatus":"SUCCEEDED",
      "submittedTime":1430424053809,
      "startedTime":1430424072153,
      "finishedTime":1430424776594,
      "elapsedTime":18344,
      "applicationTags":"mrapplication,ta-example",
      "unmanagedApplication":"false",
      "applicationPriority":0,
      "appNodeLabelExpression":"",
      "amNodeLabelExpression":""
      }
  ]
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 1710

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<apps>
  <app>
    <appId>application_1430424020775_0004</appId>
    <currentAppAttemptId>appattempt_1430424020775_0004_000001</currentAppAttemptId>
    <user>zshen</user>
    <name>DistributedShell</name>
    <queue>default</queue>
    <type>YARN</type>
    <host>d-69-91-129-173.dhcp4.washington.edu/69.91.129.173</host>
    <rpcPort>-1</rpcPort>
    <appState>FINISHED</appState>
    <progress>100.0</progress>
    <diagnosticsInfo></diagnosticsInfo>
    <originalTrackingUrl>N/A</originalTrackingUrl>
    <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0004/</trackingUrl>
    <finalAppStatus>SUCCEEDED</finalAppStatus>
    <submittedTime>1430425001004</submittedTime>
    <startedTime>1430425001004</startedTime>
    <finishedTime>1430425008861</finishedTime>
    <elapsedTime>7857</elapsedTime>
    <unmanagedApplication>false</unmanagedApplication>
    <applicationPriority>0</applicationPriority>
    <appNodeLabelExpression></appNodeLabelExpression>
    <amNodeLabelExpression></amNodeLabelExpression>
  </app>
  <app>
    <appId>application_1430424020775_0003</appId>
    <currentAppAttemptId>appattempt_1430424020775_0003_000001</currentAppAttemptId>
    <user>zshen</user>
    <name>DistributedShell</name>
    <queue>default</queue>
    <type>YARN</type>
    <host>d-69-91-129-173.dhcp4.washington.edu/69.91.129.173</host>
    <rpcPort>-1</rpcPort>
    <appState>FINISHED</appState>
    <progress>100.0</progress>
    <diagnosticsInfo></diagnosticsInfo>
    <originalTrackingUrl>N/A</originalTrackingUrl>
    <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0003/</trackingUrl>
    <finalAppStatus>SUCCEEDED</finalAppStatus>
    <submittedTime>1430424956650</submittedTime>
    <startedTime>1430424956650</startedTime>
    <finishedTime>1430424963907</finishedTime>
    <elapsedTime>7257</elapsedTime>
    <unmanagedApplication>false</unmanagedApplication>
    <applicationPriority>0</applicationPriority>
    <appNodeLabelExpression></appNodeLabelExpression>
    <amNodeLabelExpression></amNodeLabelExpression>
  </app>
  <app>
    <appId>application_1430424020775_0002</appId>
    <currentAppAttemptId>appattempt_1430424020775_0002_000001</currentAppAttemptId>
    <user>zshen</user>
    <name>DistributedShell</name>
    <queue>default</queue>
    <type>YARN</type>
    <host>d-69-91-129-173.dhcp4.washington.edu/69.91.129.173</host>
    <rpcPort>-1</rpcPort>
    <appState>FINISHED</appState>
    <progress>100.0</progress>
    <diagnosticsInfo></diagnosticsInfo>
    <originalTrackingUrl>N/A</originalTrackingUrl>
    <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0002/</trackingUrl>
    <finalAppStatus>SUCCEEDED</finalAppStatus>
    <submittedTime>1430424769395</submittedTime>
    <startedTime>1430424769395</startedTime>
    <finishedTime>1430424776594</finishedTime>
    <elapsedTime>7199</elapsedTime>
    <unmanagedApplication>false</unmanagedApplication>
    <applicationPriority>0</applicationPriority>
    <appNodeLabelExpression></appNodeLabelExpression>
    <amNodeLabelExpression></amNodeLabelExpression>
  </app>
  <app>
    <appId>application_1430424020775_0001</appId>
    <currentAppAttemptId>appattempt_1430424020775_0001_000001</currentAppAttemptId>
    <user>zshen</user>
    <name>QuasiMonteCarlo</name>
    <queue>default</queue>
    <type>MAPREDUCE</type>
    <host>localhost</host>
    <rpcPort>56264</rpcPort>
    <appState>FINISHED</appState>
    <progress>100.0</progress>
    <diagnosticsInfo></diagnosticsInfo>
    <originalTrackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001</originalTrackingUrl>
    <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/</trackingUrl>
    <finalAppStatus>SUCCEEDED</finalAppStatus>
    <submittedTime>1430424053809</submittedTime>
    <startedTime>1430424053809</startedTime>
    <finishedTime>1430424072153</finishedTime>
    <elapsedTime>18344</elapsedTime>
    <applicationTags>mrapplication,ta-example</applicationTags>
    <unmanagedApplication>false</unmanagedApplication>
    <applicationPriority>0</applicationPriority>
    <appNodeLabelExpression></appNodeLabelExpression>
    <amNodeLabelExpression></amNodeLabelExpression>
  </app>
</apps>

应用

使用Application API,您可以获得一个应用程序资源,其中包含有关在YARN群集上运行的特定应用程序的信息。

它本质上是YARN ApplicationReport结构的XML / JSON序列化形式。

URI:

使用以下URI获取由appid值标识的应用程序对象。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps/{appid}

支持HTTP操作:

GET

查询参数支持:

None

应用程序的元素(应用程序)对象:

Item Data Type Description
appId string The application ID
user string The user who started the application
name string The application name
type string The application type
queue string The queue to which the application submitted
appState string The application state according to the ResourceManager - valid values are members of the YarnApplicationState enum: FINISHED, FAILED, KILLED
finalStatus string The final status of the application if finished - reported by the application itself - valid values are: UNDEFINED, SUCCEEDED, FAILED, KILLED
progress float The reported progress of the application as a percent. Long-lived YARN services may not provide a meaninful value here —or use it as a metric of actual vs desired container counts
trackingUrl string The web URL of the application (via the RM Proxy)
originalTrackingUrl string The actual web URL of the application
diagnosticsInfo string Detailed diagnostics information on a completed application
startedTime long The time in which application started (in ms since epoch)
finishedTime long The time in which the application finished (in ms since epoch)
elapsedTime long The elapsed time since the application started (in ms)
allocatedMB int The sum of memory in MB allocated to the application’s running containers
allocatedVCores int The sum of virtual cores allocated to the application’s running containers
currentAppAttemptId string The latest application attempt ID
host string The host of the ApplicationMaster
rpcPort int The RPC port of the ApplicationMaster; zero if no IPC service declared
applicationTags string The application tags.
unmanagedApplication boolean Is the application unmanaged.
applicationPriority int Priority of the submitted application.
appNodeLabelExpression string Node Label expression which is used to identify the nodes on which application’s containers are expected to run by default.
amNodeLabelExpression string Node Label expression which is used to identify the node on which application’s AM container is expected to run.

响应示例:

JSON响应

HTTP请求:

http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "appId": "application_1430424020775_0001",
  "currentAppAttemptId": "appattempt_1430424020775_0001_000001",
  "user": "zshen",
  "name": "QuasiMonteCarlo",
  "queue": "default",
  "type": "MAPREDUCE",
  "host": "localhost",
  "rpcPort": 56264,
  "appState": "FINISHED",
  "progress": 100.0,
  "diagnosticsInfo": "",
  "originalTrackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001",
  "trackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/",
  "finalAppStatus": "SUCCEEDED",
  "submittedTime": 1430424053809,
  "startedTime": 1430424053809,
  "finishedTime": 1430424072153,
  "elapsedTime": 18344,
  "applicationTags": mrapplication,tag-example,
  "unmanagedApplication": "false",
  "applicationPriority": 0,
  "appNodeLabelExpression": "",
  "amNodeLabelExpression": ""
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001
Accept: application/xml

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 873

回应机构:

 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <app>
   <appId>application_1430424020775_0001</appId>
   <currentAppAttemptId>appattempt_1430424020775_0001_000001</currentAppAttemptId>
   <user>zshen</user>
   <name>QuasiMonteCarlo</name>
   <queue>default</queue>
   <type>MAPREDUCE</type>
   <host>localhost</host>
   <rpcPort>56264</rpcPort>
   <appState>FINISHED</appState>
   <progress>100.0</progress>
   <diagnosticsInfo></diagnosticsInfo>
   <originalTrackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001</originalTrackingUrl>
   <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/</trackingUrl>
   <finalAppStatus>SUCCEEDED</finalAppStatus>
   <submittedTime>1430424053809</submittedTime>
   <startedTime>1430424053809</startedTime>
   <finishedTime>1430424072153</finishedTime>
   <elapsedTime>18344</elapsedTime>
   <applicationTags>mrapplication,ta-example</applicationTags>
   <unmanagedApplication>false</unmanagedApplication>
   <applicationPriority>0</applicationPriority>
   <appNodeLabelExpression><appNodeLabelExpression>
   <amNodeLabelExpression><amNodeLabelExpression>
 </app>

申请尝试清单

使用Application Attempt List API,您可以获取资源集合,每个资源代表一次应用程序尝试。在此资源上运行GET操作时,您将获得一组应用程序尝试对象。

URI:

使用以下URI获取由appid值标识的应用程序的所有尝试对象。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps/{appid}/appattempts

支持HTTP操作:

GET

查询参数支持:

没有

appattempts(应用程序尝试列表)对象的元素

当您请求应用程序尝试列表时,该信息将作为应用程序尝试对象的集合返回。有关应用程序尝试对象的语法,请参阅Application Attempt

项目 数据类型 描述
appattempt appattempt对象数组(JSON)/零个或多个应用程序尝试对象(XML) 应用程序尝试对象的集合

响应示例:

JSON响应

HTTP请求:

GET  http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "appAttempt": [
    {
      "appAttemptId": "appattempt_1430424020775_0001_000001",
      "host": "localhost",
      "rpcPort": 56264,
      "trackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/",
      "originalTrackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001",
      "diagnosticsInfo": "",
      "appAttemptState": "FINISHED",
      "amContainerId": "container_1430424020775_0001_01_000001"
    }
  ]
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts
Accept: application/xml

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<appAttempts>
  <appAttempt>
    <appAttemptId>appattempt_1430424020775_0001_000001</appAttemptId>
    <host>localhost</host>
    <rpcPort>56264</rpcPort>
    <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/</trackingUrl>
    <originalTrackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001</originalTrackingUrl>
    <diagnosticsInfo></diagnosticsInfo>
    <appAttemptState>FINISHED</appAttemptState>
    <amContainerId>container_1430424020775_0001_01_000001</amContainerId>
  </appAttempt>
</appAttempts>

申请尝试

使用Application Attempt API,您可以获取应用程序尝试资源,其中包含有关在YARN群集上运行的应用程序的特定应用程序尝试的信息。

URI:

使用以下URI获取由appid值和appattemptid值标识的应用程序尝试对象。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps/{appid}/appattempts/{appattemptid}

支持HTTP操作:

GET

查询参数支持:

没有

appattempt(Application Attempt)对象的元素:

项目 数据类型 描述
appAttemptId string 应用程序尝试Id
amContainerId string ApplicationMaster容器标识
appAttemptState string 根据ResourceManager的应用程序尝试状态 - 有效值是YarnApplicationAttemptState枚举的成员:FINISHED,FAILED,KILLED
trackingUrl string 可用于跟踪应用程序的Web URL
originalTrackingUrl string 应用程序的实际Web URL
diagnosticsInfo string 详细的诊断信息
host string ApplicationMaster的主机
rpcPort int ApplicationMaster的rpc端口

响应示例:

JSON响应

HTTP请求:

http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts/appattempt_1430424020775_0001_000001

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "appAttemptId": "appattempt_1430424020775_0001_000001",
  "host": "localhost",
  "rpcPort": 56264,
  "trackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/",
  "originalTrackingUrl": "http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001",
  "diagnosticsInfo": "",
  "appAttemptState": "FINISHED",
  "amContainerId": "container_1430424020775_0001_01_000001"
}

XML响应

HTTP请求:

GET http://<timeline server http address:port>/ws/v1/applicationhistory/apps/application_1395789200506_0001/appattempts/appattempt_1395789200506_0001_000001
Accept: application/xml

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 488

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<appAttempt>
  <appAttemptId>appattempt_1430424020775_0001_000001</appAttemptId>
  <host>localhost</host>
  <rpcPort>56264</rpcPort>
  <trackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:8088/proxy/application_1430424020775_0001/</trackingUrl>
  <originalTrackingUrl>http://d-69-91-129-173.dhcp4.washington.edu:19888/jobhistory/job/job_1430424020775_0001</originalTrackingUrl>
  <diagnosticsInfo></diagnosticsInfo>
  <appAttemptState>FINISHED</appAttemptState>
  <amContainerId>container_1430424020775_0001_01_000001</amContainerId>
</appAttempt>

Container List

使用Container List API,您可以获取资源集合,每个资源代表一个容器。在此资源上运行GET操作时,您将获得容器对象的集合。

URI:

使用以下URI获取由appid值和appattemptid值标识的应用程序尝试的所有容器对象。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps/{appid}/appattempts/{appattemptid}/containers

支持HTTP操作:

GET

查询参数支持:

None

容器的元素(Container List)对象

当您请求容器列表时,信息将作为容器对象的集合返回。有关容器对象的语法,另请参见Container。

项目 数据类型 描述
container array of container objects(JSON)/zero or more container objects(XML) 容器对象的集合

响应示例:

JSON响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts/appattempt_1430424020775_0001_000001/containers?

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "container": [
    {
      "containerId": "container_1430424020775_0001_01_000007",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 10,
      "startedTime": 1430424068296,
      "finishedTime": 1430424073006,
      "elapsedTime": 4710,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000007/container_1430424020775_0001_01_000007/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000006",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 20,
      "startedTime": 1430424060317,
      "finishedTime": 1430424068293,
      "elapsedTime": 7976,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000006/container_1430424020775_0001_01_000006/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000005",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 20,
      "startedTime": 1430424060316,
      "finishedTime": 1430424068294,
      "elapsedTime": 7978,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000005/container_1430424020775_0001_01_000005/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000003",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 20,
      "startedTime": 1430424060315,
      "finishedTime": 1430424068289,
      "elapsedTime": 7974,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000003/container_1430424020775_0001_01_000003/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000004",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 20,
      "startedTime": 1430424060315,
      "finishedTime": 1430424068291,
      "elapsedTime": 7976,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000004/container_1430424020775_0001_01_000004/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000002",
      "allocatedMB": 1024,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 20,
      "startedTime": 1430424060313,
      "finishedTime": 1430424067250,
      "elapsedTime": 6937,
      "diagnosticsInfo": "Container killed by the ApplicationMaster.\nContainer killed on request. Exit code is 143\nContainer exited with a non-zero exit code 143\n",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000002/container_1430424020775_0001_01_000002/zshen",
      "containerExitStatus": -105,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    },
    {
      "containerId": "container_1430424020775_0001_01_000001",
      "allocatedMB": 2048,
      "allocatedVCores": 1,
      "assignedNodeId": "localhost:9105",
      "priority": 0,
      "startedTime": 1430424054314,
      "finishedTime": 1430424079022,
      "elapsedTime": 24708,
      "diagnosticsInfo": "",
      "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000001/container_1430424020775_0001_01_000001/zshen",
      "containerExitStatus": 0,
      "containerState": "COMPLETE",
      "nodeHttpAddress": "http://localhost:8042"
    }
  ]
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts/appattempt_1430424020775_0001_000001/containers
Accept: application/xml

响应标题:

  HTTP/1.1 200 OK
  Content-Type: application/xml
  Content-Length: 1428

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<containers>
  <container>
    <containerId>container_1430424020775_0001_01_000007</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>10</priority>
    <startedTime>1430424068296</startedTime>
    <finishedTime>1430424073006</finishedTime>
    <elapsedTime>4710</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000007/container_1430424020775_0001_01_000007/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000006</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>20</priority>
    <startedTime>1430424060317</startedTime>
    <finishedTime>1430424068293</finishedTime>
    <elapsedTime>7976</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000006/container_1430424020775_0001_01_000006/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000005</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>20</priority>
    <startedTime>1430424060316</startedTime>
    <finishedTime>1430424068294</finishedTime>
    <elapsedTime>7978</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000005/container_1430424020775_0001_01_000005/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000003</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>20</priority>
    <startedTime>1430424060315</startedTime>
    <finishedTime>1430424068289</finishedTime>
    <elapsedTime>7974</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000003/container_1430424020775_0001_01_000003/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000004</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>20</priority>
    <startedTime>1430424060315</startedTime>
    <finishedTime>1430424068291</finishedTime>
    <elapsedTime>7976</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000004/container_1430424020775_0001_01_000004/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000002</containerId>
    <allocatedMB>1024</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>20</priority>
    <startedTime>1430424060313</startedTime>
    <finishedTime>1430424067250</finishedTime>
    <elapsedTime>6937</elapsedTime>
    <diagnosticsInfo>Container killed by the ApplicationMaster.
      Container killed on request. Exit code is 143
      Container exited with a non-zero exit code 143
    </diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000002/container_1430424020775_0001_01_000002/zshen</logUrl>
    <containerExitStatus>-105</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
  <container>
    <containerId>container_1430424020775_0001_01_000001</containerId>
    <allocatedMB>2048</allocatedMB>
    <allocatedVCores>1</allocatedVCores>
    <assignedNodeId>localhost:9105</assignedNodeId>
    <priority>0</priority>
    <startedTime>1430424054314</startedTime>
    <finishedTime>1430424079022</finishedTime>
    <elapsedTime>24708</elapsedTime>
    <diagnosticsInfo></diagnosticsInfo>
    <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000001/container_1430424020775_0001_01_000001/zshen</logUrl>
    <containerExitStatus>0</containerExitStatus>
    <containerState>COMPLETE</containerState>
    <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
  </container>
</containers>

容器

使用Container API,您可以获取容器资源,其中包含有关在YARN群集上运行的应用程序的应用程序尝试的特定容器的信息。

URI:

使用以下URI获取由appid值,appattemptid值和containerid值标识的容器对象。

http(s)://<timeline server http(s) address:port>/ws/v1/applicationhistory/apps/{appid}/appattempts/{appattemptid}/containers/{containerid}

支持HTTP操作:

GET

查询参数支持:

None

容器的元素(容器)对象:

 

Item Data Type Description
containerId string The container Id
containerState string The container state according to the ResourceManager - valid values are members of the ContainerState enum: COMPLETE
containerExitStatus int The container exit status
logUrl string The log URL that can be used to access the container aggregated log
diagnosticsInfo string Detailed diagnostics information
startedTime long The time in which container started (in ms since epoch)
finishedTime long The time in which the container finished (in ms since epoch)
elapsedTime long The elapsed time since the container started (in ms)
allocatedMB int The memory in MB allocated to the container
allocatedVCores int The virtual cores allocated to the container
priority int The priority of the container
assignedNodeId string The assigned node host and port of the container

 

响应示例:

JSON响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts/appattempt_1430424020775_0001_000001/containers/container_1430424020775_0001_01_000001

响应标题:

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

回应机构:

{
  "containerId": "container_1430424020775_0001_01_000001",
  "allocatedMB": 2048,
  "allocatedVCores": 1,
  "assignedNodeId": "localhost:9105",
  "priority": 0,
  "startedTime": 1430424054314,
  "finishedTime": 1430424079022,
  "elapsedTime": 24708,
  "diagnosticsInfo": "",
  "logUrl": "http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000001/container_1430424020775_0001_01_000001/zshen",
  "containerExitStatus": 0,
  "containerState": "COMPLETE",
  "nodeHttpAddress": "http://localhost:8042"
}

XML响应

HTTP请求:

GET http://localhost:8188/ws/v1/applicationhistory/apps/application_1430424020775_0001/appattempts/appattempt_1430424020775_0001_000001/containers/container_1430424020775_0001_01_000001
Accept: application/xml

响应标题:

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 669

回应机构:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<container>
  <containerId>container_1430424020775_0001_01_000001</containerId>
  <allocatedMB>2048</allocatedMB>
  <allocatedVCores>1</allocatedVCores>
  <assignedNodeId>localhost:9105</assignedNodeId>
  <priority>0</priority>
  <startedTime>1430424054314</startedTime>
  <finishedTime>1430424079022</finishedTime>
  <elapsedTime>24708</elapsedTime>
  <diagnosticsInfo></diagnosticsInfo>
  <logUrl>http://0.0.0.0:8188/applicationhistory/logs/localhost:9105/container_1430424020775_0001_01_000001/container_1430424020775_0001_01_000001/zshen</logUrl>
  <containerExitStatus>0</containerExitStatus>
  <containerState>COMPLETE</containerState>
  <nodeHttpAddress>http://localhost:8042</nodeHttpAddress>
</container>

响应代码

  1. 无法解析域,实体类型,实体ID或类似物的查询会导致HTTP 404,“未找到”响应。
  2. 路径,参数或值无效的请求导致错误请求400响应。
  3. 在安全集群中,当尝试执行调用者没有足够权限的操作时,生成401“禁止”响应。在查询某些实体(例如域)时,会有例外; 在这里,API故意将许可被拒绝的结果降级为空的和未找到的响应。这会隐藏未经授权的呼叫者的其他域的详细信息。
  4. 如果时间轴实体PUT操作的内容无效,则此失败不会导致HTTP错误代码被撤销。将返回状态代码200 - 但是,在每个无法添加的实体的失败实体列表中将存在错误代码。

时间线服务器性能测试工具

强调

时间线服务器性能测试工具有助于测量时间线服务器的写入性能。测试启动SimpleEntityWriter映射器或JobHistoryFileReplay映射器以将时间轴实体写入时间线服务器。最后,将测量并打印出每个映射器的事务率(ops / s)和总事务率。使用SimpleEntityWriter映射器运行测试还将测量并显示每个映射器的IO速率(KB / s)和总IO速率。

用法

映射器类型说明:

  1. SimpleEntityWriter映射器每个映射器将用户指定数量的具有用户指定大小的时间轴实体写入时间线服务器。SimpleEntityWrite是性能测试工具的默认映射器。
    1. JobHistoryFileReplay映射器每个映射器都会在指定的目录下重放jobhistory文件(需要存在jhist文件及其相应的conf.xml才能重放。映射器的数量不应超过jobhistory文件的数量)。每个映射器都会被分配一些jobhistory文件进行重放。对于每个作业历史文件,映射器将解析它以获取jobinfo,然后创建时间轴实体。每个映射器还可以选择写入一次创建或一次创建的所有时间轴实体。

选项:

[-m <maps>] number of mappers (default: 1)
[-v] timeline service version
[-mtype <mapper type in integer>]
      1. simple entity write mapper (default)
      2. jobhistory files replay mapper
[-s <(KBs)test>] number of KB per put (mtype=1, default: 1 KB)
[-t] package sending iterations per mapper (mtype=1, default: 100)
[-d <path>] root path of job history files (mtype=2)
[-r <replay mode>] (mtype=2)
      1. write all entities for a job in one put (default)
      2. write one entity at a time
Sample Runs

样本运行

运行SimpleEntityWriter测试:

bin/hadoop jar performanceTest.jar timelineperformance -m 4 -mtype 1 -s 3 -t 200

SimpleEntityWriter测试的示例输出:

TRANSACTION RATE (per mapper): 20000.0 ops/s
IO RATE (per mapper): 60000.0 KB/s
TRANSACTION RATE (total): 80000.0 ops/s
IO RATE (total): 240000.0 KB/s

运行JobHistoryFileReplay映射器测试

$ bin/hadoop jar performanceTest.jar timelineperformance -m 2 -mtype 2 -d /testInput -r 2

JobHistoryFileReplay映射器测试的示例输入:

$ bin/hadoop fs -ls /testInput
/testInput/job_1.jhist
/testInput/job_1_conf.xml
/testInput/job_2.jhist
/testInput/job_2_conf.xml

JobHistoryFileReplay测试的输出示例:

 

 

TRANSACTION RATE (per mapper): 4000.0 ops/s
IO RATE (per mapper): 0.0 KB/s
TRANSACTION RATE (total): 8000.0 ops/s
IO RATE (total): 0.0 KB/s

 

 

 

原文链接: https://hadoop.apache.org/docs/r3.2.0/

 

 

 

展开阅读全文

没有更多推荐了,返回首页