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.
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.
I'm using redis 2.8 with the default redis.conf file.
save 900 1
save 300 10
save 60 10000
appendonly no
I tried setting a key and immediately restarted the server (within few seconds). Upon restarting the key is persisting.
I don't understand how that's happening. According to the default configuration the key should be saved to disk only if 10000 keys are changed within 60 seconds.
Even tried to set
appendfsync no
Still the key is persisting.
When the save configuration directive is set (to any value), Redis will persist the dataset to RDB before shutting down. This behavior can be overridden by calling the SHUTDOWN command with the optional NOSAVE subcommand.
How to completely disable RDB and AOF?
I don't care about Persistence and want it to be in mem only.
I have already commented out the:
#save 900 1
#save 300 10
#save 60 10000
But this did not help and I see that Redis still tries to write to disk.
I know that Redis wants to write to disk because I get this error: "Failed opening .rdb for saving: Permission denied"
I don't care about the error, because I want to disable the Persistence altogether.
If you want to change the redis that is running, log into the redis, and
disable the aof:
config set appendonly no
disable the rdb:
config set save ""
If you want to make these changes effective after restarting redis, using
config rewrite
to make these changes to redis conf file.
If your redis have not started, just make some changes to redis.conf,
appendonly no
save ""
make sure there are no sentences like "save 60 1000" after the upper sentences, since the latter would rewrite the former.
Update: please look at Fibonacci's answer. Mine is wrong, although it was accepted.
Commenting the "dbfilename" line in redis.conf should do the trick.