1. Endurance effect
Persistence means that because all redis data is kept in memory, updates to the data will be saved to disk asynchronously.
Persistence
- Snapshot-Redis RDB, Mysql dump
- Write log—MySql's Binlog, Hbase's Hlog, Redis' AOF
Two, one of the redis persistence methods RDB (snapshot)
Trigger mechanism-three main methods: save (synchronous), bgsave (asynchronous), automatic.
Trigger mechanism-methods not to be ignored: full copy (master-slave), debug reload, shutdown.
RDB problem
- Time-consuming and performance-consuming
- Uncontrollable, easy to lose data
Two, redis persistence method two AOF (write log)
After rebooting, load data from AOF file
Strategy
- alway: Each command will be written from the buffer to the AOF file
- everysec: Get commands from the buffer to write AOF files every second (it is possible to lose one second of data)
- no: The operating system decides when to perform AOF write
Redis to optimize the AOF write command. Function: 1. Reduce disk usage 2. Accelerate recovery speed
AOF rewrite
Implementation method: 1.bgrewriteaof 2. Automatic rewrite configuration