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
Help the community: