【Redis】3-2 Redis的持久化机制 - RDB
目录
1. 内容概要
- redis官方文档
- RDB:(Redis database)The RDB persistence performs point-in-time snapshots of your dataset at specified intervals.
- AOF :(append-only fashion)The AOF persistence logs every write operation received by the server, that will be played again at server startup,reconstructing the original dataset. Commands are logged using the same format as the Redis protocol itself, in an append-only fashion. Redis is able to rewrite the log in the background when it gets too big.
1.1 总结
适合场景:适合大量数据恢复
1.1.1 RDB
优点:
- 方便定时备份(成一个文件)
- 方便恢复与远程备份
缺点:
- 备份异常时,最后一次备份会丢失
- 备份文件大时,很消耗CPU
- 不能做到实时备份
1.1.2 redis.conf
| 配置 | 描述 |
| save 900 1 save 300 10 save 60 10000 | 数据变更条数 1+: 900秒后更新 10+: 300秒后更新 10000+:60秒后更新 |
| dir ./ | 保存RDB路径 |
| dbfilename dump.rdb | rdb保存文件名 |
| rdbchecksum yes | |
| stop-writes-on-bgsave-error yes | |
| rdbcompression yes | |

浙公网安备 33010602011771号