?
Persistence: Redis is storing data in memory, persistence is storing data in the hard disk, and Redis's RDB persistence is storing the data in a file that ends in an RDB
Persistence of some other databases:
The Mysql:mysql database is a notification operation when the action log is generated and then the data is recovered through the log
Memcached: Can now be persisted through master-slave replication
Redis implements RDB persistence by saying that n Key,redis written every n minutes will take data from memory to generate RDB files (snapshots of datasets) and then compress them into the backup file directory. When the last server starts again
Restore the dataset by re-executing the commands.
The persistent operation steps of the RDB for Redis: Mainly modify the redis.conf configuration file
1.save settings
Save 900 1? If at least one key is written to the Rdb file after 900 seconds
Save 300 10 writes to an RDB file if at least 10 keys are written in 300 seconds
Save 60 10000 writes to an RDB file if at least 10,000 keys are written in 60 seconds
2.stop-writes-on-bgsave-error Yes
Background Store Error Stop write
3.rdbcompression Yes
Compressing an RDB file using Lzf
4.rdbchecksum Yes
Storing and loading an RDB file is a checksum
5.dbfilename Dump.rdb
Set the name of an RDB file
6.dir./
Set the directory generated by the Rdb file
Advantages of RDB: RDB persistence can generate very compact, easy-to-save files that can be quickly recovered at any time and are ideal for disaster recovery.
? RDB disadvantage: Although the RDB persistence can save the dataset well, the set time period may conflict with the server down time, resulting in a partial loss of data.
Redis Persistent RDB