Redis Backup and Restore
Redis SAVE command is used to create backup of current redis database. The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.
Simple string reply: The commands returns OK on success.
Example: Redis Backup
The example given below creates the backup of the current database.
127.0.0.1:6379> SAVE OK
This command will create the dump.rdb file in your redis directory.
To restore redis data just move redis backup file (dump.rdb) into your redis directory and start the server. To get your redis directory use CONFIG command can be used. The CONFIG GET command is used to read the configuration parameters of a running Redis server.
127.0.0.1:6379> CONFIG get dir 1) "dir" 2) "/var/lib/redis/6379"
In the output of above command "/var/lib/redis/6379" is the directory, where redis server is installed.
The alternate command to create a Redis backup is BGSAVE. This command is used to save the DB in the background.
127.0.0.1:6379> BGSAVE Background saving started
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join