> For the complete documentation index, see [llms.txt](https://academy.shade.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.shade.inc/shade-academy/shade-academy-zh/zi-dai-cun-chu/connecting-shade-to-backblaze.md).

# 将 Shade 连接到 Backblaze

Shade 支持自带 S3（BYOS3），可对接 AWS、GCP、MinIO、Wasabi、Backblaze 等多个提供商。下面介绍如何将 Shade 连接到你现有的 Backblaze 账户。

### 在 Backblaze 中创建新存储桶

{% hint style="info" %}
虽然创建新存储桶并非绝对必要，但我们强烈建议为 Shade 创建一个新存储桶。由于 ShadeFS 的特性，Shade 无法使用现有存储桶中的文件。Shade 将创建两个新文件夹 `blobs` 和 `chunks` 到您连接的任何存储桶中。
{% endhint %}

如果你还没有 Backblaze 账户，可以创建一个账户 [这里](https://www.backblaze.com/get-started)。要在 Backblaze 中创建新的存储桶，请登录你的账户，前往 Buckets，然后点击“Create Bucket”。

{% hint style="warning" %}
在命名存储桶时，请避免使用数字前缀，因为这可能会导致上传失败。
{% endhint %}

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FwiyUqp1EMe9kxmzqUY0s%2FScreenshot%202025-07-21%20at%2010.05.57%E2%80%AFPM.png?alt=media&amp;token=a6a9688c-8ea3-48b0-a0c0-5949c2142adc" alt=""><figcaption></figcaption></figure>

按照步骤和提示操作时，请务必记住您的 **存储桶名称**，以及您的 **存储桶区域** （因为这些信息很重要，并将在后续步骤中使用）。 *在这种情况下，我们的存储桶名称是“shade-new-bucket”，区域（未显示）是 us-east-005。*

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FrfYsy1OGqFNgpTNZehUj%2FScreenshot%202025-07-21%20at%2010.06.34%E2%80%AFPM.png?alt=media&amp;token=a4e6a64b-f14e-47aa-b22a-69a1ba4ca246" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
ShadeFS 不要求在存储桶上设置任何其他特定属性。您可以根据业务需要选择复制数据、记录日志或启用版本控制。
{% endhint %}

### 配置 CORS（更简单的选项，但不一定总是有效）

跨域资源共享（Cross-Origin Resource Sharing）是一项重要特性，它允许存储桶可从其他来源访问（例如 <https://app.shade.inc>）。这对 Shade 从我们的应用中访问并下载原始媒体至关重要。Backblaze 让共享此来源变得很容易。我们建议允许所有来源。不过，如果你希望来源限制更严格，则需要将其列入白名单 `*.shade.inc` 列入允许来源。

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FK04PmQnY9OPDkeiPt7cg%2FScreenshot%202025-07-21%20at%2010.07.19%E2%80%AFPM.png?alt=media&amp;token=98cdf9fc-04b7-46a0-a2ea-862615faa11f" alt=""><figcaption></figcaption></figure>

### 更新 CORS 的稳妥方案

B2 似乎有时会在直接从 UI 更新 CORS 时出现一些问题。要稳妥地更新你的 b2 存储桶，你可以使用 [b2 cli](https://www.backblaze.com/docs/cloud-storage-command-line-tools).

#### 创建一个 cors.json

首先，创建一个 `cors.json` 文件，内容如下。

```json
[

  {

    "corsRuleName": "web-any-origin",

    "allowedOrigins": ["*"],

    "allowedHeaders": ["*"],

    "allowedOperations": [

      "b2_download_file_by_id",

      "b2_download_file_by_name",

      "b2_upload_file",

      "b2_upload_part",

      "s3_get",

      "s3_put",

      "s3_delete",

      "s3_head"

    ],

    "maxAgeSeconds": 3000

  }

]
```

然后在你的机器上打开终端并更新：

```
b2 bucket update --cors-rules "/path/to/cors.json" your-bucket-name-here allPublic
```

它应该会返回如下结果：

```json
{

    "accountId": "---------",
    "bucketId": "---------",
    "bucketInfo": {},
    "bucketName": "---------",
    "bucketType": "allPublic",
    "corsRules": [
        {
            "allowedHeaders": [
                "*"
            ],
            "allowedOperations": [
                "s3_head",
                "b2_download_file_by_id",
                "b2_upload_part",
                "b2_upload_file",
                "s3_put",
                "b2_download_file_by_name",
                "s3_delete",
                "s3_get"
            ],
            "allowedOrigins": [
                "*"
            ],
            "corsRuleName": "web-any-origin",
            "exposeHeaders": null,
            "maxAgeSeconds": 3000
        }
    ],
    "defaultRetention": {
        "mode": null
    },
    "defaultServerSideEncryption": {
        "mode": "none"
    },
    "isFileLockEnabled": false,
    "lifecycleRules": [],
    "options": [
        "s3"
    ],
    "replication": {
        "asReplicationDestination": null,
        "asReplicationSource": null
    },
    "revision": 5
}
```

### 创建访问密钥

Shade 通过 S3 协议访问 Backblaze 存储桶，这意味着 Shade 需要存储桶名称、存储桶区域、访问密钥和密钥，才能访问该存储桶。

前往 Access Keys > Create Access Key，并创建一个 Master Key 或 Application Key。这里我们为自己的存储桶专门创建一个应用密钥。

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FhkdgNx8GCyRFeqHHgTs2%2FScreenshot%202025-07-21%20at%2010.08.44%E2%80%AFPM.png?alt=media&amp;token=26b59ca3-1bd6-4be4-ab52-14241865fa0c" alt=""><figcaption></figcaption></figure>

**请确保已启用 Read 和 Write。**

创建新密钥后，将生成的 key ID（Shade 的访问密钥）和 applicationKey（Shade 的密钥）复制到剪贴板，并保存下来以便后续步骤使用。

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FjCM2LtFyqhnxN6JRrCgW%2FScreenshot%202025-07-21%20at%2010.08.53%E2%80%AFPM.png?alt=media&amp;token=ed030828-3246-4654-a835-eb04e247abeb" alt=""><figcaption></figcaption></figure>

### 在 Shade 中创建 BYOS 驱动器

到这一步，您应该已经成功获取以下项目：

1. Shade 工作区
2. 存储桶名称
3. 存储桶区域
4. KeyID（访问密钥）
5. applicationKey（密钥）

如果您还没有工作区，您可以创建一个 [这里](https://app.shade.inc).

在您的 Shade 工作区中，您现在可以创建一个驱动器。选择“我的驱动器”旁边的加号按钮 > BYOS drive。

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FjqzLgveMAH1u4Jue0PBb%2FScreenshot%202025-07-21%20at%209.43.17%E2%80%AFPM.png?alt=media&amp;token=f29ba862-4ea3-454a-9b60-6a14622fa1e5" alt=""><figcaption></figcaption></figure>

#### 选择模板

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FPE80uq4lWAvyvhx7ZpEn%2FScreenshot%202025-07-21%20at%209.43.25%E2%80%AFPM.png?alt=media&amp;token=72b36257-7e12-4c7e-95b5-7d8e29632adc" alt=""><figcaption></figcaption></figure>

我们的模板可帮助您快速开始使用 Shade，并提供额外的元数据和视图，帮助您整理文件和素材。要了解更多关于我们 AI 的信息，您可以查看我们的 [学院](https://academy.shade.inc/ai-tools/custom-and-automated-metadata)。在本例中，我们选择了视频制作。

#### 创建我们的 Backblaze 驱动

接下来，我们确定驱动名称并选择 Backblaze 作为提供商。

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FezRZIfHFnkZVjRuVh25l%2FScreenshot%202025-07-21%20at%2010.10.54%E2%80%AFPM.png?alt=media&amp;token=5be8cf69-5647-4b62-a801-425bf4b2d7b6" alt=""><figcaption></figcaption></figure>

#### 添加我们的 Backblaze 凭据

根据前面的步骤，我们添加 Backblaze 凭据，包括存储桶名称、区域、访问密钥和密钥。

{% hint style="info" %}
这必须是你在 Backblaze 中创建的存储桶名称。这与上一屏中创建的驱动名称不同。
{% endhint %}

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2FIlbsTBemKdmX7GejHN7u%2FScreenshot%202025-07-21%20at%2010.12.23%E2%80%AFPM.png?alt=media&amp;token=080e27e4-5b92-4274-b99e-32a2b91b9825" alt=""><figcaption></figcaption></figure>

### 上传您的第一个文件

完成前面的步骤后，您现在可以将第一个文件上传到您的 Shade 驱动器。如果配置成功，您应该能够上传文件，并从 [Shade 桌面应用](https://shade.inc/download)

<figure><img src="https://3843445310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUNq6h2Bfw7aAK0J2ffnZ%2Fuploads%2F7LzkoI92nHxn2cWLxpdi%2FScreenshot%202025-07-21%20at%2010.20.30%E2%80%AFPM.png?alt=media&amp;token=068a3ab2-bf9a-4773-a5cf-3445643b121c" alt=""><figcaption></figcaption></figure>

### 故障排除提示

如果您有更多问题，欢迎通过以下方式联系我们： <support@shade.inc> 或加入我们的 [Discord](https://discord.gg/h8wqFMJ4vK).

#### 我无法上传，怎么回事？

如果您无法上传，请检查存储桶上的 CORS 设置，或检查您的秘密 / 访问密钥及其关联权限。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.shade.inc/shade-academy/shade-academy-zh/zi-dai-cun-chu/connecting-shade-to-backblaze.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
