# Backup And Restore Runbook M00 provides checks and templates only. Production backups must be enabled by the Ubuntu administrator after database credentials, upload paths and EMQX configuration are confirmed. ## Backup Targets - MySQL logical dump: `/opt/apps/backups/mysql` - EMQX data export: `/opt/apps/backups/emqx` - Uploaded files archive: `/opt/apps/backups/files` - Manual manifests: `/opt/apps/backups/manual` ## Backup Check ```bash /opt/apps/setup.sh --backup-status ``` ## Manual Commands The commands below are examples for the production administrator. Do not store real credentials in Git. ```bash mysqldump --single-transaction --routines --triggers --events qipai > /opt/apps/backups/mysql/qipai-YYYYmmddHHMMSS.sql emqx ctl data export tar -C /opt/apps -czf /opt/apps/backups/files/uploads-YYYYmmddHHMMSS.tgz uploads ``` ## Restore Outline 1. Stop the backend process through PM2 after confirming a maintenance window. 2. Verify the selected backup files and hashes. 3. Restore MySQL into a staging database before production. 4. Restore EMQX export and restart EMQX. 5. Restore uploads into `/opt/apps/uploads`. 6. Run API, admin, miniapp and MQTT smoke checks. Automatic production restore is intentionally disabled in M00.