redis 之 AOF

AOF(append-only fashion)是redis持久化利器之一。通过写log的方式,以满足在需要的时候,重建数据的需求。
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 on background when it gets too big.
Redis写日志包括:
1.  根据用户的配置,以不同的粒度写AOF log
2.  在日志数据量达到一定量的时候,根据配置或外部发送的命令,重建AOF log

Aof相关配置(redis.conf):
appendonly yes
是否开启AOF持久化,yes开启,no不开启

appendfilename appendonly.aof
指定AOF日志文件名称,默认名称:appendonly.aof

appendfsync everysec
什么时候将数据写入disk,redis提供三种模式:
no : 不进行fsync,有OS决定数据刷盘的时间粒度,  性能高
always : 每次写操作都做fsync , 安全
everysec :  上一个fsync后至少1s, 折中

no-appendfsync-on-rewrite no
当Aof log进行重写时,是否写日志时fsync。如果系统遇到latency问题,建议设为yes(rewrite时不强制fsync)

auto-aof-rewrite-percentage 100
当Aof log增长超过指定比例时,重写log file, 设置为0表示不自动重写Aof log

auto-aof-rewrite-min-size 64mb
启动重写Aof log时,Aof log的最小大小

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值