redis中的aof模式,产生的是增量数据,还是全量数据?
先说答案:全量数据。
1、修改redis.conf,开启rdb,禁用aof
上面这个是持久化文件的路径,我们ll看下:
2、启动redis后,cli查看里面的key
[root@mini1 redis-4.0.2]# src/redis-server ./redis.conf
[root@mini1 redis-4.0.2]# src/redis-cli
3、现在转换为aof模式
在线转换参考:https://redis.io/topics/persistence
1 2 3 4 5 6 7 8 9 10 11 12 13 | How I can switch to AOF, if I'm currently using dump.rdb snapshots? There is a different procedure to do this in Redis 2.0 and Redis 2.2, as you can guess it's simpler in Redis 2.2 and does not require a restart at all. Redis >= 2.2 Make a backup of your latest dump.rdb file . Transfer this backup into a safe place. Issue the following two commands: redis-cli config set appendonly yes redis-cli config set save "" Make sure that your database contains the same number of keys it contained. Make sure that writes are appended to the append only file correctly. The first CONFIG command enables the Append Only File. In order to do so Redis will block to generate the initial dump, then will open the file for writing, and will start appending all the next write queries. The second CONFIG command is used to turn off snapshotting persistence. This is optional, if you wish you can take both the persistence methods enabled. IMPORTANT: remember to edit your redis.conf to turn on the AOF, otherwise when you restart the server the configuration changes will be lost and the server will start again with the old configuration. |
在客户端cli执行:
config set appendonly yes
config set save ""
4、新增几个key,生成aof文件,查看内容是否包含rdb中的内容
[root@mini1 backup]# less appendonly.aof
结果如下:
综上:说明aof生成的文件不是增量的,不是仅仅生成开启aof之后的命令的记录,而是包括全部的数据库记录
分类:
缓存银弹
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
· 使用C#创建一个MCP客户端