共用方式為


New-AzureHDInsightMapReduceJobDefinition

定義新的 MapReduce 作業。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

New-AzureHDInsightMapReduceJobDefinition
   [-Arguments <String[]>]
   -ClassName <String>
   [-Defines <Hashtable>]
   [-Files <String[]>]
   -JarFile <String>
   [-JobName <String>]
   [-LibJars <String[]>]
   [-StatusFolder <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

此版本的 Azure PowerShell HDInsight 已被取代。 這些 Cmdlet 將於 2017 年 1 月 1 日移除。 請使用較新版本的 Azure PowerShell HDInsight。

如需如何使用新的 HDInsight 建立叢集的資訊,請參閱 使用 Azure PowerShell 在 HDInsight 中建立以 Linux 為基礎的叢集(https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-create-linux-clusters-azure-powershell/)。 如需如何使用 Azure PowerShell 和其他方法提交作業的資訊,請參閱 在 HDInsight 中提交 Hadoop 作業 (https://azure.microsoft.com/en-us/documentation/articles/hdinsight-submit-hadoop-jobs-programmatically/)。 如需 Azure PowerShell HDInsight 的參考資訊,請參閱 Azure HDInsight Cmdlet

New-AzureHDInsightMapReduceJobDefinition Cmdlet 會定義新的 MapReduce 作業,以在 Azure HDInsight 叢集上執行。

範例

範例 1:定義 MapReduce 作業、執行作業,並取得輸出

PS C:\>$SubId = (Get-AzureSubscription -Current).SubscriptionId
PS C:\> $ClusterName = "MyCluster"
PS C:\> $WordCountJob = New-AzureHDInsightMapReduceJobDefinition -JarFile "/Example/Apps/Hadoop-examples.jar" -ClassName "WordCount" -Defines @{ "mapred.map.tasks" = "3" } -Arguments "/Example/Data/Gutenberg/Davinci.txt", "/Example/Output/WordCount"
PS C:\> $WordCountJob | Start-AzureHDInsightJob -Cluster $ClusterName
    | Wait-AzureHDInsightJob -Subscription $SubId -WaitTimeoutInSeconds 3600
    | Get-AzureHDInsightJobOutput -Cluster $ClusterName -Subscription $SubId -StandardError

第一個命令會取得目前訂用帳戶的標識符,然後將它儲存在$SubId變數中。

第二個命令會將名稱 MyCluster 指派給$Clustername變數。

第三個命令會使用 New-AzureHDInsightMapReduceJobDefinition Cmdlet 來建立 MapReduce 作業定義,然後將它儲存在$WordCountJob變數中。

第四個命令會使用這些 Cmdlet 來執行一連串的作業:

  • Start-AzureHDInsightJob 以在$ClusterName上啟動作業。
  • Wait-AzureHDInsightJob 等候作業完成,並顯示完成進度。
  • Get-AzureHDInsightJobOutput 以取得作業輸出。

參數

-Arguments

指定 Hadoop 作業的引數陣列。 引數會以命令列引數的方式傳遞給每項工作。

類型:String[]
別名:Args
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ClassName

指定 Java Archive (JAR) 檔案中作業類別的名稱。

類型:String
別名:Class
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Defines

指定要在作業執行時設定的Hadoop組態值。

類型:Hashtable
別名:Params
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Files

指定作業所需的 WASB 檔案陣列。

類型:String[]
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-JarFile

指定 JAR 檔案的完整名稱,其中包含 MapReduce 作業的程式代碼和相依性。

類型:String
別名:Jar
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-JobName

指定 MapReduce 作業的名稱。 這是選擇性參數。 如果您未指定此參數,則會使用 ClassName 參數的值

類型:String
別名:Name
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-LibJars

指定作業的 LibJar 參考陣列。

類型:String[]
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-StatusFolder

指定資料夾的位置,其中包含作業的標準輸出和錯誤輸出,包括其結束代碼和工作記錄檔。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False