Configure Redis slave to stop saving data to file
Asked Answered
C

2

7

Can I configure Redis slave to stop saving dumps? I have omitted all save instructions in config file but slave is still doing dumps.

Canine answered 1/4, 2012 at 13:52 Comment(0)
J
10

So I assume you have checked in the configuration file of the slave that RDB is deactivated (all save lines commented out), and the slave has been restarted after the configuration file has been changed (so this configuration is active).

At this point the background dump operation of the slave is deactivated, but it does not prevent the slave to write a dump file. Actually, the slave has to write a dump file at startup time: this is how it retrieves the data from the master in bulk mode.

When the slave starts, it sends a SYNC request to the master:

  • The master starts accumulating Redis commands.
  • The master performs a background dump
  • The master sends the dump file to the slave in bulk mode
  • The slave reads the dump file from the master and write it to the disk
  • When it is complete, the slave loads the dump file from the disk
  • The slave starts processing Redis commands accumulated by the master
  • Eventually, the slave will catch up
  • The slave is in sync with the master

That's why you can find dump files on slave side even if RDB is deactivated for the slaves.

Jacquelynnjacquenetta answered 1/4, 2012 at 20:34 Comment(3)
Thanks. I just found it but this explanation prevents me from reading the details.Canine
I have created an issue in redis issue tracker for that: github.com/antirez/redis/issues/2778 . Please vote for fixing it if you need it. :)Jingoism
How about the master node? In Redis Cluster 3.0, I found there will be lots of xxx_dump.rdb file generated in the master node side, which cause issues.Nombles
Q
0

A good reading is http://redis.io/topics/persistence

Redis has 2 kinds of persistence, you should disable AOF too:

Append-only file

Snapshotting is not very durable. If your computer running Redis stops, your power line fails, or you accidentally kill -9 your instance, the latest data written on Redis will get lost. While this may not be a big deal for some applications, there are use cases for full durability, and in these cases Redis was not a viable option. The append-only file is an alternative, fully-durable strategy for Redis. It became available in version 1.1.

You can turn on the AOF in your configuration file:

appendonly yes

From now on, every time Redis receives a command that changes the dataset (e.g. SET) it will append it to the AOF. When you restart Redis it will re-play the AOF to rebuild the state.

Quarters answered 1/4, 2012 at 16:46 Comment(1)
I have appendonly no in my config.Canine

© 2022 - 2024 — McMap. All rights reserved.