I. RDB snapshot persistence
1. Configure in redis. conf
Save 900 1 # When you refresh a snapshot to a hard disk, It is triggered only when the two requirements are met, that is, at least one keyword changes after 900 seconds.
Save 300 10 # At least 10 keywords change after 300 seconds.
Save 60 10000 # At least 10000 keywords change after 60 seconds.
# Note the preceding three option annotations to block the persistent storage of RDB snapshots
Stop-writes-on-bgsave-error yes # The background storage error stops writing.
Rdbcompression yes # Use lzf to compress RDB files.
Rdbchecksum yes # verify when storing and loading RDB files.
Dbfilename dump. RDB # Set the RDB file name.
Dir./# Set the working directory, which is written to the RDB file. /Var/RDB can write absolute addresses
2. test performance
# Note: Execute the 10 thousand command
./Redis-benchmark-N 10000
Ii. aof log persistence
1. Configure in redis. conf
Appendonly yes # Whether to only log Yes (Enabled) | no (disabled)
Appendfilename "appendonly. aof" # aof file storage location/var/AOF can write absolute address
# Appendfsync no # System Buffer, unified write, fast
# Appendfsync always # The system does not buffer, Direct Writing, slow, and less data loss
Appendfsync everysec # compromise, write once per second
No-appendfsync-on-Rewrite yes # When the RDB snapshot is being exported, do you want to stop synchronizing aof yes? | no (do not stop)
Auto-Aof-rewrite-percentage 100 # the size of the aof file is 100% higher than the size of the last rewrite.
Auto-Aof-rewrite-Min-size 64 MB # aof file, which must be overwritten at least 64 MB