logo
0
0
WeChat Login
docs: rewrite documentation with improved structure and Chinese localization

Azure Storage 挂载指南

本文档介绍如何使用 Goofys 挂载 Azure Blob Storage、Azure Data Lake Gen1 和 Azure Data Lake Gen2。

Azure Blob Storage

方式一:使用配置文件

[mounts.azblob] backend = "azblob" bucket = "my-container" # 通过环境变量配置连接字符串 # AZURE_STORAGE_CONNECTION_STRING 或 AZURE_STORAGE_ACCOUNT + AZURE_STORAGE_KEY

方式二:使用命令行参数

# 创建 Azure 凭证文件 cat ~/.azure/config [storage] account = "myblobstorage" key = "MY-STORAGE-KEY" # 挂载容器 goofys wasb://container /mnt/azure # 挂载带前缀的路径 goofys wasb://container:prefix /mnt/azure

环境变量方式

# 设置环境变量 export AZURE_STORAGE_ACCOUNT="myblobstorage" export AZURE_STORAGE_KEY="MY-STORAGE-KEY" # 挂载 goofys wasb://container /mnt/azure

使用完整 URI

# 指定完整账号地址 goofys wasb://container@myaccount.blob.core.windows.net /mnt/azure goofys wasb://container@myaccount.blob.core.windows.net/prefix /mnt/azure # 或使用 --endpoint 参数 goofys --endpoint https://myaccount.blob.core.windows.net wasb://container /mnt/azure goofys --endpoint https://myaccount.blob.core.windows.net wasb://container:prefix /mnt/azure

使用 Azure CLI 登录

如果不想存储密钥,可以使用 Azure CLI 的登录令牌:

# 登录 Azure az login # 查看订阅列表 az account list # 选择当前订阅 az account set --subscription <订阅名称或ID> # 挂载(无需配置密钥) goofys wasb://container@myaccount.blob.core.windows.net /mnt/azure

注意:Goofys 目前不支持连接字符串(connection_string)和 SAS 令牌。


Azure Data Lake Storage Gen1

前置条件

  1. 安装 Azure CLI 并完成登录
  2. 确保有访问 Data Lake 的权限

使用方法

# 登录 Azure az login az account set --subscription <订阅名称或ID> # 挂载 Data Lake goofys adl://servicename.azuredatalakestore.net /mnt/datalake # 挂载带前缀的路径 goofys adl://servicename.azuredatalakestore.net:prefix /mnt/datalake

Azure Data Lake Storage Gen2

前置条件

  1. 启用 Hierarchical Namespace 的存储账号
  2. 配置认证(与 Azure Blob Storage 相同)

使用方法

# 使用 abfs:// 协议 goofys abfs://container /mnt/adls2 goofys abfs://container:prefix /mnt/adls2

配置文件方式

[mounts.adls2] backend = "adlgen2" bucket = "my-filesystem" endpoint = "https://myaccount.dfs.core.windows.net"

常见问题

Q: 挂载失败,提示权限不足? A: 检查存储账号的访问密钥或 Azure CLI 登录状态。

Q: 如何查看 Azure 存储账号的访问密钥? A: 在 Azure Portal 中进入存储账号 → "访问密钥"。

Q: Data Lake Gen2 挂载失败? A: 确认存储账号已启用 "Hierarchical Namespace" 功能。