Redis command reference:
Http://redis.readthedocs.org/en/latest/index.html
Redis Master/Slave Configuration:
Modify the following parameters:
Pidfile: PID address
Logfile: log file address
Port: Port Number
BIND: bind a host address, either local or remote
Slaveof: Master host address and port
Master:/Usr/local/redis/etc/redis. conf
Pidfile/var/run/redis. PID
Logfile/usr/local/redis/var/redis. Log
Port 6379
Bind 127.0.0.1
Slave:/Usr/local/redis/etc/redis_slave.conf
Pidfile/var/run/redis_slave.pid
Logfile/usr/local/redis/var/redis_slave.log
Port 6380
Bind 127.0.0.1
Slaveof 127.0.0.1 6380
Start:
/Usr/local/redis/bin/redis-server/usr/local/redis/etc/redis. conf
/Usr/local/redis/bin/redis-server/usr/local/redis/etc/redis_slave.conf
Redis data recovery:
When the redis server fails, data will be restored to the memory according to the following priority during restart:
1. If only aof is configured, load the aof file to restore data upon restart;
2. If both RBD and aof are configured, only the aof file is loaded to restore data.
3. If only RBD is configured, load the dump file to restore data.
Redis data backup:
Aof method:
Appendonly Yes
# The Name Of The append only file (default: "appendonly. aof ")
Appendfilename appendonly. aof
Dump mode;
### The following is a snapshot persistence policy. In order to ensure data security, the more frequent the changes in the following settings, the more frequent the snapshotting. That is to say, the more pressure, the more resources are spent on persistence. So I chose the master-slave mode and turned off the snapshotting on the master.
# Save 900 1 # in 900 seconds, redis takes a snapshot to the disk if at least one modification occurs.
# Save 300 100 # in 300 seconds, redis takes a snapshot to the disk if at least 100 modifications occur to redis
# Save 60 10000 # in 60 seconds, redis takes a snapshot to the disk if at least 10000 modifications occur to redis
Rdbcompression yes # Use Compression
Dbfilename dump. RDB # name of the snapshotting File
DIR/opt/data/redis/# path of the snapshotting File