The YARN Timeline Service v.2

Table of Contents

Timeline Service v.2 概述

介绍

架构

现状和未来计划

部署

Configuration

Basic configuration

Advanced configuration

Security Configuration

Enabling CORS support

Enabling Timeline Service v.2

为存储准备Apache HBase集群

Step 1) Set up the HBase cluster

Step 2) Enable the coprocessor

Step 3) Create the timeline service schema

Timeline Service v.2 REST API


Timeline Service v.2 概述

介绍

YARN Timeline Service v.2 是时间轴服务器的下一个主要迭代,在v.1和v.1.5 之后创建V.2是为了解决v.1的两个主要挑战。

可扩展性

V.1 仅限于写/读器和存储的单个实例,并且不能很好地扩展到小集群之外。v2 使用了更可伸缩的分布式写入器体系结构和可伸缩的后端存储。

YARN Timeline Service v.2 分离数据的收集(写)和服务(读)。它使用分布式收集器,基本上每个 YARN 应用程序都有一个收集器。reader 是用于通过 REST API 服务查询的独立实例。

YARN Timeline Service v.2 选择 Apache HBase 作为主要的支持存储,因为 Apache HBase 可以很好地扩展到大容量,同时保持良好的读写响应时间。

提高易用性

在许多情况下,用户对“流程”或 YARN 应用程序的逻辑组级别的信息感兴趣。启动一组或一系列 YARN 应用程序来完成一个逻辑应用程序要常见得多。Timeline Service v.2 明确支持流的概念。此外,它还支持在流级别聚合度量。

同样,像配置和度量这样的信息也被当作一等公民来对待和支持。

下图说明了不同 YARN 实体建模流程之间的关系。

架构

YARN Timeline Service v.2 使用一组收集器(写入器)将数据写入后端存储。收集器是分布式的,并与它们专用于的应用程序主机一起定位。属于该应用程序的所有数据都被发送到应用程序级时间轴收集器,资源管理器时间轴收集器除外。

对于给定的应用程序,应用程序主程序可以将应用程序的数据写入位于同一位置的时间线收集器(这是该版本中的 NM 辅助服务)。此外,运行应用程序容器的其他节点的节点管理器也将数据写入运行应用程序主节点上的时间轴收集器。

资源管理器还维护自己的时间轴收集器。它只发出普通的生命周期事件来保持写操作的合理数量。

时间轴读取器是独立于时间轴收集器的守护进程,它们专用于通过 REST API 提供查询。

下图从较高的层次说明了该设计。

现状和未来计划

完整的写和读端到端流程是功能性的,Apache HBase 作为后端。您应该能够开始生成数据。启用后,所有 YARN 通用事件以及 YARN 系统指标(如 CPU 和内存)都会被发布。此外,包括分布式 Shell 和 MapReduce 在内的一些应用程序可以将每个框架的数据写入 YARN 时间轴服务v.2。

访问数据的基本模式是通过 REST。REST API 附带了大量有用且灵活的查询模式(有关更多信息,请参阅下面的内容)。YARN 客户端已与 ATSv2 集成。如果详细信息不存在于 ResouceManager 中,则可以从 TimelineReader 获取应用程序/尝试/容器报告。

收集器(写入器)当前作为辅助服务嵌入到节点管理器中。资源管理器也有其专用的进程内收集器。reader 当前是一个单一实例。目前,无法在 YARN 应用程序的上下文之外编写时间轴服务(即没有离群客户端)。

终端机支持 Kerberos 身份验证。所有到 HBase 的通信都可以成为 kerberos。参考配置配置的安全。增加了对简单授权的支持,可以为能够读取时间轴数据的用户和组提供可配置的白名单。默认情况下,允许集群管理员读取时间轴数据。

当 YARN 时间线服务 V.2 是禁用的,可以预期不会对任何其他现有功能造成功能或性能影响。

路线图包括:

  • 更健壮的存储容错能力。
  • 支持非集群客户端
  • 支持实体 acl
  • 用于报告和分析的流、用户和队列的离线(基于时间的周期性)聚合
  • 迁移和与 v1的兼容性

部署

Configuration

v.2 引入了新的配置,加粗的

Basic configuration

Configuration Property Description
yarn.timeline-service.enabled 向客户端指示是否启用时间轴服务。如果启用,应用程序使用的TimelineClient库将把实体和事件发送到时间轴服务器。默认值为false。
yarn.timeline-service.version 指示正在运行的时间轴服务的当前版本。For example, if “yarn.timeline-service.version” is 1.5, and “yarn.timeline-service.enabled” is true, it means the cluster will and must bring up the timeline service v.1.5 (and nothing else). On the client side, if the client uses the same version of timeline service, it must succeed. If the client chooses to use a smaller version in spite of this, then depending on how robust the compatibility story is between versions, the results may vary. Defaults to 1.0f.
yarn.timeline-service.writer.class 后端存储写入器的类。默认为 HBase 存储写入器。
yarn.timeline-service.reader.class 用于后端存储阅读器的类。默认为 HBase 存储阅读器。
yarn.system-metrics-publisher.enabled 控制 YARN 系统指标是否由 RM 和 NM 在时间轴服务上发布的设置。默认值为 false。
yarn.timeline-service.schema.prefix hbase 表的模式前缀。默认为“prod”。。

Advanced configuration

Configuration Property Description
yarn.timeline-service.hostname 时间轴服务 web 应用程序的主机名。Defaults to 0.0.0.0
yarn.timeline-service.reader.webapp.address 时间轴阅读器 web 应用程序的http地址。Defaults to ${yarn.timeline-service.hostname}:8188.
yarn.timeline-service.reader.webapp.https.address 时间轴阅读器 web 应用程序的 https 地址。Defaults to ${yarn.timeline-service.hostname}:8190.
yarn.timeline-service.reader.bind-host 时间轴阅读器将绑定到的实际地址。如果设置了这个可选地址,reader server 将绑定到这个地址和 yarn.timeline-service.reader.webapp.address 中指定的端口。通过设置为0.0.0.0,这对于让服务监听所有接口非常有用。
yarn.timeline-service.hbase.configuration.file 可选 URL 到一个 hbase-site.xml 配置文件,用于连接到 timeline-service hbase 集群。如果为空或未指定,则将从类路径加载 HBase 配置。当指定时,指定配置文件中的值将覆盖来自类路径的值。Defaults to null.
yarn.timeline-service.writer.flush-interval-seconds 控制时间线收集器刷新时间线写入器频率的设置。Defaults to 60.
yarn.timeline-service.app-collector.linger-period.ms 在应用程序主容器完成后,应用程序收集器将在 NM 中活动的时间段。Defaults to 60000 (60 seconds).
yarn.timeline-service.timeline-client.number-of-async-entities-to-merge Time line V2 客户端尝试合并这些数量众多的异步实体(如果可用),然后调用 REST ATS V2 API 提交。Defaults to 10.
yarn.timeline-service.hbase.coprocessor.app-final-value-retention-milliseconds 用于控制已完成应用程序的度量的最终值在合并到流 sum 之前保留多长时间的设置。默认为 259200000(3天)。这应该在 HBase 集群中设置。
yarn.rm.system-metrics-publisher.emit-container-events 控制 YARN 容器规格是否由 RM 发布到时间轴服务器的设置。这个配置设置是针对 ATS V2的。Defaults to false.
yarn.nodemanager.emit-container-events 控 YARN 线容器规格是否由 NM 发布到时间轴服务器的设置。这个配置设置是针对 ATS V2的。Defaults to true.

Security Configuration

可以通过配置 yarn.timeline-service.http-authentication.type to kerberos,启用安全性,使用以下配置选项:

Configuration Property Description
yarn.timeline-service.http-authentication.type 定义用于时间轴服务器(收集器/读取器)HTTP 端点的身份验证。Supported values are: simple / kerberos / #AUTHENTICATION_HANDLER_CLASSNAME#. Defaults to simple.
yarn.timeline-service.http-authentication.simple.anonymous.allowed 指示在使用“简单”身份验证时,时间轴服务器是否允许匿名请求。Defaults to true.
yarn.timeline-service.http-authentication.kerberos.principal 时间轴服务器(收集器/阅读器) HTTP 端点使用的 Kerberos 主体。
yarn.timeline-service.http-authentication.kerberos.keytab 时间轴服务器(收集器/阅读器) HTTP 端点使用的 Kerberos keytab ..
yarn.timeline-service.principal 时间轴阅读器的 Kerberos 主体。时间轴收集器将使用 NM 主体,因为它作为 NM 内部的辅助服务运行。
yarn.timeline-service.keytab 时间轴阅读器的 Kerberos keytab。NM keytab 将被用于时间轴收集器,因为它作为 NM内部的辅助服务运行。
yarn.timeline-service.delegation.key.update-interval Defaults to 86400000 (1 day).
yarn.timeline-service.delegation.token.renew-interval Defaults to 86400000 (1 day).
yarn.timeline-service.delegation.token.max-lifetime Defaults to 604800000 (7 days).
yarn.timeline-service.read.authentication.enabled 启用或禁用对读取时间轴服务 v2 数据的授权检查。Default is false which is disabled.
yarn.timeline-service.read.allowed.users 逗号分隔用户列表,后跟空格,然后逗号分隔组列表。它将允许这个用户和组列表读取数据并拒绝其他所有人。默认值设置为 none。如果启用了授权,则此配置是必需的。
yarn.webapp.filter-entity-list-by-user 默认是 false。如果设置为 true,则 yarn.timeline-service.read.authentication.enable 是禁用的,然后列出仅限远程用户实体的实体。这是列出 api 的常用配置。使用此配置 TimelineReader 将调用者UGI授权给实体所有者。如果不匹配,将从响应中删除这些实体。

Enabling CORS support

为时间轴服务v2启用跨源支持(CORS)。请设置以下配置参数:

  • 在 yarn-site.xml, 设置 yarn.timeline-service.http-cross-origin.enabled 为 true.
  • 在 core-site.xml, 添加 org.apache.hadoop.security.HttpCrossOriginFilterInitializer 到 hadoop.http.filter.initializers.
  • For more configurations used for cross-origin support, refer to HttpAuthentication. 请注意 yarn.timeline-service.http-cross-origin.enabled, 如果为 true, 将重写 hadoop.http.cross-origin.enabled.

Enabling Timeline Service v.2

为存储准备Apache HBase集群

准备存储时间轴服务v.2有几个步骤要做:

  • 步骤1) 设置 HBase 集群
  • 步骤2) 启用协处理器
  • 步骤3) 为时间轴服务v.2创建模式

下面将更详细地解释每个步骤。

Step 1) Set up the HBase cluster

第一部分是设置或选择一个 Apache HBase 集群作为存储集群。Apache HBase 支持的版本是 1.2.6(默认)和 2.0.0-beta1。1.0.x版本不与时间轴服务 v.2一起工作。默认情况下,Hadoop 版本是用 HBase 1.2.6 构建的。要使用 HBase 2.0.0-beta1,从源代码开始构建,选项 -Dhbase.profile=2.0

HBase 有不同的部署模式。请参考 HBase 手册以了解它们,并选择适合您的设置的模式。

Simple deployment for HBase

如果您打算为 Apache HBase 集群创建一个简单的部署配置文件,其中数据加载很少,但是数据需要在节点来来往往的情况下保持不变,那么可以考虑使用“Standalone HBase over HDFS”部署模式。

这是独立 HBase 设置的一个有用变体,它让所有 HBase 守护进程在一个 JVM 中运行,但它不是持久化到本地文件系统,而是持久化到 HDFS 实例。写入到复制数据的 HDFS 确保数据在节点来来往往的情况下保持不变。要配置这个独立的变体,请编辑设置 hbase 的 hbase-site.xml。rootdir 指向 HDFS 实例中的一个目录,然后设置 hbase.cluster.distributed 为 false。例如:

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://namenode.example.org:8020/hbase</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>false</value>
  </property>
</configuration>

 

Step 2) Enable the coprocessor

在这个版本中,协处理器是动态加载的( flowrun 表的表协处理器)。

将时间轴服务 jar 复制到 HBase 可以加载它的 HDFS。模式创建器中的 flowrun 表创建需要它。默认的 HDFS 位置是/hbase/coprocessor。例如,

hadoop fs -mkdir /hbase/coprocessor
hadoop fs -put hadoop-yarn-server-timelineservice-hbase-coprocessor-3.2.0-SNAPSHOT.jar
       /hbase/coprocessor/hadoop-yarn-server-timelineservice.jar

如果您想将 jar 放在 hdfs 上的另一个位置,那么还有一个名为 yarn.timeline-service.hbase.coprocessor.jar.hdfs.location 的 YARN 配置设置。例如:

<property>
  <name>yarn.timeline-service.hbase.coprocessor.jar.hdfs.location</name>
  <value>/custom/hdfs/path/jarName</value>
</property>

Step 3) Create the timeline service schema

最后,运行 schema creator 工具创建必要的表:

bin/hadoop org.apache.hadoop.yarn.server.timelineservice.storage.TimelineSchemaCreator -create

TimelineSchemaCreator 工具支持一些选项,这些选项可能会非常方便,尤其是当你在测试的时候。例如,可以使用 -skipExistingTable (简称-s)跳过现有的表,继续创建其他表,而不是创建模式失败。默认情况下,表的模式前缀为“prod.”。如果不提供选项或“-help”(简称“-h”),则打印命令用法。选项(-entityTableName, -appToflowTableName, -applicationTableName, -subApplicationTableName)将帮助覆盖默认表名。在使用自定义表名时,必须在 yarn.timeline-service.hbase.configuration.file 中配置的 hbase-site.xml 中设置以下具有自定义表名的配置。

yarn.timeline-service.app-flow.table.name
yarn.timeline-service.entity.table.name
yarn.timeline-service.application.table.name
yarn.timeline-service.subapplication.table.name
yarn.timeline-service.flowactivity.table.name
yarn.timeline-service.flowrun.table.name
yarn.timeline-service.domain.table.name

Enabling Timeline Service v.2

以下是启动时间表服务v.2的基本配置:

<property>
  <name>yarn.timeline-service.version</name>
  <value>2.0f</value>
</property>

<property>
  <name>yarn.timeline-service.enabled</name>
  <value>true</value>
</property>

<property>
  <name>yarn.nodemanager.aux-services</name>
  <value>mapreduce_shuffle,timeline_collector</value>
</property>

<property>
  <name>yarn.nodemanager.aux-services.timeline_collector.class</name>
  <value>org.apache.hadoop.yarn.server.timelineservice.collector.PerNodeTimelineCollectorsAuxService</value>
</property>

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

此外,如果要在同一个 Apache HBase 存储中使用多个集群存储数据,可能需要将 YARN 集群名称设置为一个合理的惟一值:

<property>
  <name>yarn.resourcemanager.cluster-id</name>
  <value>my_research_test_cluster</value>
</property>

另外,将 hBase -site.xml 配置文件添加到客户端 Hadoop 集群配置中,这样它就可以将数据写到您正在使用的 Apache HBase 集群中,或者设置 yarn.timeline-service.hbase.configuration.file 指向指向相同的 hbase-site.xml 的文件 URL。例如:

<property>
  <description> Optional URL to an hbase-site.xml configuration file to be
  used to connect to the timeline-service hbase cluster. If empty or not
  specified, then the HBase configuration will be loaded from the classpath.
  When specified the values in the specified configuration file will override
  those from the ones that are present on the classpath.
  </description>
  <name>yarn.timeline-service.hbase.configuration.file</name>
  <value>file:/etc/hbase/hbase-ats-dc1/hbase-site.xml</value>
</property>

配置时间轴服务1.5和v。添加以下属性

<property>
  <name>yarn.timeline-service.versions</name>
  <value>1.5f,2.0f</value>
</property>

如果上面没有配置,那么它将默认设置为 yarn.timeline-service.version 中的版本

Running Timeline Service v.2

重新启动资源管理器和节点管理器,以获取新的配置。收集器以嵌入式方式在资源管理器和节点管理器中启动。

时间轴服务读取器是一个单独的 YARN 守护进程,它可以使用以下语法启动:

$ yarn-daemon.sh start timelinereader

Enabling MapReduce to write to Timeline Service v.2

将 MapReduce 框架数据写入时间轴服务v。在 mapred-site.xml 中启用以下配置:

<property>
  <name>mapreduce.job.emit-timeline-data</name>
  <value>true</value>
</property>

 

Timeline Service v.2 REST API

http://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/TimelineServiceV2.html#Timeline_Service_v.2_REST_API

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章