在 YARN 群集上運行 Samza 作業(yè)時,您可能需要在啟動前下載一些資源(例如,下載作業(yè)二進制文件,獲取證書文件等)。此步驟稱為資源本地化。
對于在 YARN 上運行的 Samza 工作,資源本地化利用了 YARN 節(jié)點管理器的本地化服務。這是一個關于如何本地化在 YARN 中的工作的深入研究。
根據資源的來源與方式,獲取資源與路徑相關的的方案(如http,https,hdfs,ftp,file等)。該方案映射到 FileSystem 處理本地化的相應實現。
FileSystem 在 Hadoop 和 Samza 中有一些預定義的實現,如果您在 YARN 上運行 Samza 工作,則會提供它們:
您可以創(chuàng)建自己的文件系統(tǒng)實現,方法是創(chuàng)建一個擴展的類 org.apache.hadoop.fs.FileSystem。
您可以通過以下配置指定要本地化的資源。
確保 yarn.resources.<resourceName>.path 在 YARN core-site.xml 中配置了相應的 FileSystem 實現。
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.http.impl</name>
<value>org.apache.samza.util.hadoop.HttpFileSystem</value>
</property>
</configuration>
如果您正在使用自己的方案(例如 yarn.resources.myResource.path = myScheme://host.com/test),則可以如下鏈接FileSystem實現。
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.myScheme.impl</name>
<value>com.myCompany.MySchemeFileSystem</value>
</property>
</configuration>
更多建議: