Redis replication uses options of redis snapshotting - redis

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 ??

Related

redis - load from RDB and keep writing the AOF

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

Redis taking RDB dump even if save is disabled

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)

How to load RDB to a redis cluster

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.

Redis load from aof and continue only in-memory

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.

Redis.conf for slave with sentinel

Should I use exact mirror of redis.conf on slave, if it would be promoted as master when failover activates.
For example should I appendonly yes to slave ?
The slaves configuration are different than the master one, so you will need to have 1 config file per server, plus one sentinel config file. Here you have a nice tutorial to make it work (basically) https://seanmcgary.com/posts/how-to-build-a-fault-tolerant-redis-cluster-with-sentinel