Redis persistence mechanisms¶
Redis offers specific strategies to persist data from memory to disk, ensuring data durability across restarts.^[600-developer-redis.md] The two primary persistence mechanisms supported are RDB and AOF.^[600-developer-redis.md]
RDB (Redis Database)¶
RDB creates point-in-time snapshots of the dataset at specified intervals.^[600-developer-redis.md] This mechanism saves the Redis dataset to a dump file (typically dump.rdb) on the disk.^[600-developer-redis.md]
The system often uses a background saving process (forking) to perform these snapshots without blocking the main thread.^[600-developer-redis.md]
AOF (Append Only File)¶
AOF works by logging every write operation received by the server.^[600-developer-redis.md] These operations are appended to a file in a format similar to the Redis protocol itself.^[600-developer-redis.md]
As time passes, the AOF file can grow large; therefore, Redis supports a rewriting mechanism (BGREWRITEAOF) to compress the file by rewriting the current state with the minimum set of commands needed to recreate it.^[600-developer-redis.md]
Sources¶
600-developer-redis.md600-developer__big-data__redis__redis-01-install.md