# Discourseを別のサーバーへ移行する方法（同じDNS名を維持）

**URL:** https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572
**Category:** Self-hosting
**Created:** [2021 年 1 月 9 日午前 5:03 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572 "2021-01-09T05:03:08Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [2021 年 1 月 20 日午前 9:21 UTC](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572/5 "2021-01-20T09:21:02Z")

</div>

ありがとうございます。どうやら「リフト＆シフト」は私が思っていたほどきれいな作業ではなかったようです。スムーズなリフト＆シフト操作を確保するためには、前後にいくつかの確認作業が必要です（Postgres が 12.0 から 13.0 へアップグレードされた際、リフト＆シフトのプロセスについていくつかの教訓を得ました）。以下は、Amazon LightSail サーバー（1GB RAM）への移行を試みる方々のための将来の参考となるステップバイステップガイドです。

**元のサーバー**

- S3 へのバックアップを作成
- `cd /var/discourse`
- `./launcher rebuild` # 簡単な移行のために最新のビルドを取得
- `./launcher cleanup` # 古いデータを削除しパッケージサイズを削減
- `./launcher stop app` # これを行わないと、後で Postgres を使用して再ビルドしようとした際に失敗します
- `tar -zcvf /var/discourse discourse.tar.gz`

**新しい Amazon LightSail サーバー**

- Amazon から Ubuntu 20.20 イメージをインストール（1GB RAM）
- [Docker](https://www.digitalocean.com/community/tutorials/how-to-install-discourse-on-ubuntu-18-04) をインストール
- [2GB スワップ](https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880) を作成 # これを行わないと再ビルドが失敗する可能性があります
- [`vm.overcommit_memory=1`](https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/) を設定 # これを行わないと、再ビルド中に Postgres で失敗する可能性があります
- 元のサーバーから _discourse.tar.gz_ を FTPS/転送
- `tar -zxvf discourse.tar.gz -C /`
- `cd /var/discourse`
- `app.yml` 内の [`UNICORN_WORKERS`](https://meta.discourse.org/t/problems-with-install-cloud-md-directions/43314/43) を _2_ に設定 # 1GB RAM で 2 を超えると、過度なディスクアクティビティによるスワップとスロットリングのリスクがあります
- `./launcher rebuild`
- DNS を新しい Amazon サーバーを指すように変更

Discourse のセットアッププロセスを経ることなく、サーバーを移行（リフト＆シフト）するより簡単な方法はありませんか？

---

_[View the full topic](https://meta.discourse.org/t/how-to-migrate-discourse-from-one-server-to-another-with-the-same-dns-name/175572)._
