【问题标题】:How can I attach both Azure Data Lake Gen1 and Gen2 to a single Spark HD Insight cluster?如何将 Azure Data Lake Gen1 和 Gen2 附加到单个 Spark HD Insight 群集?
【发布时间】:2021-03-05 03:23:16
【问题描述】:

我想创建一个可以访问 ADLSg1 和 ADLSg2 数据湖的 Azure HDI 集群。支持吗?

【问题讨论】:

    标签: azure-data-lake azure-hdinsight azure-data-lake-gen2


    【解决方案1】:

    这对于 Spark 2.4 (HDI 4.0) 是可能的,但有限制:

    1. 群集的主存储必须是 Azure Blob
    2. 集群将通过服务主体 + 客户端机密向 ADLSg1 和 ADLSg2 进行身份验证。服务主体和机密必须手动管理。
    3. 这不能通过 Azure 门户完成。您必须通过 Ambari UI 或 ssh 手动更改集群的 core-site.xml 配置。

    步骤:

    1. Find your Azure AD tenant ID
    2. Register an application with Azure AD and create a service principal 用于每个 ADLS 帐户。记下应用程序 ID。
    3. Create a new application secret 用于在步骤 1 中创建的每个 AAD 应用程序。记下生成的客户端密码。
    4. Grant Owner role 与 ADLSg1 帐户关联的服务主体。
    5. Grant Storage Blob Data Owner role 与 ADLSg2 帐户关联的服务主体。
    6. 仅使用 Azure Blob 作为主存储部署 HDI 群集。
    7. 为 HDI 集群打开 Ambari UI
    8. 导航到 HDFS → 配置选项卡 UI → 高级选项卡
    9. 展开“自定义核心站点”部分
    10. 添加以下设置:

    对于 ADLS Gen 1:

    fs.adl.oauth2.access.token.provider.type = ClientCredential
    fs.adl.oauth2.client.id = <ADLSg1 Application ID>
    fs.adl.oauth2.credential = <ADLSg1 Client Secret>
    fs.adl.oauth2.refresh.url = https://login.microsoftonline.com/<Tenant ID>/oauth2/token
    

    对于 ADLS Gen 2:

    fs.azure.account.auth.type.<ADLSg2 storage account name>.dfs.core.windows.net = OAuth
    fs.azure.account.oauth.provider.type.<ADLSg2 storage account name>.dfs.core.windows.net = org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider
    fs.azure.account.oauth2.client.id.<ADLSg2 storage account name>.dfs.core.windows.net = <ADLSg2 Application ID>
    fs.azure.account.oauth2.client.secret.<ADLSg2 storage account name>.dfs.core.windows.net = <ADLSg1 Client Secret>
    fs.azure.account.oauth2.client.endpoint.<ADLSg2 storage account name>.dfs.core.windows.net = https://login.microsoftonline.com/<Tenant ID>/oauth2/token
    
    1. 保存更改
    2. 重启集群中所有受影响的服务(HDFS、YARN 等)

    从集群访问文件:

    使用完全限定名称。使用这种方法,您可以提供要访问的文件的完整路径。

    • ADLSg1:adl://&lt;data_lake_account&gt;.azuredatalakestore.net/&lt;cluster_root_path&gt;/&lt;file_path&gt;
    • ADLSg2:abfs://&lt;containername&gt;@&lt;accountname&gt;.dfs.core.windows.net/&lt;file.path&gt;/

    【讨论】:

      猜你喜欢
      • 2019-12-02
      • 1970-01-01
      • 2020-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      • 2020-08-21
      • 2022-11-17
      相关资源
      最近更新 更多