0
0
Redisquery~5 mins

RDB snapshots (point-in-time) in Redis

Choose your learning style9 modes available
Introduction

RDB snapshots save the state of your Redis database at a specific moment. This helps you recover data if something goes wrong.

You want to back up your Redis data regularly to avoid data loss.
You need to restore your database to a previous state after accidental changes.
You want to move your Redis data to another server safely.
You want to analyze the data as it was at a certain time without affecting live data.
Syntax
Redis
SAVE
BGSAVE

SAVE blocks Redis until the snapshot is done.

BGSAVE runs the snapshot in the background without blocking Redis.

Examples
This command creates a snapshot immediately and blocks Redis until finished.
Redis
SAVE
This command starts a background snapshot, letting Redis continue working.
Redis
BGSAVE
Sample Program

This command tells Redis to save the current database state to disk in the background.

Redis
BGSAVE
OutputSuccess
Important Notes

RDB snapshots are point-in-time copies of your data saved to disk.

Using BGSAVE is preferred in production to avoid blocking Redis.

Snapshots are saved in a dump file (usually dump.rdb) in your Redis directory.

Summary

RDB snapshots save your Redis data at a specific time.

Use SAVE for immediate blocking save, BGSAVE for background save.

Snapshots help with backups and recovery.