使用 Apache Nemo 執行器
Apache Nemo 執行器可用於使用 Apache Nemo 執行 Beam 管道。Nemo 執行器可以使用 Nemo 編譯器通過各種最佳化過程來優化 Beam 管道,並使用 Nemo 執行時以分散式方式執行它們。您還可以部署一個獨立的應用程式以進行本機模式,或使用 YARN 或 Mesos 等資源管理器執行。
Nemo 執行器在 Apache Nemo 之上執行 Beam 管道,提供
- 批次和串流管道
- 容錯能力
- 與 YARN 和 Apache Hadoop 生態系統的其他組件整合
- 支援 Nemo 優化器提供的各種最佳化
Beam 功能矩陣 記錄了 Nemo 執行器支援的功能。
Nemo 執行器先決條件與設定
只需將版本高於 0.1
的 Nemo 執行器依賴項新增至您的 pom.xml,即可簡單地使用 Nemo 執行器,如下所示
<dependency>
<groupId>org.apache.nemo</groupId>
<artifactId>nemo-compiler-frontend-beam</artifactId>
<version>${nemo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
使用您的應用程式部署 Nemo
獨立的應用程式可能更容易管理,並允許您充分利用 Nemo 提供的功能。只需新增上面顯示的依賴項,並使用 Maven Shade 外掛程式來遮蔽應用程式 JAR
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
執行 mvn package
後,執行 ls target
,您應該會看到以下輸出 (在此範例中,您的 artifactId 是 beam-examples
,版本是 1.0.0
)
beam-examples-1.0.0-shaded.jar
使用這個遮蔽的 jar,您可以像這樣使用 bin/run_beam.sh
shell 腳本
## MapReduce example
./bin/run_beam.sh \
-job_id mr_default \
-user_main org.apache.nemo.examples.beam.WordCount \
-user_args "`pwd`/examples/resources/test_input_wordcount `pwd`/examples/resources/test_output_wordcount"
若要使用 YARN 的 Nemo,請將 Nemo 上的 -deploy_mode
標誌設定為 yarn
。
更多說明請參閱 Apache Nemo GitHub 的 README。
Nemo 執行器的管道選項
使用 Nemo 執行器執行管道時,您應該考慮以下管道選項
欄位 | 描述 | 預設值 |
---|---|---|
runner | 要使用的管道執行器。此選項允許您在執行時決定管道執行器。 | 設定為 NemoRunner 以使用 Nemo 執行。 |
maxBundleSize | 一個 bundle 中的最大元素數。 | 1000 |
maxBundleTimeMillis | 最終確定 bundle 之前等待的最大時間(以毫秒為單位)。 | 1000 |
更多選項將添加到列表中,以完全支援 Nemo 支援的各種選項。
其他資訊與注意事項
使用 Run_beam.sh 腳本
將 Nemo 應用程式提交到叢集時,通常會使用 Nemo 安裝中提供的 bin/run_beam.sh
腳本。該腳本還提供了一組更豐富的選項,您可以傳遞這些選項以設定 Nemo 的各種動作。請參閱 Apache Nemo GitHub README 以獲取更多資訊。
監控您的作業
您可以使用 Nemo WebUI 監控正在執行的 Nemo 作業。文件目前正在更新中,但更多資訊可以在 Apache Nemo GitHub README 上找到。
串流執行
新增選項 -scheduler_impl_class_name org.apache.nemo.runtime.master.scheduler.StreamingScheduler
和 -optimization_policy org.apache.nemo.compiler.optimizer.policy.StreamingPolicy
,以將 Nemo 執行器設定為串流模式。此外,請務必擴展 resources.json
中資源的 capacity
,例如
{
"type": "Reserved",
"memory_mb": 2048,
"capacity": 50000
}
請參閱 Apache Nemo GitHub README 以獲取更多資訊。
上次更新於 2024/10/31
您是否找到您要找的所有內容?
所有內容是否都實用且清晰?是否有任何您想要更改的內容?請告訴我們!