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

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之后的命令的记录,而是包括全部的数据库记录

转载于:https://www.cnblogs.com/grey-wolf/p/7686835.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值