1. timeline是什么
2. timeline能做什么
3. timeline結構
4. timeline怎么配置
1). timeline是什么?
它能存儲和檢索應用當前和歷史信息在yarn配置的地址里,它有兩個特性:持久化應用特定信息和保存已完成應用的相關信息
目前的現狀:
1. timeline 服務器的核心功能已完成
2. 它可以工作在安全和非安全的集群上
3. 通用的history server已經構建在timeline store上
4. timeline的的存儲可以存在在內存和leveldb的數據庫中,后者可以保證重啟timeline server后可以保存歷史記錄
5. 不支持在yarn中安裝特定於框架的UIs
6. 應用程序特定的信息只能通過使用json類型內容的RESTful APIs獲得
7. timeline server v1的rest api已經聲明作為其他rest APIs之一,其兼容性將在將來的版本中維護
8. timeline server單實例限制了服務的可伸縮性,不支持高可用
將來計划:
1. 未來版本將引入可擴展且可靠下一代timeline server,"timeline server v2"
2. 擴展應用不能使用timeline server v1 rest API服務的功能,它將包括擴展數據結構以及客戶端在時間線服務器實例之間進行故障切換的能力
2. timeline能做什么
1. 持久化應用特定信息:
它能收集和檢索應用或者框架的完整信息。
例如:
hadoop的MapReduce框架它包含的信息像多少個map tasks,reduce tasks,counters等等
應用開發者發布的指定的信息到timeline server通過在application master or application的containers里的timeline client
這些信息可以通過rest api可查詢,以便由特定應用程序或者框架的uis進行渲染
2. 保存已完成應用的相關信息:
jobhistory僅支持MapReduce作業的任務,隨着timeline server的出現,應用的history將只是timeline server的一部分
通用信息包括應用層數據,比如:
隊列名
用戶信息以及應用的上下文信息
運行任務的嘗試列表
每一個應用嘗試的信息
每一個嘗試信息下container列表
每個container信息
一般數據由yarn resourcemanager發布到timeline store和由其web ui來顯示有關已完成應用程序的信息
3. timeline結構


Timeline Domain(時間軸域)
Timeline域為Timeline服務器提供了一個命名空間,允許用戶托管多個實體,將它們與其他用戶和應用程序隔離開來。時間軸服務器安全性在此級別定義。
“域”主要存儲所有者信息、讀取和寫入ACL信息、創建和修改的時間戳信息。每個域由ID標識,該ID在yarn集群中的所有用戶中必須是唯一的。
Timeline Entity(時間線實體)
時間線實體包含概念實體及其相關事件的元信息。
實體可以是應用程序、應用程序嘗試、容器或任何用戶定義的對象。
它包含將用於索引時間線存儲中的實體的主篩選器。
因此,用戶/應用程序應仔細選擇要存儲的信息作為主篩選器。
剩余的數據可以存儲為未索引的信息。每個實體由實體id和實體類型唯一標識。
Timeline Events(時間線事件)
時間線事件描述與應用程序的特定時間線實體相關的事件。
用戶可以自由定義事件的含義,例如啟動應用程序、分配容器、操作失敗或其他被認為與用戶和群集操作員相關的信息。
4. timeline怎么配置
vim yarn-site.xml
1 <!--start timeline settings --> 2 <property> 3 <description></description> 4 <name>yarn.timeline-service.hostname</name> 5 <value>localhost</value> 6 </property> 7 8 <property> 9 <description>Address for the Timeline server to start the RPC server.</description> 10 <name>yarn.timeline-service.address</name> 11 <value>${yarn.timeline-service.hostname}:10200</value> 12 </property> 13 14 <property> 15 <description>The http address of the Timeline service web application.</description> 16 <name>yarn.timeline-service.webapp.address</name> 17 <value>${yarn.timeline-service.hostname}:8188</value> 18 </property> 19 20 <property> 21 <description>The https address of the Timeline service web application.</description> 22 <name>yarn.timeline-service.webapp.https.address</name> 23 <value>${yarn.timeline-service.hostname}:8190</value> 24 </property> 25 26 <property> 27 <description>Handler thread count to serve the client RPC requests.</description> 28 <name>yarn.timeline-service.handler-thread-count</name> 29 <value>10</value> 30 </property> 31 32 <property> 33 <description>Enables cross-origin support (CORS) for web services where 34 cross-origin web response headers are needed. For example, javascript making 35 a web services request to the timeline server,是否支持請求頭跨域</description> 36 <name>yarn.timeline-service.http-cross-origin.enabled</name> 37 <value>false</value> 38 </property> 39 40 <property> 41 <description>Comma separated list of origins that are allowed for web 42 services needing cross-origin (CORS) support. Wildcards (*) and patterns 43 allowed,#需要跨域源支持的web服務所允許的以逗號分隔的列表</description> 44 <name>yarn.timeline-service.http-cross-origin.allowed-origins</name> 45 <value>*</value> 46 </property> 47 48 <property> 49 <description>Comma separated list of methods that are allowed for web 50 services needing cross-origin (CORS) support.,跨域所允許的請求操作</description> 51 <name>yarn.timeline-service.http-cross-origin.allowed-methods</name> 52 <value>GET,POST,HEAD</value> 53 </property> 54 55 <property> 56 <description>Comma separated list of headers that are allowed for web 57 services needing cross-origin (CORS) support.允許用於web的標題的逗號分隔列表</description> 58 <name>yarn.timeline-service.http-cross-origin.allowed-headers</name> 59 <value>X-Requested-With,Content-Type,Accept,Origin</value> 60 </property> 61 62 <property> 63 <description>The number of seconds a pre-flighted request can be cached 64 for web services needing cross-origin (CORS) support.可以緩存預先傳送的請求的秒數</description> 65 <name>yarn.timeline-service.http-cross-origin.max-age</name> 66 <value>1800</value> 67 </property> 68 69 <property> 70 <description>向資源管理器和客戶端指示是否歷史記錄-服務是否啟用。如果啟用,資源管理器將啟動 71 記錄工時記錄服務可以使用歷史數據。同樣,當應用程序如果啟用此選項,請完成.</description> 72 <name>yarn.timeline-service.generic-application-history.enabled</name> 73 <value>true</value> 74 </property> 75 76 <property> 77 <description>Store class name for history store, defaulting to file system store</description> 78 <name>yarn.timeline-service.generic-application-history.store-class</name> 79 <value>org.apache.hadoop.yarn.server.applicationhistoryservice.FileSystemApplicationHistoryStore</value> 80 </property> 81 82 <property> 83 <description>向客戶端指示是否啟用時間線服務。如果啟用,最終用戶使用的timeline客戶端庫將發布實體 84 和事件發送到時間線服務器.</description> 85 <name>yarn.timeline-service.enabled</name> 86 <value>true</value> 87 </property> 88 89 <property> 90 <description>Store class name for timeline store.</description> 91 <name>yarn.timeline-service.store-class</name> 92 <value>org.apache.hadoop.yarn.server.timeline.LeveldbTimelineStore</value> 93 </property> 94 95 <property> 96 <description>Enable age off of timeline store data.啟用timeline時間老化</description> 97 <name>yarn.timeline-service.ttl-enable</name> 98 <value>true</value> 99 </property> 100 101 <property> 102 <description>Time to live for timeline store data in milliseconds.timeline時間老化時間</description> 103 <name>yarn.timeline-service.ttl-ms</name> 104 <value>6048000000</value> 105 </property> 106 <!--end timeline settings --></span>
啟動timeline 服務
$HADOOP_YARN_HOME/sbin/yarn-daemon.sh start timelineserver
用戶能夠通過以下命令訪問application的通用歷史數據:
$ 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>