# 将 Discourse 网站迁移到另一个 VPS 使用 rsync

**URL:** <https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812>\
**Category:** Sysadmins\
**Tags:** migrations, how-to\
**Created:** [2016年五月6日 20:21 UTC](https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812 "2016-05-06T20:21:38Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![jericson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jericson/32/116215_2.png) [@jericson](https://meta.discourse.org/u/jericson)\
**Post date:** [2024年一月31日 17:50 UTC](https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812/34 "2024-01-31T17:50:33Z")

</div>

> [@Richie](#):
>
> rsync 从旧服务器到新服务器大约花了 25 分钟。这只是在同一 LON1 区域内的两个 Digital Ocean 实例之间进行的。您的体验可能会有所不同。

如果我理解正确的话，这允许在 Discourse 运行时进行大部分传输。从备份恢复策略需要至少对备份进行只读访问，并将备份移动到新服务器（或通过 S3 存储桶传输）。对于大型站点，这可能会导致相当长的只读时间，而 rsync 策略可以很好地避免这种情况。

> [@Richie](#):
>
> 在 rsync 并尝试重建后，我遇到了 [与 piratdavid 遇到的相同的错误](https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812/21)，关于 postgres `数据库系统已关闭`。

也许可以通过避免关闭旧系统上的 PostgreSQL 并使用 `pg_resetwal` [“修复”新系统上的问题](https://stackoverflow.com/a/8812934/1438) 来稍微延长正常运行时间。 **注意** ：我没有尝试过这个方法，让数据库正常关闭几乎肯定是个更好的主意。

> [@Richie](#):
>
> 然后我重新启动了旧的 Discourse 应用程序，并很快将其置于维护模式——这样人们仍然可以访问它，并会看到通常的维护警告消息。

我想知道是否有办法让 Discourse 以只读模式启动？我怀疑最快的方法是在容器运行后[通过命令行](https://meta.discourse.org/t/how-can-admin-login-while-read-only-mode-is-enabled-on-multisite/23976)进行。

无论如何，感谢您汇报您的经验！这似乎是一个有用的流程，可以随时备用。 🙂

---

_[View the full topic](https://meta.discourse.org/t/move-a-discourse-site-to-another-vps-with-rsync/43812)._
