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

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