public interface YarnClientConfigurerYarnClientConfigure は、SpringYarnConfigurerAdapter を介してユーザーに公開される YarnClientBuilder のインターフェースです。 通常の構成は以下のようになります。
@Configuration
@EnableYarn(enable=Enable.CLIENT)
static class Config extends SpringYarnConfigurerAdapter {
@Override
public void configure(YarnClientConfigure client) throws Exception {
client
.appName("myAppName")
.withMasterRunner()
.contextClass(MyAppmasterConfiguration.class);
}
}
<yarn:client app-name="myAppName"> <yarn:master-runner /> </yarn:client>
| 修飾子と型 | メソッドと説明 |
|---|---|
YarnClientConfigurer | appName(java.lang.String appName)yarn アプリケーション名を指定します。 |
YarnClientConfigurer | appType(java.lang.String appType) 糸の適用型を指定します。 |
YarnClientConfigurer | clientClass(java.lang.Class<? extends YarnClient> clazz)YarnClient クラスを指定します。 |
YarnClientConfigurer | clientClass(java.lang.String clazz) 完全修飾クラス名として YarnClient を指定します。 |
YarnClientConfigurer | labelExpression(java.lang.String labelExpression)yarn アプリケーションの送信ラベル式を指定します。 |
YarnClientConfigurer | masterCommands(java.lang.String... commands) アプリケーションマスターを起動するために使用されるコマンドの生の配列を指定します。 |
YarnClientConfigurer | memory(int memory)Yarn アプリケーションコンテナーのメモリ予約を指定します。 |
YarnClientConfigurer | memory(java.lang.String memory)Yarn アプリケーションコンテナーのメモリ予約を指定します。 |
YarnClientConfigurer | priority(java.lang.Integer priority) 糸の適用優先度を指定します。 |
YarnClientConfigurer | queue(java.lang.String queue)yarn アプリケーションの送信キューを指定します。 |
YarnClientConfigurer | virtualCores(java.lang.Integer virtualCores)Yarn アプリケーションの仮想コアリソース数を指定します。 |
ClientMasterRunnerConfigurer | withMasterRunner()Appmaster のランナーを指定します。 |
ClientMasterRunnerConfigurer withMasterRunner() throws java.lang.Exception
DefaultClientMasterRunnerConfigurer を現在のビルダーに適用します。
public void configure(YarnClientConfigure client) throws Exception {
client
.withMasterRunner()
.contextClass(MyAppmasterConfiguration.class);
}
<yarn:client> <yarn:master-runner /> </yarn:client>
ClientMasterRunnerConfigurerjava.lang.Exception - 例外 YarnClientConfigurer appName(java.lang.String appName)
public void configure(YarnClientConfigure client) throws Exception {
client
.appName("myAppName");
}
<yarn:client app-name="myAppName"/>
appName - Yarn アプリケーション名 YarnClientConfigurerYarnClientConfigurer appType(java.lang.String appType)
MAPREDUCE を使用しており、他のアプリケーションはデフォルトで YARN になります。
public void configure(YarnClientConfigure client) throws Exception {
client
.appType("BOOT");
}
appType - Yarn アプリケーション型 YarnClientConfigurerYarnClientConfigurer masterCommands(java.lang.String... commands)
public void configure(YarnClientConfigure client) throws Exception {
client
.masterCommands("java -jar MyApp.jar", "1><LOG_DIR>/Appmaster.stdout", "2><LOG_DIR>/Appmaster.stderr");
}
<yarn:client>
<yarn:master-command>
<![CDATA[
java -jar MyApp.jar
1><LOG_DIR>/Appmaster.stdout
2><LOG_DIR>/Appmaster.stderr
]]>
</yarn:master-command>
</yarn:client>
commands - Yarn コンテナーコマンド YarnAppmasterConfigurerYarnClientConfigurer priority(java.lang.Integer priority)
public void configure(YarnClientConfigure client) throws Exception {
client
.priority(0);
}
<yarn:client priority="0"/>
priority - Yarn の申請優先順位 YarnClientConfigurerYarnClientConfigurer virtualCores(java.lang.Integer virtualCores)
public void configure(YarnClientConfigure client) throws Exception {
client
.virtualCores(1);
}
<yarn:client virtualcores="1"/>
virtualCores - Yarn アプリケーションの仮想コアリソース数 YarnClientConfigurerYarnClientConfigurer memory(java.lang.String memory)
memory 引数は MegaBytes として指定されます。1G や 500M などのショートカットを使用できます。これらはそれぞれ 1024 と 500 に変換されます。 このメソッドは #memory(int) と同等なので、引数を String として指定できます。
注意 : 1000K や 1000B などの低すぎる設定は使用しないように注意してください。これらの設定は完全な MB に切り捨てられ、ゼロになります。また、値が高すぎると、リソース割り当ての動作が悪くなる可能性があります。
JavaConfig:
public void configure(YarnClientConfigure client) throws Exception {
client
.memory("1G");
}
<yarn:client memory="1024"/>
memory - Yarn アプリケーションコンテナーのメモリ予約 YarnClientConfigurerYarnClientConfigurer memory(int memory)
memory 引数は MegaBytes として指定されます。
public void configure(YarnClientConfigure client) throws Exception {
client
.memory(1024);
}
<yarn:client memory="1024"/>
memory - Yarn アプリケーションコンテナーのメモリ予約 YarnClientConfigurermemory(String)YarnClientConfigurer queue(java.lang.String queue)
public void configure(YarnClientConfigure client) throws Exception {
client
.queue("default");
}
<yarn:client queue="default"/>
queue - Yarn アプリケーション提出キュー YarnClientConfigurerYarnClientConfigurer labelExpression(java.lang.String labelExpression)
public void configure(YarnClientConfigure client) throws Exception {
client
.labelExpression("expression");
}
labelExpression - Yarn アプリケーションラベル式 YarnClientConfigurerYarnClientConfigurer clientClass(java.lang.Class<? extends YarnClient> clazz)
YarnClient クラスを指定します。
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass(MyYarnClient.class);
}
clazz - Yarn クライアントクラス YarnClientConfigurerYarnClientConfigurer clientClass(java.lang.String clazz)
YarnClient を指定します。
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass("com.example.MyYarnClient");
}
clazz - Yarn クライアントクラス YarnClientConfigurer