恢复期间:“异常:您正在尝试恢复更近版本的架构。您应该先迁移!”

我最近设置了一个 Discourse 服务器,之前在试用(trydiscourse.com)上花了一些时间。设置时,我从 trydiscourse.com 下载了我们试用数据的备份,并成功地将该数据恢复到了我自行托管的 Discourse 上。

大约一周后,在试用即将结束时,我从 trydiscourse.com 又下载了一个备份并尝试恢复。这次恢复失败了。以下是日志:

[2022-03-05 01:31:08] [STARTED]

[2022-03-05 01:31:08] 'Joaquin' has started the restore!

[2022-03-05 01:31:08] Marking restore as running...

[2022-03-05 01:31:08] Making sure /var/www/discourse/tmp/restores/default/2022-03-05-013108 exists...

[2022-03-05 01:31:08] Copying archive to tmp directory...

[2022-03-05 01:31:08] Unzipping archive, this may take a while...

[2022-03-05 01:31:08] Extracting dump file...

[2022-03-05 01:31:08] Validating metadata...

[2022-03-05 01:31:08]   Current version: 20220220234155

[2022-03-05 01:31:08]   Restored version: 20220223161000

[2022-03-05 01:31:08] EXCEPTION: You're trying to restore a more recent version of the schema. You should migrate first!

[2022-03-05 01:31:08] /var/www/discourse/lib/backup_restore/meta_data_handler.rb:31:in `validate'

/var/www/discourse/lib/backup_restore/restorer.rb:112:in `validate_backup_metadata'

/var/www/discourse/lib/backup_restore/restorer.rb:43: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>'

[2022-03-05 01:31:08] Trying to rollback...

[2022-03-05 01:31:08] There was no need to rollback

[2022-03-05 01:31:08] Cleaning stuff up...

[2022-03-05 01:31:08] Removing tmp '/var/www/discourse/tmp/restores/default/2022-03-05-013108' directory...

[2022-03-05 01:31:08] Marking restore as finished...

[2022-03-05 01:31:08] Notifying 'Joaquin' of the end of the restore...

根据我目前的研究,异常中提到的“schema”以及“migrate first!”与 Discourse 使用的数据库有关。

我在 Discourse Meta 上搜索过,没有发现有人讨论过这个问题。我还将 Discourse 更新到了最新版本,然后再次尝试恢复,结果还是一样。我查看了 Discourse 文件,希望能找到相关的工具,但没有发现任何有用的东西。

我目前最好的猜测是,在我设置自行托管 Discourse 的那一周里,我们试用论坛(trydiscourse.com)上的一些东西发生了变化。

我的问题是:

  1. 如何执行错误提示中建议的迁移?
  2. 究竟是什么原因导致这次恢复失败?这种情况(在从试用到自行托管的过渡期间)是否会正常发生?

感谢您的任何帮助! :slightly_smiling_face:

1 个赞

您应该确保使用至少与试用版中安装的插件相同的插件来重建自托管实例。

或者,如果您觉得大胆,可以重命名备份文件,将文件名中的 20220223161000 替换为 20220220234155

6 个赞

几天前我也遇到了同样的问题。搜索功能很快就为我找到了解决方案:

(顺便说一句,与 @RGJ 的情况相同)。

3 个赞

感谢您的回复!非常有帮助 :heart:

我仍然对如何进行迁移感到好奇,但听起来可能不需要。

2 个赞