本文档介绍如何使用 Goofys 挂载 Azure Blob Storage、Azure Data Lake Gen1 和 Azure Data Lake Gen2。
[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
# 指定完整账号地址
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
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
az login
az account set --subscription <订阅名称或ID>
# 挂载 Data Lake
goofys adl://servicename.azuredatalakestore.net /mnt/datalake
# 挂载带前缀的路径
goofys adl://servicename.azuredatalakestore.net:prefix /mnt/datalake
# 使用 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" 功能。