適用於:
Azure Data Factory
Azure Synapse Analytics
提示
Data Factory in Microsoft Fabric 是下一代的 Azure Data Factory,擁有更簡單的架構、內建 AI 及新功能。 如果你是資料整合新手,建議先從 Fabric Data Factory 開始。 現有的 ADF 工作負載可升級至 Fabric,以存取資料科學、即時分析與報告等新能力。
Azure Data Factory 或 Synapse Analytics 管線中的 HDInsight MapReduce 活動,會在您自己的 HDInsight 叢集或隨選 HDInsight 叢集上調用 MapReduce 程式。 本文是以資料轉換活動一文為基礎,該文提供了資料轉換和系統支援的轉換活動的一般概覽。
想了解更多,請閱讀
請參閱 Pig 和 Hive,以了解如何使用 HDInsight Pig 和 Hive 活動,透過管線在 HDInsight 叢集上執行 Pig/Hive 指令碼的詳細資訊。
使用 UI 將 HDInsight MapReduce 活動新增至管道
若要將 HDInsight MapReduce 活動用於管道,請完成下列步驟:
在管道 [活動] 窗格中搜尋 MapReduce,然後將 MapReduce 活動拖曳至管道畫布。
如果尚未選取,請在畫布上選取新的 MapReduce 活動。
選取 [HDI 叢集] 索引標籤,選取或建立 HDInsight 叢集的新連結服務,該叢集會用來執行 MapReduce 活動。
選擇 Jar 標籤,選擇或建立一個新的 Jar 連結服務,連接到一個Azure Storage帳號,該帳號將承載你的腳本。 指定要在其中執行的類別名稱,以及儲存體位置內部的檔案路徑。 您也可以設定進階的詳細資料,包括 Jar 程式庫位置、偵錯設定,以及要傳遞至指令碼的引數和參數。
語法
{
"name": "Map Reduce Activity",
"description": "Description",
"type": "HDInsightMapReduce",
"linkedServiceName": {
"referenceName": "MyHDInsightLinkedService",
"type": "LinkedServiceReference"
},
"typeProperties": {
"className": "org.myorg.SampleClass",
"jarLinkedService": {
"referenceName": "MyAzureStorageLinkedService",
"type": "LinkedServiceReference"
},
"jarFilePath": "MyAzureStorage/jars/sample.jar",
"getDebugInfo": "Failure",
"arguments": [
"-SampleHadoopJobArgument1"
],
"defines": {
"param1": "param1Value"
}
}
}
語法詳細資料
| 屬性 | 描述 | 必要 |
|---|---|---|
| 名稱 | 活動的名稱 | Yes |
| 說明 | 說明活動用途的文字 | No |
| 型別 | 對於 MapReduce 活動,活動類型為 HDinsightMapReduce | Yes |
| linkedServiceName | 參考註冊為 Linked Service 的 HDInsight 叢集。 若要深入了解此已連結的服務,請參閱計算已連結的服務一文。 | Yes |
| className | 要執行的類別名稱 | Yes |
| jarLinkedService | 參考用於儲存 Jar 檔案的 Azure Storage 連結服務。 此處僅支援 Azure Blob Storage 及 ADLS Gen2 連接的服務。 如果您未指定此連結服務,則使用 HDInsight 連結服務中定義的 Azure Storage Linked Service。 | No |
| jarFilePath | 提供 jarLinkedService 所引用的 Azure Storage 中儲存的 Jar 檔案路徑。 檔案名稱有區分大小寫。 | Yes |
| jarlibs | 由字串陣列組成,表示作業在 jarLinkedService 所定義 Azure 儲存體中儲存之 Jar 程式庫檔案的路徑。 檔案名稱有區分大小寫。 | No |
| getDebugInfo | 指定何時將日誌檔案複製到 HDInsight 叢集所使用的 Azure Storage(或由 jarLinkedService 指定)。 允許的值:無、總是或失敗。 預設值:無。 | No |
| 引數 | 指定 Hadoop 作業的引數陣列。 引數會以命令列引數的方式傳遞給每項工作。 | No |
| 定義 | 指定參數作為機碼/值組,以供在 Hive 指令碼內參考。 | No |
範例
您可以使用「HDInsight MapReduce 活動」,在 HDInsight 叢集上執行任何 MapReduce Jar 檔案。 在下列管線的範例 JSON 定義中,已設定讓「HDInsight 活動」執行 Mahout JAR 檔案。
{
"name": "MapReduce Activity for Mahout",
"description": "Custom MapReduce to generate Mahout result",
"type": "HDInsightMapReduce",
"linkedServiceName": {
"referenceName": "MyHDInsightLinkedService",
"type": "LinkedServiceReference"
},
"typeProperties": {
"className": "org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob",
"jarLinkedService": {
"referenceName": "MyStorageLinkedService",
"type": "LinkedServiceReference"
},
"jarFilePath": "adfsamples/Mahout/jars/mahout-examples-0.9.0.2.2.7.1-34.jar",
"arguments": [
"-s",
"SIMILARITY_LOGLIKELIHOOD",
"--input",
"wasb://adfsamples@spestore.blob.core.windows.net/Mahout/input",
"--output",
"wasb://adfsamples@spestore.blob.core.windows.net/Mahout/output/",
"--maxSimilaritiesPerItem",
"500",
"--tempDir",
"wasb://adfsamples@spestore.blob.core.windows.net/Mahout/temp/mahout"
]
}
}
您可以在 arguments 區段中,為 MapReduce 程式指定所有引數。 在執行階段,您會看到幾個來自 MapReduce 架構的額外引數 (例如:mapreduce.job.tags)。 若要區分您的引數與 MapReduce 引數,請考慮同時使用選項和值作為引數,如下列範例所示 (-s、--input、--output 等等是後面接著其值的選項)。
相關內容
請參閱下列文章,其說明如何以其他方式轉換資料: