装载 ADLS Gen2 存储 - 文件必须是 dbfs 或 s3n:/
Mount ADLS Gen2 Storage - File must be dbfs or s3n: /
我想使用以下代码在 Databricks 中安装 ADLS Gen2 存储:
%python
configs = {
"fs.azure.account.key.<storage-account-name>.dfs.core.windows.net": <storage-account-key>,
"spark.hadoop.fs.azure.account.key.<storage-account-name>.dfs.core.windows.net": <storage-account-key>
}
dbutils.fs.mount(
source = "abfss://<container-name>@<storage-account-name>>.dfs.core.windows.net/",
mount_point = "/mnt/aaa",
extra_configs = configs)
但我得到:
知道根本原因是什么吗?
Mount ADLS Gen2 Storage in Databrick
您可以在两种情况下在 Databrick 中装载和实施 ADLS Gen2 存储。
Scenario 1:
直接从 extra_configs
的 <storage-account-Access key>
中的 ADLS Gen2 Blob 存储中获取访问密钥,如创建装载所示。
语法
spark.conf.set("fs.azure.account.key.<storage-account-name>.dfs.core.windows.net", dbutils.secrets.get(scope="<Scope-Name>",key="Key_Value"))
创建坐骑
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net/",
mount_point = "/mnt/io243",
extra_configs = {"fs.azure.account.key.<storage-account-name>.blob.core.windows.net":"<storage-account-Access key>"})
Scenario 2:
转到访问密钥并复制密钥 -> 为 Azure Key Vault 中的访问密钥创建 Secret .
创建 Azure Key Vault 和 Secret Scope -> 创建范围 -> 输入 DNS 名称
(对于 示例、https://databrickskv.vault.azure.net/
)和资源 ID -> 转到 Azure 门户中 Azure Key Vault 的 属性选项卡 您同时获得 DNS 和 资源 ID .
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net/",
mount_point = "/mnt/io243",
extra_configs = {"fs.azure.account.key.<storage-account-name>.blob.core.windows.net":"dbutils.secrets.get(scope = "databricks-secret-scope", key = "blob-container-key")}
参考:
https://bigdataprogrammers.com/create-mount-point-in-azure-databricks/
https://docs.microsoft.com/en-us/azure/databricks/data/databricks-file-system
我想使用以下代码在 Databricks 中安装 ADLS Gen2 存储:
%python
configs = {
"fs.azure.account.key.<storage-account-name>.dfs.core.windows.net": <storage-account-key>,
"spark.hadoop.fs.azure.account.key.<storage-account-name>.dfs.core.windows.net": <storage-account-key>
}
dbutils.fs.mount(
source = "abfss://<container-name>@<storage-account-name>>.dfs.core.windows.net/",
mount_point = "/mnt/aaa",
extra_configs = configs)
但我得到:
知道根本原因是什么吗?
Mount ADLS Gen2 Storage in Databrick
您可以在两种情况下在 Databrick 中装载和实施 ADLS Gen2 存储。
Scenario 1:
直接从 extra_configs
的 <storage-account-Access key>
中的 ADLS Gen2 Blob 存储中获取访问密钥,如创建装载所示。
语法
spark.conf.set("fs.azure.account.key.<storage-account-name>.dfs.core.windows.net", dbutils.secrets.get(scope="<Scope-Name>",key="Key_Value"))
创建坐骑
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net/",
mount_point = "/mnt/io243",
extra_configs = {"fs.azure.account.key.<storage-account-name>.blob.core.windows.net":"<storage-account-Access key>"})
Scenario 2:
转到访问密钥并复制密钥 -> 为 Azure Key Vault 中的访问密钥创建 Secret .
创建 Azure Key Vault 和 Secret Scope -> 创建范围 -> 输入 DNS 名称
(对于 示例、https://databrickskv.vault.azure.net/
)和资源 ID -> 转到 Azure 门户中 Azure Key Vault 的 属性选项卡 您同时获得 DNS 和 资源 ID .
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net/",
mount_point = "/mnt/io243",
extra_configs = {"fs.azure.account.key.<storage-account-name>.blob.core.windows.net":"dbutils.secrets.get(scope = "databricks-secret-scope", key = "blob-container-key")}
参考:
https://bigdataprogrammers.com/create-mount-point-in-azure-databricks/
https://docs.microsoft.com/en-us/azure/databricks/data/databricks-file-system