JobFlowInstancesConfig instances = new JobFlowInstancesConfig();
/** instancesのいろいろな設定
* ......
*/
RunJobFlowRequest request = new RunJobFlowRequest("MyEMRJob", instances);
/** requireについて他の設定(stepとか)
* ......
*/
//tasks.maximumを設定
BootstrapActions bootstrapActions = new BootstrapActions();
request.withBootstrapActions(bootstrapActions.newConfigureHadoop()
.withKeyValue(ConfigFile.Mapred, "mapred.tasktracker.map.tasks.maximum", "5")
.withKeyValue(ConfigFile.Mapred, "mapred.tasktracker.reduce.tasks.maximum", "5").build());
PropertiesCredentials credentials = new PropertiesCredentials(getClassLoader().getResourceAsStream("AwsCredentials.properties"));
AmazonElasticMapReduce emr = new AmazonElasticMapReduceClient(credentials);
emr.runJobFlow(request);//EMRジョブを起動する
これで、1台のサーバは同時に実行するMapとReduceタスクの最大値を5に設定した。
没有评论:
发表评论