Last active
September 30, 2020 23:49
-
-
Save relekang/7136687 to your computer and use it in GitHub Desktop.
Simple Redis dump and copy every other hour. Run puppet apply redis-backup.pp to install. The copying will overwrite the last backup from the same day.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file{ [ '/backups', '/backups/redis' ]: | |
ensure => 'directory', | |
owner => 'root' | |
} | |
cron{ 'redis-bgsave': | |
command => 'redis-cli bgsave', | |
user => 'root', | |
hour => '0-23/2', | |
minute => 3, | |
} | |
cron{ 'redis-move-backup': | |
command => 'mv /var/lib/redis/dump.rdb /backups/redis/`date +%Y-%m-%d`.rdb', | |
user => 'root', | |
hour => '0-23/2', | |
minute => 23, | |
require => [ File['/backups/redis'], Cron['redis-bgsave'] ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment