【问题标题】:AWS EMR job using PowerShell Cmdlet使用 PowerShell Cmdlet 的 AWS EMR 作业
【发布时间】:2017-08-14 00:36:45
【问题描述】:

我有一个接受一些参数的猪脚本。我只需要使用 AWS PowerShell Cmdlet。 我可以使用以下命令创建安装有 pig 的集群:

$app = New-Object  Amazon.ElasticMapReduce.Model.Application
$app.Name="Pig"
$jobid = Start-EMRJobFlow -Name "Pig Job"  -Application $app -Instances_MasterInstanceType "m3.xlarge" -Instances_KeepJobFlowAliveWhenNoSteps $true -Instances_InstanceCount 1 -LogUri "s3://mybucket/logs" -VisibleToAllUsers $true -ReleaseLabel "emr-5.7.0" -SecurityConfiguration "my-sec-grp" -JobFlowRole "EMR_EC2_DefaultRole" -ServiceRole "EMR_DefaultRole"

但我无法为猪作业添加步骤。 我关注了一些文章,但这些文章很旧,或者那些正在使用一些自定义 jar 来提交工作。我只需要提交一个接受一些参数的猪脚本。 任何帮助将不胜感激 注意:我需要特定于 powershell 的命令。我可以使用 AWS cli 做到这一点。

【问题讨论】:

    标签: powershell amazon-web-services emr amazon-emr


    【解决方案1】:

    我有办法从 powershell 提交猪脚本。我正在关注这个link。但问题在于它与 Hive 脚本有关。所以它的创建步骤是

    $runhivescriptargs = @("s3://us-east-1.elasticmapreduce/libs/hive/hive-script", `
             "--base-path", "s3://us-east-1.elasticmapreduce/libs/hive", `
             "--hive-versions","latest", `
             "--run-hive-script", `
             "--args", `
             "-f", "s3://elasticmapreduce/samples/hive-ads/libs/join-clicks-to-impressions.q", `
             "-d", "SAMPLE=s3://elasticmapreduce/samples/hive-ads",`
             "-d", "DAY=2009-04-13", `
             "-d", "HOUR=08", `
             "-d", "NEXT_DAY=2009-04-13", `
             "-d", "NEXT_HOUR=09",`
             "-d", "INPUT=s3://elasticmapreduce/samples/hive-ads/tables", `
             "-d", "OUTPUT=s3://my-output-bucket/joinclick1", `
             "-d", "LIB=s3://elasticmapreduce/samples/hive-ads/libs")
    

    所以我遵循了相同的步骤,但不知何故,如果猪脚本参数需要使用 -p 选项而不是使用 -d 选项传递 所以我的步骤创建是这样的:

    $runpigscriptargs = @("s3://us-east-1.elasticmapreduce/libs/pig/pig-script", `
             "--base-path", "s3://us-east-1.elasticmapreduce/libs/pig", `
             "--run-pig-script", `
             "--args", `
             "-f", $scriptfile, `
             "-p", "Id=$Id",`
             "-p", "jarPath=$jarPath",`
             "-p", "inputPath=$newInputPath", `
             "-p", "outputPath=$outputPath")
    

    我没有指定 pig 版本,因为我已经创建了一个安装了最新版本 pig 的 EMR 集群 谢谢

    【讨论】:

      猜你喜欢
      • 2019-10-25
      • 1970-01-01
      • 2022-12-06
      • 1970-01-01
      • 2017-09-30
      • 1970-01-01
      • 2020-11-11
      • 1970-01-01
      • 2018-11-13
      相关资源
      最近更新 更多