-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backup on MySQL DB slave if it is available #249
Backup on MySQL DB slave if it is available #249
Conversation
cookbooks/ey-backup/recipes/mysql.rb
Outdated
is_db_slave = 'db_slave' == node.dna['instance_role'] | ||
is_first_slave = node.dna['db_slaves'].first == (node['ec2'] && node['ec2']['local_hostname'] ? node['ec2']['local_hostname'] : hostname.stdout) | ||
|
||
if has_backups_enabled && (db_slaves_available && is_db_slave && is_first_slave || !db_slaves_available && is_db_master_or_solo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_db_slave
is redundant in this test - we can just check:
if has_backups_enabled && (db_slaves_available && is_first_slave || !db_slaves_available && is_db_master_or_solo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been changed.
Closing this as we're not going to automatically move backups to MySQL db_slaves as that could adversely affect many existing environments. Once we get our current back log of other Pull Requests merged and released we will be making where the backup runs configurable via an attribute in either the ey-backup or mysql cookbook. |
This fixes #218 .
Forever cron
I also think that the old code included a "race"-condition.
If
node.dna['backup_window']
was at some point positive, and then turned off, the old cronjob was never deleted.Postgresql
I also simplified the Postgresql code.
Request for comments
Let me know what you think.