搭配使用 Amazon S3 on Outposts 和本機 Amazon EMR on Outposts - Amazon S3 on Outposts

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

搭配使用 Amazon S3 on Outposts 和本機 Amazon EMR on Outposts

Amazon EMR 是一種受管叢集平台,可簡化在 上執行大數據架構,例如 Apache Hadoop和 Apache Spark, AWS 以處理和分析大量資料。透過使用這些架構和相關的開放原始碼專案,您可以處理用於分析用途和商業智慧工作負載的資料。Amazon EMR 也可協助您轉換大量資料,並將其移入和移出其他 AWS 資料存放區和資料庫,並支援 Amazon S3 on Outposts。如需 Amazon EMR 的詳細資訊,請參閱《Amazon EMR 管理指南》中的 Amazon EMR on Outposts

對於 Amazon S3 on Outposts,Amazon EMR 7.0.0 版已支援的 Apache Hadoop S3A 連接器。Amazon EMR 的早期版本不支援本機 S3 on Outposts,且不支援 EMR 檔案系統 (EMRFS)。

支援的應用程式

搭配 Amazon S3 on Outposts 的 Amazon EMR 支援下列應用程式:

  • Hadoop

  • Spark

  • Hue

  • Hive

  • Sqoop

  • Pig

  • Hudi

  • Flink

如需詳細資訊,請參閱《Amazon EMR 版本指南》。

建立和設定 Amazon S3 on Outposts 儲存貯體

Amazon EMR 使用 適用於 Java 的 AWS SDK 搭配 Amazon S3 on Outposts 來存放輸入資料和輸出資料。您的 Amazon EMR 日誌檔案會儲存在您選擇的區域 Amazon S3 位置,而不會以本機方式儲存在 Outpost 上。如需詳細資訊,請參閱《Amazon EMR 管理指南》中的 Amazon EMR 日誌

為了符合 Amazon S3 和 DNS 需求,S3 on Outposts 儲存貯體具有特定的命名約束與限制。如需詳細資訊,請參閱建立 S3 on Outposts 儲存貯體

使用 Amazon EMR 7.0.0 版及更新版本時,您可以將 Amazon EMR 與 S3 on Outposts 和 S3A 檔案系統搭配使用。

先決條件

S3 on Outposts 許可 – 當您建立 Amazon EMR 執行個體描述檔時,您的角色必須包含 S3 on Outposts 的 AWS Identity and Access Management (IAM) 命名空間。S3 on Outposts 具有自己的命名空間 s3-outposts*。如需有關使用此命名空間的政策範例,請參閱使用 S3 on Outposts 設定 IAM

S3A 連接器 – 若要設定 EMR 叢集,以從 Amazon S3 on Outposts 儲存貯體存取資料,您必須使用 Apache Hadoop S3A 連接器。若要使用該連接器,請確保您的所有 S3 URI 均使用 s3a 結構描述。如果未使用,您可以設定用於 EMR 叢集的檔案系統實作,以便搭配使用您的 S3 URI 與 S3A 連接器。

若要將檔案系統實作設定為使用 S3A 連接器,您可以使用 EMR 叢集的 fs.file_scheme.implfs.AbstractFileSystem.file_scheme.impl 組態屬性,其中 file_scheme 對應於您擁有的 S3 URI 類型。若要使用下列範例,請以您自己的資訊取代 user input placeholders。例如,若要變更使用 s3 結構描述之 S3 URI 的檔案系統實作,請指定下列叢集組態屬性:

[ { "Classification": "core-site", "Properties": { "fs.s3.impl": "org.apache.hadoop.fs.s3a.S3AFileSystem", "fs.AbstractFileSystem.s3.impl": "org.apache.hadoop.fs.s3a.S3A" } } ]

若要使用 S3A,請將 fs.file_scheme.impl 組態屬性設定為 org.apache.hadoop.fs.s3a.S3AFileSystem,並將 fs.AbstractFileSystem.file_scheme.impl 屬性設定為 org.apache.hadoop.fs.s3a.S3A

例如,如果您存取路徑 s3a://bucket/...,請將 fs.s3a.impl 屬性設定為 org.apache.hadoop.fs.s3a.S3AFileSystem,並將 fs.AbstractFileSystem.s3a.impl 屬性設定為 org.apache.hadoop.fs.s3a.S3A

搭配使用 Amazon S3 on Outposts 和 Amazon EMR 的入門指引

下列主題說明如何開始使用 Amazon EMR 搭配 Amazon S3 on Outposts。

建立許可政策

在建立使用 Amazon S3 on Outposts 的 EMR 叢集之前,您必須先建立 IAM 政策以連接至該叢集的 Amazon EC2 執行個體設定檔。政策必須具有存取 S3 on Outposts 存取點 Amazon Resource Name (ARN) 的許可。如需有關為 S3 on Outposts 建立 IAM 政策的詳細資訊,請參閱使用 S3 on Outposts 設定 IAM

下列政策範例會示範如何授予所需的許可。建立政策後,將政策連接至用於建立 EMR 叢集的執行個體設定檔角色,如 建立和設定叢集 一節中所述。若要使用此範例,請以您自己的資訊取代 user input placeholders

{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Resource": "arn:aws:s3-outposts:us-west-2:111122223333:outpost/op-01ac5d28a6a232904/accesspoint/access-point-name, "Action": [ "s3-outposts:*" ] } ] }

建立和設定叢集

若要建立使用 S3 on Outposts 執行 Spark 的叢集,請在主控台中完成下列步驟。

建立使用 S3 on Outposts 執行 Spark 的叢集
  1. 請在 https://console.aws.amazon.com/elasticmapreduce/ 開啟 Amazon EMR 主控台。

  2. 在左側導覽窗格中選擇叢集

  3. 選擇 建立叢集

  4. 針對 Amazon EMR 版本,請選擇 emr-7.0.0 或更新版本。

  5. 針對應用程式套件,請選擇 Spark 互動式。然後選取您要包含在叢集上的任何其他支援應用程式。

  6. 若要啟用 Amazon S3 on Outposts,請輸入您的組態設定。

    範例組態設定

    若要使用下列範例組態設定,請以您自己的資訊取代 user input placeholders

    [ { "Classification": "core-site", "Properties": { "fs.s3a.bucket.DOC-EXAMPLE-BUCKET.accesspoint.arn": "arn:aws:s3-outposts:us-west-2:111122223333:outpost/op-01ac5d28a6a232904/accesspoint/access-point-name" "fs.s3a.committer.name": "magic", "fs.s3a.select.enabled": "false" } }, { "Classification": "hadoop-env", "Configurations": [ { "Classification": "export", "Properties": { "JAVA_HOME": "/usr/lib/jvm/java-11-amazon-corretto.x86_64" } } ], "Properties": {} }, { "Classification": "spark-env", "Configurations": [ { "Classification": "export", "Properties": { "JAVA_HOME": "/usr/lib/jvm/java-11-amazon-corretto.x86_64" } } ], "Properties": {} }, { "Classification": "spark-defaults", "Properties": { "spark.executorEnv.JAVA_HOME": "/usr/lib/jvm/java-11-amazon-corretto.x86_64", "spark.sql.sources.fastS3PartitionDiscovery.enabled": "false" } } ]
  7. 聯網區段中,選擇 AWS Outposts 機架上的虛擬私有雲端 (VPC) 和子網路。如需 Outposts 上的 Amazon EMR 的詳細資訊,請參閱《Amazon EMR 管理指南》內之 AWS Outposts上的 EMR 叢集

  8. 適用於 Amazon EMR 的 EC2 執行個體設定檔區段中,選擇連接您先前建立之許可政策的 IAM 角色。

  9. 設定剩餘的叢集設定,然後選擇建立叢集

組態概觀

下表會說明 S3A 組態,以及當您設定使用 S3 on Outposts 搭配 Amazon EMR 的叢集時,要為其參數指定的值。

參數 預設值 S3 on Outposts 的必要值 說明

fs.s3a.aws.credentials.provider

如果未指定,S3A 會尋找區域儲存貯體 (具有 Outposts 儲存貯體名稱) 中的 S3。

S3 on Outposts 儲存貯體的存取點 ARN

Amazon S3 on Outposts 支援僅限 虛擬私有雲端 (VPC) 的存取點來作為存取 Outpost 儲存貯體的唯一方法。

fs.s3a.committer.name

file

magic

Magic Committer 是 S3 on Outposts 唯一支援的遞交程式。

fs.s3a.select.enabled

TRUE

FALSE

Outposts 上不支援 S3 Select。

JAVA_HOME

/usr/lib/jvm/java-8

/usr/lib/jvm/java-11-amazon-corretto.x86_64

S3A 上的 S3 on Outposts 需要 Java 11 版。

下表說明當您設定搭配 Amazon EMR 使用 S3 on Outposts 的叢集時,要為其參數指定的 Spark 組態和值。

參數 預設值 S3 on Outposts 的必要值 說明

spark.sql.sources.fastS3PartitionDiscovery.enabled

TRUE

FALSE

S3 on Outposts 不支援快速分割區。

spark.executorEnv.JAVA_HOME

/usr/lib/jvm/java-8

/usr/lib/jvm/java-11-amazon-corretto.x86_64

S3A 上的 S3 on Outposts 需要 Java 11 版。

考量事項

當您將 Amazon EMR 與 S3 on Outposts 儲存貯體整合時,請考慮下列事項:

  • Amazon EMR 7.0.0 版及更新版本支援 Amazon S3 on Outposts。

  • 您需要 S3A 連接器才能將 S3 on Outposts 與 Amazon EMR 搭配使用。只有 S3A 具有與 S3 on Outposts 儲存貯體互動所需的功能。如需 S3A 連接器設定資訊,請參閱先決條件

  • Amazon S3 on Outposts 僅支援使用 Amazon S3 受管金鑰 (SSE-S3) 搭配 Amazon EMR 的伺服器端加密。如需詳細資訊,請參閱S3 on Outposts 中的資料加密

  • Amazon S3 on Outposts 不支援使用 S3A FileOutputCommitter 進行寫入。使用 S3 on Outposts 儲存貯體上的 S3A FileOutputCommitter 寫入會導致下列錯誤:InvalidStorageClass: The storage class you specified is not valid

  • Amazon EMR Serverless 或 Amazon EMR on EKS 不支援 Amazon S3 on Outposts。

  • Amazon EMR 日誌會儲存在您選擇的區域 Amazon S3 位置,而不會以本機方式儲存在 S3 on Outposts 儲存貯體中。