# Backups and restore > How to schedule backups of container databases to a bucket, download and restore one database or all of them, and how managed database backups work. Ployter backs up databases that run in containers (MySQL, MariaDB, PostgreSQL, Redis and MongoDB created as a service) and stores the files in a bucket in your project. Managed databases use the cloud's own backup, with snapshots you can see and restore from the panel. ## How container database backups work 1. At the scheduled time, the panel sends the command to the agent on the database's server. 2. The agent generates the dump inside the database container and compresses it. 3. The file goes straight to the bucket through a signed URL. The server never receives a cloud key. In MySQL and PostgreSQL, each database becomes its own file. That way you download or restore only the database you need. In the bucket, the files look like this: ```text backups/loja/mysql/2026-10-11_060000-a1b2c3/app.sql.gz backups/loja/mysql/2026-10-11_060000-a1b2c3/relatorios.sql.gz ``` MySQL system databases (`information_schema`, `performance_schema`, `sys` and `mysql`) are left out. In PostgreSQL, the `postgres` database is only included when it's the image's main database. The backup becomes a single file (with all databases) when: - the database is Redis (a `.rdb.gz` file); - the database is MongoDB (an `.archive.gz` file, made by `mongodump --archive`); - the server's agent is older than v0.23.0; - some database has a non-standard name (letters, numbers, `_`, `$` and `-`, up to 64 characters). ## Before you start - The project needs a bucket. Create one in **Database or bucket → Bucket**. See [Buckets (S3 and Spaces)](https://ployter.com/en/docs/databases/buckets/). - The server's agent must be v0.6.0 or newer. For one file per database, v0.23.0 or newer. See [Servers](https://ployter.com/en/docs/servers/servers/). - Automatic backup depends on the plan (**Scheduled backups** feature). - Configuring and running backups requires the **Container database backups** permission. Restoring requires **Restore backup** (owner and admin, by default). ## Set up automatic backup 1. Open the database service (e.g. `mysql`) and go to the **Backups** tab. 2. Turn on **Automatic backup**. 3. Pick the **Destination bucket**. 4. Check the **Database**. The panel recognizes it from the image (MySQL / MariaDB, PostgreSQL, Redis or MongoDB). 5. Pick the **Frequency**: **Once a day**, **Every 12 hours** or **Every 6 hours**. 6. Pick the **Time** (or **Starting at**, for the shorter frequencies). The time is in your time zone, set in **Preferences**. 7. In **Keep for**, pick from 1 to 90 days. 8. Click **Save**. ![Backups tab with automatic backup configured and the backup list](https://ployter.com/assets/docs/en/backups-tab.webp) After saving, the screen shows when the next backup runs. ## Back up now Click **Back up now** in the backup list. The button only works after you save the destination bucket. Only one backup runs at a time per service. ## The backup list Each row shows **When**, **Type**, **Status** and **Size**. The types are: - **Scheduled**: made by the automatic backup. - **Manual**: made with **Back up now**. - **Before restore**: the safety backup made before each restore. For per-database backups, click **N databases** (e.g. **2 databases**) to see one file per database, each with its own status and size. ![Expanded backup with one file per database](https://ployter.com/assets/docs/en/backups-files-expanded.webp) ### Download Click **Download** on the database's row (or the backup's row, when it's a single file). The download link is valid for 10 minutes. The file is a compressed dump (`.sql.gz`, `.rdb.gz` for Redis or `.archive.gz` for MongoDB), which you can import with the database's own tools. For MongoDB: `gunzip -c file.archive.gz | mongorestore --archive`. ## Restore Restoring replaces the current data with the backup's data. First, the panel saves the current state in a safety backup of type **Before restore**, which appears in the list. If something goes wrong, you restore that backup. ### Restore one database 1. Expand the backup by clicking **N databases**. 2. On the database's row, click **Restore**. 3. Read the text and confirm. Only that database goes back to the backup's date. The other databases don't change. The safety backup keeps only the restored database. ### Restore all 1. On the backup's row, click **Restore all** (or **Restore**, if it has a single database). 2. Confirm. Every database in the file goes back to the backup's date. ![Confirmation for restoring one database](https://ployter.com/assets/docs/en/backups-restore-confirm.webp) Restore rules: - **Restore all** requires a backup that finished with every database. If any file failed, restore one database at a time. - A single-file backup (Redis, MongoDB, old agent) only restores everything together. - MongoDB backup and restore need agent v0.25.0 or later on the server. - A per-database backup needs agent v0.23.0 or newer on the server. - Only one operation per service at a time: wait for the running backup or restore to finish. - The server must be online. > [!WARNING] > With Redis, the database restarts to load the file: it's down for a few seconds. In MongoDB, each collection in the backup is dropped and recreated. Collections created after the backup stay, and the database's users and passwords don't change (the root password stays the one in the variables). ![Restore confirmation for a MongoDB](https://ployter.com/assets/docs/en/backups-mongo-restore.webp) ## Retention Every hour, the panel deletes from the bucket the backups older than the **Keep for** period. The most recent completed backup is never deleted by retention, even if it's old: it's the last copy that exists. To delete a backup earlier, click the trash icon on its row. The file is removed from the bucket and can't be recovered. > [!WARNING] > Don't move or delete files in the `backups/` folder through the bucket's file manager. The backup disappears from the service's list. ## When a backup fails The reason appears below the status, in the list. The most common: - **The service's server is offline.** - **The agent didn't respond**: the server restarted or went down during the backup. After 7 hours without a response, the backup is marked as failed. - Old agent: update it on the server screen. To get an email when a backup fails, turn on **Servers, certificates and backups** in **Notifications**. See [Notifications and alerts](https://ployter.com/en/docs/observability/notifications/). ## Managed databases Managed databases (RDS, Aurora, ElastiCache, DigitalOcean) don't use the bucket: the backup belongs to the cloud itself. On the database screen, the **Backups** section lists backups and snapshots. - **AWS**: automatic backup for the period chosen at creation (1 to 35 days). **Create snapshot now** takes a manual snapshot, which stays until you delete it. - **DigitalOcean**: one backup a day, kept for 7 days. There's no manual snapshot. Valkey has no backup through the API. To restore, click **Restore** on the snapshot. Restoring creates a new database with the data from that moment and the same configuration. The current database stays up. It takes 10 to 30 minutes. Then point the services to the new database and deploy. When deleting a database on AWS, check **Keep a final snapshot** so you can restore it later. See [Managed cloud databases](https://ployter.com/en/docs/databases/managed/#excluir).