# Creating Manual Backups

Regular backups are essential when running a Redis deployment especially if you’re using it for persistent data. While Elestio handles automated backups by default, you may want to create manual backups before configuration changes, retain a local archive, or test backup automation. This guide walks through multiple methods for creating Redis backups on Elestio, including dashboard snapshots, command-line approaches, and Docker Compose-based setups. It also explains backup storage, retention, and automation using scheduled jobs.

## **Manual Service Backups on Elestio**

If you’re using Elestio’s managed Redis service, the simplest way to perform a full backup is directly through the Elestio dashboard. This creates a snapshot of your current Redis dataset and stores it in Elestio’s infrastructure. These snapshots can be restored later from the same interface, which is helpful when making critical changes or testing recovery workflows.

**To trigger a manual Redis backup on Elestio:**

1. Log in to the [Elestio dashboard](https://elest.io).
2. Navigate to your Redis service or cluster.
3. Click the <span class="s1">**Backups**</span> tab in the service menu.
4. Choose <span class="s1">**Back up now**</span> to generate a manual snapshot.

[![Screenshot 2025-05-20 at 12.27.22 PM.jpg](https://docs.elest.io/uploads/images/gallery/2025-05/scaled-1680-/screenshot-2025-05-20-at-12-27-22-pm.jpg)](https://docs.elest.io/uploads/images/gallery/2025-05/screenshot-2025-05-20-at-12-27-22-pm.jpg)

This method is recommended for quick, reliable backups without needing to use the command line.

## **Manual Backups Using Docker Compose**

If your Redis instance is deployed via Docker Compose (as is common on Elestio-hosted environments), you can manually back up Redis by copying its internal snapshot files. Redis persistence is managed through <span class="s2">**RDB (Redis Database)**</span> and optionally <span class="s2">**AOF (Append-Only File)**</span> logs, both of which reside in the container’s filesystem.

#### **Access Elestio Terminal**

Go to your deployed Redis service in the Elestio dashboard, navigate to <span class="s2">**Tools &gt; Terminal**</span>, and log in using the credentials provided.

#### **Locate the Redis Container Directory**

Navigate to your app directory:

```
cd /opt/app/
```

This is the working directory of your Docker Compose project, which contains the <span class="s1">docker-compose.yml</span> file.

#### **Trigger an RDB Snapshot (Optional)**

Redis typically saves snapshots automatically based on configuration, but you can force one manually:

```
docker-compose exec redis redis-cli SAVE
```

This command triggers an immediate snapshot. The resulting file is usually called <span class="s1">dump.rdb</span>.

#### **Copy Backup Files from the Container**

Use <span class="s1">docker cp</span> to copy the snapshot file (and optionally the AOF file, if enabled) from the container to your host system:

```
docker cp $(docker-compose ps -q redis):/data/dump.rdb ./backup_$(date +%F).rdb
```

If AOF persistence is also enabled (via <span class="s1">appendonly yes</span> in redis.conf), back up the AOF log as well:

```
docker cp $(docker-compose ps -q redis):/data/appendonly.aof ./appendonly_$(date +%F).aof
```

This gives you complete Redis data snapshots for storage or future recovery.

## **Backup Storage &amp; Retention Best Practices**

After creating backups, it’s important to store them securely and manage retention properly. Redis backups are binary files and can be quite compact (RDB) or larger and more frequent (AOF), depending on configuration.

##### **Guidelines to Follow:**

- <span class="s1">Use clear naming: </span>`redis_backup_2025_05_19.rdb`
- Store off-site or on cloud storage (e.g. AWS S3, Backblaze, encrypted storage).
- Retain: 7 daily backups, 4 weekly backups, and 3–6 monthly backups.
- Automate old file cleanup with cron jobs or retention scripts.
- Optionally compress backups with <span class="s1">gzip</span> or <span class="s1">xz</span> to reduce space.

## **Automating Redis Backups (cron)**

Manual backup commands can be scheduled using tools like <span class="s2">cron</span> on Linux-based systems. This allows you to regularly back up your database without needing to run commands manually. Automating the process also reduces the risk of forgetting backups and ensures more consistent retention.

##### **Example: Daily Backup at 3 AM**

1. Edit the crontab:

```
crontab -e
```

2. Add a job like:

```
0 3 * * * docker-compose -f /opt/app/docker-compose.yml exec redis redis-cli SAVE && \
docker cp $(docker-compose -f /opt/app/docker-compose.yml ps -q redis):/data/dump.rdb /backups/redis_backup_$(date +\%F).rdb
```

Make sure <span class="s1">/backups/</span> exists and is writable by the cron user.

You can also compress the file or upload to cloud storage in the same script:

```
gzip /backups/redis_backup_$(date +\%F).rdb
rclone copy /backups/remote-dir/ remote:redis-backups
```

## **Backup Format and Restore Notes**

<table border="1" id="bkmrk-format-description-r" style="border-collapse: collapse; border-color: rgb(0, 0, 0);"><thead><tr><th style="border-color: rgb(0, 0, 0);">**Format**

</th><th style="border-color: rgb(0, 0, 0);">**Description**

</th><th style="border-color: rgb(0, 0, 0);">**Restore Method**

</th></tr></thead><tbody><tr><td style="border-color: rgb(0, 0, 0);">`dump.rdb`

</td><td style="border-color: rgb(0, 0, 0);">Binary snapshot of full dataset

</td><td style="border-color: rgb(0, 0, 0);">Stop Redis, replace <span class="s1">dump.rdb</span>, then restart Redis

</td></tr><tr><td style="border-color: rgb(0, 0, 0);">`appendonly.aof`

</td><td style="border-color: rgb(0, 0, 0);">Append-only command log

</td><td style="border-color: rgb(0, 0, 0);">Stop Redis, replace AOF file, then restart Redis

</td></tr></tbody></table>

To restore from a backup:

1. <span class="s1">Stop Redis (</span>docker-compose down<span class="s1">)</span>
2. Replace the corresponding file in the <span class="s1">volumes</span> or <span class="s1">/data</span> directory.
3. <span class="s1">Restart Redis (</span>docker-compose up -d<span class="s1">)</span>