Files
3x-ui/docs/content/docs/en/operations/backup-restore.mdx
Egor a09e136001 docs: add Discord bot to READMEs, architecture, operations guides, and locales (#6513)
* docs: add Discord bot to READMEs, architecture, operations guides, and locales

* docs: address review feedback on Discord bot formatting, backup commands, and architecture

* docs(discord): fix Persian typo and literal arrows on fa/zh bot pages

Senior review of #6513, two LOW findings in the two new pages:

- fa/operations/discord-bot.mdx:30 spelled "developers" with Cyrillic
  "де" in place of Persian "ده", rendering a mixed-script word.
- Both pages copied `$\rightarrow$` from the en page. The docs site has
  no math plugin (nothing in source.config.ts, no remark-math
  installed), so the built HTML shows the literal string
  "$\rightarrow$" in every menu path. Replaced with a Unicode arrow on
  fa and zh; en and ru have carried the same since #6486 and are left
  for a separate change.

---------

Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
2026-09-14 11:53:22 +02:00

54 lines
2.1 KiB
Plaintext

---
title: Backup & Restore
description: Back up and restore your 3x-ui database and certificates, manually or via the Telegram bot.
icon: DatabaseBackup
---
Your entire configuration — inbounds, clients, settings — lives in the panel's
database. Back it up regularly so you can recover or migrate.
## What to back up
- **The database** — SQLite at `/etc/x-ui/x-ui.db` by default (or your
PostgreSQL database if you use that backend).
- **Certificates** — anything under `/root/cert/` (or wherever you store TLS
certs).
## Manual backup
You can download a backup from the panel's overview, or copy the database file
directly from the server:
```bash title="copy the SQLite database"
cp /etc/x-ui/x-ui.db /root/x-ui-backup-$(date +%F).db
```
To restore, stop the panel, put the database back in place, and start it again.
<Callout type="warn">
Restore a backup onto the **same major version** it came from when possible.
Across major upgrades, let the panel run its migrations rather than forcing an
old schema.
</Callout>
## Automated bot backups (Telegram & Discord)
If you've configured the [Telegram bot](/docs/operations/telegram-bot) or [Discord bot](/docs/operations/discord-bot), enable **`tgBotBackup`** or **`discordBotBackup`** to attach a backup to the periodic report (on the `tgRunTime` / `discordRunTime` schedule, default daily). The bot sends both the **database** and the **Xray `config.json`** directly to your admin chat or channel, ensuring an off-server copy. Admins can also request a backup on demand from the Telegram bot's menu or using `!backup` in Discord.
## SQLite dump / restore
The `x-ui migrate-db` command converts the SQLite database to and from a plain
SQL text dump (handy for inspection or transferring between machines):
```bash
x-ui migrate-db --dump /root/x-ui.sql # SQLite -> SQL text
x-ui migrate-db --restore /root/x-ui.sql # SQL text -> SQLite
```
To move to PostgreSQL instead, see [Database](/docs/reference/database).
<Callout type="info">
Whatever method you use, store backups **off the server** and test a restore
occasionally — an untested backup isn't a backup.
</Callout>