문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top