n8n Backup & Disaster Recovery: Save the Structures, Rot the Secrets, Keep the Key Apart
说明与用途
将工作流导出与加密密钥和数据库分离,并定期进行恢复演练,可防止灾难导致数据不可逆丢失。
问题
Self‑hosted n8n instances lose workflow definitions, encrypted credentials, and the encryption key in a disaster, making recovery impossible.
结果
Separating workflow exports from the encryption key and database, and performing regular recovery drills, ensures that a disaster does not result in irreversible data loss.
工作流
- 1. Configure a nightly job to export workflows via the n8n CLI, producing JSON files.
- 2. Pipe the export through a secret‑scrubbing step to remove hardcoded tokens and sensitive data.
- 3. Store the scrubbed export files in a versioned backup system (e.g., Git or object storage).
- 4. Use infrastructure snapshot tooling to back up the n8n database and the N8N_ENCRYPTION_KEY, storing them separately from the exports.
- 5. Quarterly, spin up a fresh n8n instance on staging, restore the database and key, import the scrubbed workflow exports, and run a test end‑to‑end execution to validate recovery.
- 6. Monitor the export job with a heartbeat ping; alert on silence to detect failed backups.
- 7. Before each deploy, run the free n8n workflow audit tool to detect secret patterns, localhost URLs, and broken references in the export.
证据
CLI exports produce JSON of workflow structures: perfect for version history and Git-based backup.
Item two: the database plus N8N_ENCRYPTION_KEY, via your infra provider's snapshot tooling, stored somewhere the exports aren't.
Quarterly, minimum: fresh n8n on staging, feed it the backup database and key, import workflows, light one real execution end-to-end.
- 记录日期: 2026-10-26T20:26:42.866Z