# Migrate\_to\_s3 失败

**URL:** <https://meta.discourse.org/t/migrate-to-s3-fails/209499>\
**Category:** Self-hosting\
**Tags:** s3\
**Created:** [2021年十一月18日 06:54 UTC](https://meta.discourse.org/t/migrate-to-s3-fails/209499 "2021-11-18T06:54:02Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)\
**Post date:** [2022年二月21日 16:06 UTC](https://meta.discourse.org/t/migrate-to-s3-fails/209499/26 "2022-02-21T16:06:19Z")

</div>

从您之前的帖子来看，错误消息中第 85 行的计数是值得关注的。@Falco 建议编辑脚本，将该计数增加以忽略一定数量的失败。

最简单的方法是进入容器并使用 sed 对特定行进行就地替换。

```plaintext
cd /var/discourse
./launcher enter app
sed -i '85s/0/100/' lib/file_store/to_s3_migration.rb

```

之后再次运行 rake 任务，它将忽略多达 100 个“帖子未重新映射到新的 S3 上传 URL”错误。下次重建时，更改将消失。

对于原始帖子中的错误消息，第 77 行是 @Falco 引用的那一行。只需在 sed 命令中替换行号：

```plaintext
sed -i '77s/0/100/' lib/file_store/to_s3_migration.rb

```

---

_[View the full topic](https://meta.discourse.org/t/migrate-to-s3-fails/209499)._
