> For the complete documentation index, see [llms.txt](https://documentation.alluxio.io/ee-ai-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.alluxio.io/ee-ai-cn/ufs/azure-blob-store.md).

# Azure Blob Storage

本指南介绍了如何将 Alluxio 配置为使用 [Azure Blob 存储](https://azure.microsoft.com/en-in/services/storage/blobs/) 作为底层存储系统。

## 先决条件

在使用 Azure Blob 存储和 Alluxio 之前，请在您的 Azure 存储帐户中创建一个新容器或使用现有容器。您还应该注意您想在该容器中使用的目录，可以通过在容器中创建新目录或使用现有目录来实现。在本指南中，Azure 存储帐户名称为 `<AZURE_ACCOUNT>`，该存储帐户中的容器为 `<AZURE_CONTAINER>`，该容器中的目录为 `<AZURE_DIRECTORY>`。有关 Azure 存储帐户的更多信息，请参阅[此处](https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account)。

## 基本设置

通用挂载机制和 `UnderFileSystem` CR 字段参考，请参阅[底层存储](https://documentation.alluxio.io/ee-ai-cn/ufs/pages/QHxxAwAliFxrTQ5jOZw7#基本挂载配置)。

{% tabs %}
{% tab title="Kubernetes (Operator)" %}
使用 operator 创建 Azure Blob Storage 挂载点的 `ufs.yaml` 示例：

```yaml
apiVersion: k8s-operator.alluxio.com/v1
kind: UnderFileSystem
metadata:
  name: alluxio-wasbs
  namespace: alx-ns
spec:
  alluxioCluster: alluxio-cluster
  path: wasbs://<AZURE_CONTAINER>@<AZURE_ACCOUNT>.blob.core.windows.net/<AZURE_DIRECTORY>/
  mountPath: /wasbs
  mountOptions:
    fs.azure.account.key.<AZURE_ACCOUNT>.blob.core.windows.net: <YOUR ACCESS KEY>
```

{% endtab %}

{% tab title="Docker / 裸机" %}
如果不使用 operator，将 `wasbs://<AZURE_CONTAINER>@<AZURE_ACCOUNT>.blob.core.windows.net/<AZURE_DIRECTORY>/` 挂载到 `/wasbs` 的示例命令：

```shell
bin/alluxio mount add --path /wasbs/ --ufs-uri wasbs://<AZURE_CONTAINER>@<AZURE_ACCOUNT>.blob.core.windows.net/<AZURE_DIRECTORY>/ \
  --option fs.azure.account.key.<AZURE_ACCOUNT>.blob.core.windows.net=<YOUR ACCESS KEY>
```

此属性键 `fs.azure.account.key.<AZURE_ACCOUNT>.blob.core.windows.net` 将让 Alluxio 使用 AccountKey 访问 Azure Blob 存储。
{% endtab %}
{% endtabs %}

## 常见问题解答

### 如果遇到 http 不支持错误该怎么办？

如果您挂载 Blob 并将 Blob 路径配置为以 `wasb://` 开头，您可能会看到如下错误：

```
alluxio.exception.AlluxioException: com.microsoft.azure.storage.StorageException: The account being accessed does not support http.
```

您可以将 Blob 路径更改为以 `wasbs://` 开头。
