"EXCEPTION: x of y uploads are not migrated to S3. S3 migration failed for db 'default'." 恢复失败

这封帖子在 meta.discourse.org 上作为草稿存放了一段时间,当时我正在我的 Discourse 服务器上处理该问题。我已经能够绕过下面描述的问题,但无法执行有效的灾难恢复(即在不进入旧服务器且该服务器已损坏的情况下进行恢复)令人担忧。(根本原因是 Postgres 10 到 12 的升级失败,但我能够在 Discourse 的 app.yml 文件中推迟更新,以便在创建备份之前禁用 enable_s3_uploads 站点设置。我现在已经完成了该备份,将其上传到新服务器,进行了恢复,Discourse 站点现已重新运行。原始消息如下:


我正在从存储在 S3 上的备份重建 Discourse 安装。旧安装非常古老——首次安装于 2016 年 6 月。由于 Postgres 10 到 12 的升级失败,我从全新安装开始进行恢复。与其修复该问题……既然这台服务器运行的是不再受支持的 Ubuntu 版本……我想直接采用最新的备份并将其加载到新服务器上。然而,恢复失败了。在日志中,我遇到问题的是以下位置:

[2020-11-23 22:27:32] 重新加载翻译...
[2020-11-23 22:27:32] 重新映射上传文件...
[2020-11-23 22:27:32] 正在恢复上传文件,这可能需要一些时间...
[2020-11-23 22:28:38] 异常:751 个上传文件中有 465 个未迁移到 S3。数据库 'default' 的 S3 迁移失败。
[2020-11-23 22:28:38] /var/www/discourse/lib/file_store/to_s3_migration.rb:131:in `raise_or_log'
/var/www/discourse/lib/file_store/to_s3_migration.rb:78:in `migration_successful?'
/var/www/discourse/lib/file_store/to_s3_migration.rb:357:in `migrate_to_s3'
/var/www/discourse/lib/file_store/to_s3_migration.rb:65:in `migrate'
/var/www/discourse/lib/file_store/s3_store.rb:238:in `copy_from'
/var/www/discourse/lib/backup_restore/uploads_restorer.rb:48:in `restore_uploads'
/var/www/discourse/lib/backup_restore/uploads_restorer.rb:30:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:64:in `run'
/var/www/discourse/script/spawn_backup_restore.rb:23:in `restore'
/var/www/discourse/script/spawn_backup_restore.rb:36:in `block in <main>'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `fork'
/var/www/discourse/script/spawn_backup_restore.rb:4:in `<main>'
[2020-11-23 22:28:38] 尝试回滚...

这听起来与 Restore process cancelled at migrating uploads to S3 step - #5 by Jim.Morrison 类似,但该帖子并未提供任何关于如何修复此问题的指导。

此撰写窗口右侧的“发帖前提示”消息也建议查看 *https://meta.discourse.org/t/failed-to-restore-db/131137*,但该帖子也没有任何有用的内容。

1 个赞

I’m facing the same issue here but I haven’t been able to resolve it:

Could you explain in more details what exactly you did here? Was this settings disabled in the Admin → Settings GUI page or was it on in app.yml? So after the backup, you were able to restore it and get everything back? Did you turn on this setting again after the backup? Thanks

这是在编辑 app.yml 文件,是的,我已成功恢复所有内容。不幸的是,我没有记录下两年前的工作,细节也随着时间流逝而丢失了。我没有重新启用“在备份中包含上传文件”,但我认为我现在会这样做——希望我之前遇到的任何问题都已修复。

1 个赞

恢复后,您在帖子中发现任何指向附件的损坏链接吗?

据我回忆,没有。祝你好运!