# צור, הורד ושחזר גיבוי של מסד הנתונים של Discourse

**URL:** https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710
**Category:** Self-Hosting
**Tags:** backups, how-to
**Created:** [11 ביולי,‏ 2019,‏ 6:39pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710 "2019-07-11T18:39:08Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [11 ביולי,‏ 2019,‏ 6:39pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/1 "2019-07-11T18:39:08Z")

</div>

> 🔖 This guide provides step-by-step instructions for creating, downloading, and restoring a backup of your Discourse database.
> 
> 🙋 Required user level: Administrator

Discourse allows site administrators to create and download a copy of the site’s database. The backup can then be uploaded and restored to any Discourse forum.

Discourse backups include the full site database, which contains everything on the site: topics, posts, users, groups, settings, themes, etc. Depending on how the backup file is created, it may or may not include uploads. Backups that include uploads are saved as `.tar.gz` files, while backups without uploads are saved as `.sql.gz` files. See the next section for details.

Though the data created by plugins exist in the database, the plugins themselves are installed in your `app.yml` file. To restore your site to a new server you will need to make sure that your installation includes the plugins you require.

## Read-only mode

You can enable read-only mode on the Backups page to prevent site changes for admin-related tasks. [Learn more about read-only mode here](https://meta.discourse.org/t/read-only-modes-in-discourse/296976).

## Create a backup

To create a backup of your Discourse site, follow these steps:

1. Go to the **Admin / Backups** section of your site.
2. Click the **Backup** button.

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/5/1/251a2ade814ccd6010680618bb1fff0be9ea50a7.png)

1. A modal window will open with a checkbox to include the site’s uploads in the backup. Check or uncheck this option based on your preference.

> ⚠ If your site is hosted by us and you would like to create a backup that includes uploads, contact the Discourse team before creating the backup.

 ![backup_options](https://global.discourse-cdn.com/meta/original/3X/3/4/34cd8f4db8e3eac9e7acd8686e2238327c4f1891.png)

1. Click the confirmation button to start the backup.

## Download a backup

When the backup is complete, Discourse will send you a notification.

 ![backup_notification](https://global.discourse-cdn.com/meta/original/3X/e/b/eb20a7ca7f649dd6e2b1c963dee51bb660c473b1.png)

- Click the link in the notification to return to your Backups page. Then click the Download button.

 ![trigger_backup_email](https://global.discourse-cdn.com/meta/original/3X/7/6/76014feae1627d7de4d9f817997c815e116ee0e3.png)

- An email with a link to download the backup will be sent to you. Click the link to save the backup to your computer.

 ![backup_email](https://global.discourse-cdn.com/meta/original/3X/2/7/27db8452ef064365aec5a7ed1ffc5cd4d345e994.png)

## Upload a backup

- To upload a backup, go to the **Admin / Backups** section of your site, navigate to the **Backup Files** tab, and click the **Upload** button.

 ![upload_backup](https://global.discourse-cdn.com/meta/original/3X/7/c/7c0bb5e652fa0e65fe77440bb28949350315f784.png)

- This will open your browser’s file manager. Select the backup from your file system and click the file manager’s Open button. The new backup file will be displayed in the file list.

 ![uploaded_backup](https://global.discourse-cdn.com/meta/original/3X/4/d/4dadd5a85b72f1809bdb0ae0380784620240384a.png)

## Restore a backup

Before you are able to restore your backup file you need to enable the `allow restore` site setting. Then, on the **Backups** page, find the backup you want to restore, click the more options menu (⋮), and select **Restore**.

> ⚠ Restoring a backup file will overwrite all data on the site. When the backup is restored, you will be logged out of the site and need to log back in with your credentials from the restored site.

> ⚠ Make sure the site you are restoring into is running the same version of Discourse as the old site. It is best to update both sites to the latest version before running the backup/restore process.

The restore process automatically sets the `disable emails` setting to “non-staff”, so emails aren’t sent to your site’s users until you’re ready.

 ![restore_backup](https://global.discourse-cdn.com/meta/original/3X/a/8/a81a2f52bb953bb083ff9eb7b43613c83092a1de.png)

> :discourse: If your site is hosted by Discourse, the Restore option will be disabled. After uploading the backup file, contact the Discourse team and let us know the name of the backup file that you wish to restore. We will restore it for you.

## Command line backup and restore

For administrators comfortable with the command line, you can create and manage backups programmatically:

- Backups are stored in `/var/discourse/shared/standalone/backups`.
- Start a backup using:

```plaintext
./launcher run app discourse backup

```

or

```plaintext
docker exec app bash -c "discourse backup"

```

For more information about command line backups, see: [Backup discourse from the command line](https://meta.discourse.org/t/backup-discourse-from-the-command-line/64364).

> Last edited by @hugh 2025-10-03T04:56:55Z
> 
> Last checked by @hugh 2025-10-03T04:57:04Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![lega4](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lega4/32/430878_2.png) [@lega4](https://meta.discourse.org/u/lega4)
#### Post date: [12 ביולי,‏ 2024,‏ 10:43am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/45 "2024-07-12T10:43:46Z")

</div>

Is there a way to create and download this backup file programmatically? I mean, I have some cron scripts on the server which do backups for tons of other services, can I issue a few CLI commands directly on the server to get the backup there? Maybe `./launcher app backup new-backup.backup` or so?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [12 ביולי,‏ 2024,‏ 10:59am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/46 "2024-07-12T10:59:32Z")

</div>

The backups are in /var/discourse/shared/standalone/backups

You can start a backup with

./launcher run app discourse backup

Or

```plaintext
docker exec app bash -c "discourse backup" 

```

I think.

---

<div class="post-metadata">

### Author: ![das-g](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/das-g/32/441608_2.png) [@das-g](https://meta.discourse.org/u/das-g)
#### Post date: [4 בספטמבר,‏ 2024,‏ 3:27pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/47 "2024-09-04T15:27:45Z")

</div>

Is this also possible in a Docker development environment, set up as outlined at [Install Discourse for development using Docker](https://meta.discourse.org/t/install-discourse-for-development-using-docker/102009)?

When I try it as described in the section [Create a backup](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710#p-603469-create-a-backup-1) above, I get the error `pg_dump: error: connection to database "discourse_development" failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"`.

> **Full log of the failed backup**
>
> ```plaintext
> [2024-09-04 15:03:39] [STARTED]
> [2024-09-04 15:03:39] 'raphael.dasgupta' has started the backup!
> [2024-09-04 15:03:39] Marking backup as running...
> [2024-09-04 15:03:39] Making sure '/src/tmp/backups/default/2024-09-04-150339' exists...
> [2024-09-04 15:03:39] Making sure '/src/public/backups/default' exists...
> [2024-09-04 15:03:39] Updating metadata...
> [2024-09-04 15:03:39] Dumping the public schema of the database...
> [2024-09-04 15:03:40] pg_dump: error: connection to database "discourse_development" failed: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
> [2024-09-04 15:03:40] EXCEPTION: pg_dump failed
> [2024-09-04 15:03:40] /src/lib/backup_restore/backuper.rb:173:in `dump_public_schema'
> /src/lib/backup_restore/backuper.rb:36:in `run'
> /src/script/spawn_backup_restore.rb:9:in `backup'
> /src/script/spawn_backup_restore.rb:31:in `block in <main>'
> /src/script/spawn_backup_restore.rb:4:in `fork'
> /src/script/spawn_backup_restore.rb:4:in `<main>'
> [2024-09-04 15:03:40] Cleaning stuff up...
> [2024-09-04 15:03:40] Removing '.tar' leftovers...
> [2024-09-04 15:03:40] Marking backup as finished...
> [2024-09-04 15:03:40] Notifying 'raphael.dasgupta' of the end of the backup...
> 
> ```

---

<div class="post-metadata">

### Author: ![Athenkosi](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Athenkosi](https://meta.discourse.org/u/Athenkosi)
#### Post date: [23 ביולי,‏ 2025,‏ 9:43am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/48 "2025-07-23T09:43:46Z")

</div>

אני מתקשה להוריד גיבוי. כאשר לחצתי על כפתור ההורדה, קיבלתי הודעה שנשלח קישור הורדה לכתובת הדוא"ל שלי. עם זאת, עברו כבר יותר מיומיים ועדיין לא קיבלתי את המייל.

אנא סייעו לי.

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [23 ביולי,‏ 2025,‏ 11:43am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/49 "2025-07-23T11:43:32Z")

</div>

האם ניסית את `./discourse-doctor`

---

<div class="post-metadata">

### Author: ![Athenkosi](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Athenkosi](https://meta.discourse.org/u/Athenkosi)
#### Post date: [24 ביולי,‏ 2025,‏ 9:39am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/50 "2025-07-24T09:39:29Z")

</div>

תודה על תגובתך. הבעיה העיקרית היא שהגדרתי אימייל אחר מה-backend כמנהל מערכת. החיבור לפורט מספר 587 ממשיך להיכשל, והאימיילים לא נשלחים. האם יש דרך לעקוף זאת, או שיש פורט אחר לשימוש?

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [24 ביולי,‏ 2025,‏ 9:40am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/51 "2025-07-24T09:40:28Z")

</div>

האם זו כתובת המייל החלופית שאישרת?

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [24 ביולי,‏ 2025,‏ 9:41am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/52 "2025-07-24T09:41:13Z")

</div>

פורט 587 הוא מה שאני משתמש בו כדי להתחבר אל `smtp.eu.mailgun.org`

---

<div class="post-metadata">

### Author: ![Athenkosi](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Athenkosi](https://meta.discourse.org/u/Athenkosi)
#### Post date: [24 ביולי,‏ 2025,‏ 9:50am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/53 "2025-07-24T09:50:10Z")

</div>

This is what I have on my server settings.

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/1/3/6135684139905e43cead448f1bea50fa9d518034.png)

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [24 ביולי,‏ 2025,‏ 10:02am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/54 "2025-07-24T10:02:27Z")

</div>

אני מבין, אז אתה רוצה Office 365 בדומיין הראשי שלך ו-Discourse transactional email / mail-receiver באמצעות MX בתת-דומיין?

---

<div class="post-metadata">

### Author: ![Athenkosi](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Athenkosi](https://meta.discourse.org/u/Athenkosi)
#### Post date: [24 ביולי,‏ 2025,‏ 10:48am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/55 "2025-07-24T10:48:45Z")

</div>

כן, מכיוון שהאימייל שלי מוגדר ב-365

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [24 ביולי,‏ 2025,‏ 11:17am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/56 "2025-07-24T11:17:20Z")

</div>

אני חושב שהסיבה לבעיה היא שאתה משתמש ב-Office 365 עבור אימיילים טרנזקציונליים. ייתכן שתרצה להשתמש בשירות דואר טרנזקציונלי כמו Mailgun או Brevo, שניהם משמשים עם Discourse ללא בעיות רבות.

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [24 ביולי,‏ 2025,‏ 11:54am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/57 "2025-07-24T11:54:15Z")

</div>

אני יכול לעזור לך עם ההגדרות המתוארות. נכון לעכשיו, לא תוכל לשלוח או לקבל אימיילים של דיסקורס באמצעות מנוי ה-Office 365 שלך.

באיזה קנה מידה של פורום מדובר? תוכנית אימייל חינמית עשויה להספיק.

---

<div class="post-metadata">

### Author: ![Athenkosi](https://avatars.discourse-cdn.com/v4/letter/a/e79b87/32.png) [@Athenkosi](https://meta.discourse.org/u/Athenkosi)
#### Post date: [5 באוגוסט,‏ 2025,‏ 2:07pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/58 "2025-08-05T14:07:26Z")

</div>

הגדרתי הגדרות SMTP באמצעות Brevo והשתמשתי ביציאה 587, ואני עדיין מקבל את אותה שגיאה. אנא סייעו לי, איני בטוח היכן אני טועה.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [5 באוגוסט,‏ 2025,‏ 10:42pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/59 "2025-08-05T22:42:22Z")

</div>

הממ… מה לגבי שינוי הפורט ל-2525?

---

<div class="post-metadata">

### Author: ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)
#### Post date: [14 באוקטובר,‏ 2025,‏ 5:38am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/60 "2025-10-14T05:38:09Z")

</div>

were you able to get this working?

---

<div class="post-metadata">

### Author: ![xu2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xu2/32/539078_2.png) [@xu2](https://meta.discourse.org/u/xu2)
#### Post date: [9 בינואר,‏ 2026,‏ 6:56am UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/61 "2026-01-09T06:56:29Z")

</div>

When uploading a backup file, the downloaded backup file cannot be selected; it appears grayed out and cannot be selected. The file has a .tar.gz extension.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [9 בינואר,‏ 2026,‏ 4:06pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/62 "2026-01-09T16:06:58Z")

</div>

Is the uploaded file you’re trying to restore from a note recent version of Discourse?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [9 בינואר,‏ 2026,‏ 4:34pm UTC](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710/63 "2026-01-09T16:34:56Z")

</div>

> [@xu2](#):
>
> The file has a .tar.gz extension.

Did you change the name of the file at all? It won’t work if it isn’t the name given when the backup is created.

[Next page](https://meta.discourse.org/t/create-download-and-restore-a-backup-of-your-discourse-database/122710.md?page=2)
