Redis doesn't rewrite the appendonly file automatically.
My dump.rdb is 3Gb, but the appendonly file is 36Gb and filled up the disk.
Related configuration:
appendonly yes
appendfilename "appendonly.aof"
appendfsync no
no-appendfsync-on-rewrite yes
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
As I understood this line should make redis to rewrite aof when size has grown 100%.
auto-aof-rewrite-percentage 100
Does it make a new aof in the background and compares with the current size?
I did rewrite manually and aof is ~4GB, then why it didn't rewrite it?
EDIT:
Redis version: 2.8.4
I get these informations:
You open the RDB and AOF at the same time.
Manual rewrite command success.
auto-aof-rewrite-percentage config ok.
Automatic rewrite never triggered.
AOF will delay when RDB is running. I guess, the Redis was busy with RDB bgsave, and AOF rewrite delayed for each check util disk full. The AOF rewrite checking frequency is base on the configration hz.
Check the INFO command for rdb and aof information to assure that.
Related
I'm working in combined mod - RDB + AOF.
I'm looking for a way to load after a restart from the RDB file - mainly for fast restarts.
On top of that, I want to continue writing the AOF.
Once I know there is a disaster, I will manually load from AOF.
This is my current config: (I know that appendonly yes is saying that the AOF will be loaded after restart, I'm looking for a wait load from RDB and keep writing the AOF.)
aof-use-rdb-preamble yes
aof-load-truncated yes
aof-rewrite-incremental-fsync yes
appendfilename "appendonly.aof"
appendfsync everysec
appendonly yes
Thanks
Redis will always load the AOF if both are enabled, as AOF gives you better durability.
By using aof-use-rdb-preamble yes, you are already getting the best of both worlds. Your AOF is automatically rewritten every now and then automatically, with an RDB file first and a AOF tail. See redis.conf L1157.
Since you want to have a predictable mean time to recovery (MTTR), you want to adjust the parameters for Automatic rewrite of the AOF, as described in redis.conf LL113
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
You can also manually trigger a AOF rewrite with the BGREWRITEAOF command
BGREWRITEAOF would work even if appendonly is configured to no. However, note that every time you call BGREWRITEAOF you are getting pretty much an rdb file inside the appendonly.aof file.
Then, if appendonly is configured to yes, you also get an AOF tail (commands are appended to the appendonly.aof file).
BGREWRITEAOF and BGSAVE are expensive operations and will degrade the performance of your server while running. So I suggest you use only AOF, that already gives you log compaction either automatically or every time you run BGREWRITEAOF.
You can set auto-aof-rewrite-percentage to a low value, say 2 or 5 percent. Then you can test the MTTR (time it takes to restart) with both strategies. I am sure you'll find the difference is too small for it to make sense combining the two strategies separately (RDB and AOF). AOF already gives you RDB-inside if aof-use-rdb-preamble yes
I have configured my redis cluster with the following config:
appendonly no
save ""
But I found out that my redis is taking a back up and has taken a backup recently. My use case doesn't require any rdb save to be done. Am I missing some thing?
For disable all backups in redis go to redis.conf file do the following:
Comment all save directives, by default there are three of them.
save 900 1
save 300 10
save 60 10000
Disable appendonly (set appendonly to no)
I need to load a dump.rdb file to a redis cluster instance. How to do it?
While I am keeping in data directory and trying to start the instance alone (say 11211) is flushing my rdb and new rdb file is written. Even by turning the appendonly to no.
Got it.
Stop all redis instance (because redis overwrites the current rdb file when it exits).
do the below steps in master instance.
Copy your backup rdb file to the redis working directory (this is the dir option in your redis config). Also make sure your backup filename matches the dbfilename config option.
Change the redis config appendonly flag to no (otherwise redis will ignore your rdb file when it starts).
Start redis.
Run redis-cli BGREWRITEAOF to create a new appendonly file.
Restore redis config appendonly flag to yes.
There are some configuration related to snapshotting in redis docs
rdbcompression yes
rdbchecksum yes
As while master-slave replication, both diskless and disk-based, also rdb file is created (Source - https://redis.io/topics/replication).
Are the above options also plays part in replication i.e. rdb file which is created while replication is being compressed ??
I configured a Redis instance to operate only in memory (no data are dumped to a persistent storage) by commenting out the save commands:
################################ SNAPSHOTTING ################################
# save 900 1
# save 300 10
# save 60 10000
Now when I start my instance, Redis checks if there is any data the file dump.rdb. If yes, then it loads the data and the execution continues only in-memory.
Is there a way for me to load previous data from appendonly.aof (append only mode) and then continue only in an "in-memory only mode"?
No - AOF loading upon startup (unlike RDB) is done if and only if appendonly is not set to no. What you could do, as a workaround, is set appendonly to yes in the redis.conf file and once the server is up and running issue a CONFIG SET appendonly no to turn it off.