Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest general-purpose Redis backup on Ubuntu is a completed RDB snapshot made with BGSAVE, copied only after the snapshot finishes. RDB gives you one compact, point-in-time file. AOF records writes for finer recovery but, on Redis 7.0.0 and later, must be backed up as a complete multipart set: the base file, every incremental file, and its manifest.

For either method, verify the active Redis configuration instead of assuming a data path, stop Redis before replacing persistence files during a restore, and test the recovered instance with redis-cli ping, key-count checks, and application-level validation. Redis Open Source 8.10.0 adds BACKUP START, BACKUP SEAL, and the startup-only preload-file option for sealed backups; older releases use the standard RDB and AOF procedures below.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the persistence format before you copy anything

Redis can persist data with Redis Database (RDB) snapshots, the Append Only File (AOF), or both. The choice affects how much recent data a backup can contain, how large it is, how complicated a safe copy is, and how quickly it can be restored.

RDB: a compact point-in-time backup

An RDB file is a single, compact representation of the dataset at one instant. Redis documentation describes RDB as a “very compact single-file point-in-time representation” and says RDB files are suitable for backups. That single-file design makes RDB straightforward to archive, move to independent storage, and retain as dated generations.

#1 Best Overall

The normal online command is BGSAVE. Redis forks a child process to write the snapshot while the parent continues serving clients. The command normally returns immediately; the child writes the file and exits. You still have to wait for completion before copying the file.

AOF: a write log that can replay changes

AOF records write operations so Redis can replay them to rebuild the dataset. It can represent writes made after an older RDB point, giving a more recent recovery point than a snapshot-only strategy, but the files require more operational care.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Redis 7.0.0 and later use a multipart AOF layout: one base file, one or more incremental files, and a manifest that identifies the set. A backup that omits any member of that set is incomplete. Copying while an AOF rewrite is changing the set can produce an invalid backup.

Using both formats

Running RDB and AOF together can provide a compact snapshot alongside a write log. Document which format your recovery plan uses, which files belong to it, and the Redis version that created them. A restore must match the persistence layout expected by the running version.

Pre-backup checks on Ubuntu

Ubuntu package defaults, service-unit names, authentication, TLS, configuration locations, and filesystem permissions vary by release and installation method. Perform these checks against the server you actually intend to protect.

  1. Confirm the service unit. Run sudo systemctl status redis-server. Some installations use redis rather than redis-server; use the unit name shown by your system.
  2. Confirm client connectivity. Run redis-cli ping. A healthy, unauthenticated local connection returns PONG. If your deployment requires authentication, a TLS connection, or a non-default endpoint, add the options required by that deployment.
  3. Read the active configuration. In the active redis.conf, identify dir (the persistence directory), dbfilename (the RDB filename, conventionally dump.rdb), and, for multipart AOF, appenddirname. Do not assume a universal Ubuntu path such as /var/lib/redis; the official documentation does not define one for every installation.
  4. Record the current persistence mode. Note whether RDB, AOF, or both are enabled, the Redis version, the service account, and the current AOF rewrite setting. Keep this information with the backup so a future restore uses the correct layout.
  5. Prepare independent storage. A backup on the same disk as Redis does not protect against disk failure. Plan several dated generations and a separate storage location, and restrict access because persistence files contain the dataset.

Back up Redis with an RDB snapshot

This procedure creates an online snapshot without intentionally stopping client traffic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Check the server

Verify the unit and connection first:

sudo systemctl status redis-server
redis-cli ping

Proceed only when the service is healthy and the client receives PONG. If the command fails because of ACLs, a password, TLS, or a different socket, correct the connection before starting the backup.

2. Trigger a background save

Run:

redis-cli BGSAVE

Redis returns while a child process writes the RDB file. The parent continues serving clients, but the file is not ready to copy merely because the command returned.

3. Wait for completion

Use redis-cli LASTSAVE and the persistence information to confirm that the save completed. Check the persistence status with:

redis-cli INFO persistence

Do not copy the RDB file while a new snapshot is still being written. The timestamp from LASTSAVE should advance after the requested save, and the persistence fields should no longer indicate an in-progress background save. If the save failed, investigate the error before treating any file as a valid backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Locate and copy the completed file

Open the active configuration and use its dir and dbfilename values. The conventional filename is dump.rdb, but the configured name is authoritative. Copy the completed file to independent backup storage and preserve several dated generations.

Redis writes a new RDB snapshot to a temporary file and atomically renames it into place when complete. Consequently, a file that was already complete before the copy began is safe to copy as a coherent snapshot. That guarantee does not make it safe to copy while the new snapshot is still being written.

5. Record what the backup contains

For each generation, record the Redis version, the source host, the snapshot completion time, the configured filename and directory, and whether AOF was also enabled. These notes prevent a later operator from confusing an old snapshot with the point-in-time state it represents.

Why SAVE is usually the wrong production command

SAVE writes an RDB snapshot synchronously in the Redis server process. While it runs, clients can be blocked. Redis documentation warns that you almost never want to call SAVE in production because it blocks other clients. Use BGSAVE for an online backup. Reserve SAVE for a controlled maintenance or emergency situation where you have explicitly accepted the interruption.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Back up an AOF safely

AOF backups demand stricter handling than a single RDB file. The exact procedure depends on the Redis version and layout.

Redis 7.0.0 and later: copy the complete multipart set

In the standard Redis 7.0.0-and-later layout, the AOF consists of a base file, one or more incremental files, and a manifest. All of them are required. Copying only the base file or only the newest incremental file cannot recreate the complete dataset.

1. Pause automatic AOF rewrites

Temporarily set auto-aof-rewrite-percentage to 0 so an automatic rewrite cannot change the multipart set during your filesystem copy. If you change the live setting with the command interface, the operation is conceptually:

redis-cli CONFIG SET auto-aof-rewrite-percentage 0

Use the authentication, TLS, and endpoint options required by your installation. Save the previous percentage before changing it; it must be restored after the copy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Confirm that no rewrite is already running

Run:

redis-cli INFO persistence

Check that aof_rewrite_in_progress is 0. If it is 1, wait for the rewrite to finish before copying. Setting the percentage to zero prevents a new automatic rewrite; it does not cancel one already in progress.

3. Copy the entire AOF directory

Read appenddirname from the active configuration and copy that directory as a unit. Include the base file, every incremental file, and the manifest. Keep the directory structure intact in the backup destination. Do not mix files from different backup attempts.

4. Restore the rewrite setting

After the copy has completed and you have verified that the destination contains the complete set, restore the previous auto-aof-rewrite-percentage value. If your installation persists configuration in a file, ensure the intended value is also represented there; otherwise a restart may reintroduce a different setting.

Older AOF layouts

Redis versions before 7.0.0 do not use the standard multipart layout introduced in 7.0.0. Follow the file layout and configuration used by that release rather than applying the multipart procedure blindly. Keep the creating Redis version with the backup metadata.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why an active rewrite can invalidate a copy

An AOF rewrite can replace or reorganize the files referenced by the manifest. A filesystem copy taken while that operation is active may contain a manifest that points to files not present in the destination, or files from different generations. That is why the safe sequence is: disable automatic rewrites temporarily, wait for aof_rewrite_in_progress to become 0, copy the entire appenddirname directory, then restore the setting.

Redis 8.10.0 and later: sealed backups and preload

Redis Open Source 8.10.0 adds the BACKUP command family, including BACKUP START and BACKUP SEAL. These commands provide a supported way to create a sealed backup artifact. The corresponding restore feature is the startup-only preload-file option.

Use the command syntax documented for your exact 8.10.x build to start and seal the backup. Treat the sealed output as a versioned set, not as an arbitrary file copied from an active AOF directory. A sealed backup is useful when you need Redis itself to define the consistent artifact boundary.

At startup, a sealed multipart AOF can be preloaded with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

preload-file aof:/path/to/appendonly.aof.manifest

For a single RDB preload, use:

preload-file rdb:/path/to/backup.rdb

preload-file is a startup-only option. Plan it in the service’s startup configuration for the recovery run, verify that the referenced files and associated members are readable by the Redis service account, and remove or change the option after the intended recovery workflow is complete.

Restore Redis on Ubuntu from an RDB backup

Restoration replaces live persistence data. Stop the service first, preserve the current files, then start Redis only after the selected backup is in the configured location.

  1. Record the current configuration. Confirm the Redis version, service unit, dir, dbfilename, persistence mode, and service account. If the machine was reinstalled, install the intended Redis release before copying data.
  2. Stop Redis cleanly. Run sudo systemctl stop redis-server, adjusting the unit name if your installation uses redis. Confirm that the service has stopped before touching persistence files.
  3. Preserve the existing data. Move or copy the current RDB and related persistence files to a separate recovery directory. This gives you a rollback point if the selected backup is wrong or damaged.
  4. Place the backup file. Put the selected RDB file in the configured Redis data directory under the configured dbfilename. If the configured name is not dump.rdb, use the configured name. Ensure the Redis service account can read the file and traverse the directory.
  5. Start Redis. Run sudo systemctl start redis-server. Redis loads the RDB during startup.
  6. Verify the service and data. Run redis-cli ping and expect PONG. Compare the key count with the pre-incident record and run application-level checks for representative data, expiration behavior, and critical workflows. A running process alone does not prove that the correct backup was loaded.

Restore a multipart AOF backup

For a Redis 7.0.0-or-later multipart AOF restore, the complete base file, every incremental file, and the manifest must be present. Stop Redis, preserve the current persistence directory, replace the configured AOF directory with the complete backup set, and confirm that the configuration enables the expected AOF mode and points to the correct directory. Then start the service and perform the same connectivity, key-count, and application checks used for an RDB restore.

If the backup was created as a Redis 8.10.0-or-later sealed artifact, prefer the preload procedure for that artifact:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

preload-file aof:/path/to/appendonly.aof.manifest

Use the exact manifest path and ensure all associated files are alongside it as required by the sealed backup. Do not point Redis at a manifest whose base or incremental members were omitted from the backup.

Restore after reinstalling Ubuntu

A reinstall changes more than the operating system: package versions, service names, users, directories, and configuration paths may all differ. Use this order:

Best Value
  1. Install the Redis version compatible with the backup and document the package or installation method.
  2. Identify the service unit and active configuration file. Do not copy files into a guessed directory.
  3. Stop the newly installed service before placing persistence data.
  4. Recreate or verify the configured data directory, service-account ownership, and read permissions.
  5. For RDB, place the selected file under the configured dbfilename. For multipart AOF, restore the complete directory and manifest. For a Redis 8.10.0-or-later sealed backup, configure the appropriate preload-file startup option.
  6. Start the service and inspect startup logs if loading takes longer than expected or fails.
  7. Run redis-cli ping, compare key counts, and test the applications that depend on Redis before directing production traffic to the recovered instance.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

RDB versus AOF: which should your backup plan use?

Criterion RDB AOF
Recovery-point granularity The point in time of the completed snapshot. Can represent more recent writes by replaying the log, subject to the files successfully captured.
Backup shape One compact RDB artifact, normally named dump.rdb unless configured otherwise. On Redis 7.0.0 and later, a base file, one or more incremental files, and a manifest.
Copy procedure Run BGSAVE, verify completion, then copy the completed file. Prevent automatic rewrites, verify aof_rewrite_in_progress=0, and copy the complete AOF directory.
Operational complexity Lower; a single completed file is easy to archive and track. Higher; omitting one member or copying during a rewrite can invalidate the backup.
Restore handling Place the file in the configured directory and let Redis load it at startup, or use the Redis 8.10.0-or-later RDB preload form. Restore the complete set and manifest; sealed Redis 8.10.0-or-later backups can use the AOF preload form.
Version considerations Confirm that the target Redis release can load the file and that its configuration uses the expected filename. Redis 7.0.0 introduced the standard multipart layout; older releases use their own AOF layout.

For a simple archival and disaster-recovery workflow, RDB is usually easier to operate correctly. Choose AOF when the finer write history justifies the additional handling, and document the complete file set and rewrite state as part of every backup.

Back up without stopping writes: what is safe?

RDB backups can be made while Redis serves clients by using BGSAVE. The parent process continues serving requests while the child writes the snapshot. The important boundary is completion: do not copy the file until the save has finished.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A multipart AOF copy also can be performed while Redis is serving clients, but it requires coordination with rewrites. Temporarily set auto-aof-rewrite-percentage to 0, confirm aof_rewrite_in_progress is 0, copy the entire configured AOF directory, and restore the prior setting. If you cannot establish that stable boundary, do not treat the resulting filesystem copy as a reliable backup.

Troubleshooting common backup and restore failures

redis-cli ping does not return PONG

Check whether the service is running under a different unit name, whether the CLI is pointed at the correct socket or port, and whether authentication or TLS is required. Resolve connectivity first; a failed health check means the backup commands may be targeting the wrong endpoint.

The expected dump.rdb file is not present

Read dir and dbfilename from the active configuration. The filename may not be dump.rdb, and the data directory may not be the Ubuntu package default you expected. Also verify that BGSAVE completed successfully before searching for the file.

The RDB file changes during copying

Stop the copy, check persistence status, and wait for the background save to finish. Redis’s atomic rename protects a completed file, not a file that you started reading while a new snapshot was still being written.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The AOF restore reports missing or inconsistent files

Compare the backup against the manifest. On Redis 7.0.0 and later, restore the base file, every incremental file, and the manifest from the same backup generation. A directory assembled from different copy attempts is not a complete multipart backup.

The service starts but the data is wrong

Stop accepting application traffic, preserve the current restored files, and recheck which backup generation was selected. Compare key counts and application-level records with the pre-incident evidence. Also confirm that the service loaded the intended directory and filename rather than a newly created empty location.

Redis will not read the restored files

Check ownership and permissions for the Redis service account, directory traversal permissions, the configured persistence mode, and compatibility between the creating and restoring Redis versions. For a sealed Redis 8.10.0-or-later backup, verify the preload-file prefix and path, and remember that it is a startup-only option.

A practical retention and recovery checklist

  • Keep multiple dated generations rather than overwriting one backup.
  • Store copies independently of the Redis host and disk.
  • Record the Redis version, persistence mode, configured paths, completion time, and service unit with every generation.
  • For RDB, record the successful BGSAVE completion before copying.
  • For AOF, retain the complete multipart set and manifest from one generation.
  • Never copy an AOF directory while aof_rewrite_in_progress is 1.
  • Protect backup files because they contain Redis data.
  • Test a restoration periodically on an isolated instance, then run redis-cli ping, key-count checks, and application validation.
  • After a recovery, remove temporary preload settings or rewrite overrides that were used only for the exercise.

Commands at a glance

Purpose Command or setting Important condition
Check service sudo systemctl status redis-server Use the actual unit name if it is redis.
Check connectivity redis-cli ping Expected result is PONG when the endpoint and credentials are correct.
Start online RDB backup redis-cli BGSAVE Wait for completion before copying.
Check last snapshot redis-cli LASTSAVE Use with persistence status to confirm the requested save completed.
Inspect persistence state redis-cli INFO persistence For AOF copying, require aof_rewrite_in_progress to be 0.
Pause automatic AOF rewrites redis-cli CONFIG SET auto-aof-rewrite-percentage 0 Save and restore the prior value after copying.
Stop before restore sudo systemctl stop redis-server Adjust the service unit name when necessary.
Start after restore sudo systemctl start redis-server Validate connectivity and data before resuming traffic.
Preload sealed AOF on Redis 8.10.0+ preload-file aof:/path/to/appendonly.aof.manifest Startup-only; retain every associated file.
Preload one RDB on Redis 8.10.0+ preload-file rdb:/path/to/backup.rdb Startup-only; use the actual backup path.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.