Use BGSAVE to take a snapshot of a Redis db #357

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@bugant
bugant commented Sep 3, 2012

The Redis SAVE command should almost never be called in production
environments since it will block all the other clients. Its BGSAVE
variant should be use instead.

See the following links for more details on the two commands:

SAVE http://redis.io/commands/save
BGSAVE http://redis.io/commands/bgsave

Matteo Centenaro FIX: use BGSAVE instead of SAVE for Redis backup
The Redis SAVE command should almost never be called in production
environments since it will block all the other clients. Its BGSAVE
variant should be use instead.

See the following links for more details on the two commands:

SAVE    http://redis.io/commands/save
BGSAVE  http://redis.io/commands/bgsave
2d17b26
@travisbot

This pull request passes (merged 2d17b26 into 5639587).

@ghost
ghost commented Sep 3, 2012

Invoking SAVE is optional. This must be done synchronously here so backup can then copy the resulting dump file.
Using BGSAVE would have to be a separate option, since backup would then need to poll redis until the operation is complete. See http://redis.io/commands/lastsave

@bugant
bugant commented Sep 4, 2012

@burns you are definitively right. Thank you for the comment

@bugant
bugant commented Sep 4, 2012

I'm closing this pull request since it need to be fixed as suggested by @burns. What do you think about it? Do you find it useful? Would you like to have it in?

@bugant bugant closed this Sep 4, 2012
@ghost
ghost commented Sep 5, 2012

Sounds like it would be a good option. May want to deprecate invoke_save in favor of something like dump_command = :save, :bgsave, :none, defaulting to :none. The polling interval and timeout should have sensible defaults, but should also be configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment