首页 > 解决方案 > 无法从 Azure DataBricks [wasbs vs abfss] 在 Storage Gen2 上创建挂载

问题描述

我正在尝试使用 Azure 文档中给出的语法在容器上创建 Azure Storage Gen2 中的挂载点。我发现 2 种方法使用 Gen2 的“abfss”和常规 Blob 存储的“wasbs”。由于我使用的是 'Storage Gen2' ,所以使用 'abfss' 但那不起作用。虽然如果我使用'wasb'它可以安装。不知道为什么。我很困惑

语法-1

url = "wasbs://"+container+"@"+storage_name+".blob.core.windows.net"
config  = "fs.azure.account.key."+storage_name+".blob.core.windows.net"

语法 2

url="abfss://"+container+"@"+storage_name+".dfs.core.windows.net"
as_config  = "fs.azure.account.key."+storage_name+".dfs.core.windows.net

当我使用 Syntax-2 时,出现错误:

ExecutionError:调用 o246.mount 时出错。: java.lang.NullPointerException: authEndpoint at shaded.databricks.v20180920_b33d810.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)

标签: azureazure-storagedatabricksazure-databricks

解决方案


您无法abfss使用存储密钥安装 - 它仅适用于wasbs(您已确认)。abfss只能使用服务主体进行挂载,如文档中所述:

configs = {"fs.azure.account.auth.type": "OAuth",
          "fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
          "fs.azure.account.oauth2.client.id": "<application-id>",
          "fs.azure.account.oauth2.client.secret": dbutils.secrets.get(scope="<scope-name>",key="<service-credential-key-name>"),
          "fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/<directory-id>/oauth2/token"}

# Optionally, you can add <directory-name> to the source URI of your mount point.
dbutils.fs.mount(
  source = "abfss://<container-name>@<storage-account-name>.dfs.core.windows.net/",
  mount_point = "/mnt/<mount-name>",
  extra_configs = configs)

推荐阅读