# 使用 S3 进行上传是否意味着在创建备份时需要重新下载所有文件？

**URL:** https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273
**Category:** Support
**Created:** [2020年八月9日 16:56 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273 "2020-08-09T16:56:47Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ipoopfool](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@ipoopfool](https://meta.discourse.org/u/ipoopfool)
#### Post date: [2020年八月9日 16:56 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/1 "2020-08-09T16:56:47Z")

</div>

你好，我刚搭建了一个新的 Discourse 论坛，并在 S3 上配置了上传存储桶。

不过，如果 Discourse 在创建备份时会将所有文件打包成 ZIP，这是否意味着每次创建备份时，Discourse 都会重新下载整个 S3 上传存储桶的内容？

另外，有人在使用这种方式时遇到过带宽限制的问题吗？

---

<div class="post-metadata">

### Author: ![maiki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maiki/32/233950_2.png) [@maiki](https://meta.discourse.org/u/maiki)
#### Post date: [2020年八月10日 03:49 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/2 "2020-08-10T03:49:09Z")

</div>

> [@ipoopfool](#):
>
> 但如果 Discourse 在创建备份时将所有文件打包，这是否意味着每次创建备份时，Discourse 都会重新下载整个 S3 上传存储桶？

我认为这里指的是本地文件；S3 中的文件应当单独进行备份。

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2020年八月10日 14:15 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/3 "2020-08-10T14:15:25Z")

</div>

> [@ipoopfool](#):
>
> 这是否意味着每次创建备份时，Discourse 都会重新下载整个 S3 上传存储桶？

仅当启用 `include_s3_uploads_in_backups` 站点设置时才会发生这种情况。该设置默认处于禁用状态。

---

<div class="post-metadata">

### Author: ![ipoopfool](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@ipoopfool](https://meta.discourse.org/u/ipoopfool)
#### Post date: [2020年八月10日 17:26 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/4 "2020-08-10T17:26:15Z")

</div>

该设置在我的网站上似乎默认已启用。不过，无论如何，有没有关于如何高效备份 S3 上传存储桶的建议？

这篇将备份保存到 S3 并归档到 Glacier 的指南在备份为单个 ZIP 文件时是合理的。但据我所知，Glacier 是按文件收费的，因此对于未解压的存储桶备份，成本会大幅增加。

我是 AWS 新手，所以任何建议都感激不尽。谢谢！

编辑：如果没有简单有效的解决方案，我也可以考虑不在 S3 上存储上传文件。

> [@Configure automatic backups for Discourse](https://meta.discourse.org/t/configure-automatic-backups-for-discourse/14855):
>
> bookmark This guide explains how to configure automatic backups for Discourse, including storage options on local servers and S3-compatible storage. Learn how to set up automatic backups for your Discourse platform. This guide covers configuring automatic backups, storing them on local servers or S3-compatible storage, and managing storage retention options like Amazon Glacier. Configuring automatic backups Navigate to /admin settings. Select the Backup section. Set backup\_frequency to …

[https://iolap.com/2020/04/06/how-to-avoid-hidden-amazon-glacier-charges/](https://iolap.com/2020/04/06/how-to-avoid-hidden-amazon-glacier-charges/)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [2020年八月13日 21:20 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/5 "2020-08-13T21:20:50Z")

</div>

> [@ipoopfool](#):
>
> 如何备份 S3 上传存储桶

这取决于许多因素。你愿意投入多少资金？你希望针对哪些场景进行备份？是软件漏洞、亚马逊数据中心被小行星击中，还是恶意管理员从 S3 删除文件……

恐怕我们无法就此提供帮助。你需要在其他地方寻找适合你使用场景的解决方案。你选择的搜索引擎是一个不错的起点。

---

<div class="post-metadata">

### Author: ![ipoopfool](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@ipoopfool](https://meta.discourse.org/u/ipoopfool)
#### Post date: [2020年八月13日 23:12 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/6 "2020-08-13T23:12:35Z")

</div>

我已经做了进一步的调查，并与相关人员进行了交流。

我认为，对此的最佳方案是将 S3 存储桶复制到另一个区域。我需要进一步研究相关设置和成本。

---

<div class="post-metadata">

### Author: ![lucasbasquerotto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lucasbasquerotto/32/133376_2.png) [@lucasbasquerotto](https://meta.discourse.org/u/lucasbasquerotto)
#### Post date: [2020年八月14日 12:34 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/7 "2020-08-14T12:34:08Z")

</div>

在我们的非 Discourse 站点场景中，我们使用 awscli 在不同 **账户** 的不同 **区域** 之间同步存储桶（`aws s3 sync`）。因此，即使某个账户被入侵导致存储桶被删除，或者小行星撞击并摧毁了亚马逊数据中心（但愿不会），我们仍可以从另一个存储桶恢复。如果您执行同步操作，成本应该不会太高，因为只会同步新增或变更的文件。

当然，仍存在两个账户在短时间内同时被入侵、存储桶被删除，或亚马逊关闭 AWS 的情况，但这两种情况都 **非常非常** 不可能发生。但如果真的发生了这种事，您不妨去碰碰彩票运气，选一组您认为不会中奖的号码：slight\_smile

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2020年九月13日 12:41 UTC](https://meta.discourse.org/t/does-using-s3-for-uploads-mean-redownloading-all-files-when-creating-backups/160273/8 "2020-09-13T12:41:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
