Example
Objective: To copy the Redis data on the server CentOS to the Mac
Steps:
Find the dump file location on the CentOS
vi/etc/redis.conf
dbfilename Dump.rdb
Dir/var/lib/redis
Description file in
Locating the dump file location on the Mac
vi/usr/local/etc/redis.conf
dbfilename Dump.rdb
Dir/usr/local/var/db/redis
Copy the Dump.rdb on the server to the Mac machine
SCP Root@dv:/var/lib/redis/dump.rdb./
Restart the Redis on the Mac
Launchctl unload ~/library/launchagents/homebrew.mxcl.redis.plist
launchctl load ~/library/launchagents/ Homebrew.mxcl.redis.plist
PS: Backup script
look at the following script,
#! /bin/bash
path=/usr/local/bin: $PATH
redis-cli SAVE
date=$ (date + "%y%m%d")
cp/var/lib/redis/6379/ dump.rdb/data01/cache_backup/$date. Rdb
echo "done!"
Like a script, you can back up Redis data files in such a way as cron. Details are as follows:
You must first save because the Redis Rdb file is not always a full mirror of the memory data, and you must save before the backup, send the Save command to it, and then copy the Rdb file.
The specific path to the RDB is not necessarily the same as the path, which can be found in the Redis configuration file/etc/redis/6379.conf
# The filename where to dump the DB
dbfilename Dump.rdb
# The working directory.
#
The DB'll is written inside this directory, with the filename specified
# above using the ' dbfilename ' con figuration directive.
#
# Also The Append only File would be created inside this directory.
#
# That's you must specify a directory, not a file name.
dir/var/lib/redis/6379