【Redis】3-2 Redis的持久化机制
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
目录
1. 内容概要
- redis官方文档
- RDBRedis databaseThe RDB persistence performs point-in-time snapshots of your dataset at specified intervals.
- AOF append-only fashionThe 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 | |