On Mar 10, 2010, at 5:18 AM, Doug Warner wrote:

I'm not sure if puppet can be coerced to do something like this, but I wanted to throw it out there as it's a process that seems fairly easy to automate.

To create new mysql slaves my process goes something like this:

1) run innobackupex [1] on mysql master
2a) copy data from master to slave (takes a decent amount of time depending on
wire speed and database size; usually on the order of 6-24 hrs)
2b) setup mysql slave w/ data from mysql master to start replicating binary log
3) import backup using innobackupex

The problem here seems to be that I need to do things on two different hosts
and only once certain things have happened.

I figured I could easily specify the node that is the master and the slave in the manifests, but I'm not sure how far this gets me. I imagine through the creative use of exec's and "onlyif"s this should be doable, but I wanted to
get other people's experiences with automating processes like this.

Hi Doug,

I, um, don't know if this is a good idea, but this might work for you:

http://github.com/reductivelabs/puppet-external-resource

Basically, I've created a simple resource that functions as a kind of gate for exactly that situation. I've tested it in very simplistic situations, but you should consider this to be experimental code and by no means a complete solution. I just made this repo public five minutes ago and wrote it for a customer last week.

For long delays -- 12 hours -- this will likely be pretty spammy, because you'll get a lot of 'skipped because of failed dependencies' reports, and you'll likely want to run it with a timeout of 0 and verify that it works correctly in that case.

With this, your slave would have something like:

class dbslave {
external_resource { db-backup: check => "..script to verify backup is complete..." }
  db::import { mydb: ...., require => External_resource[db-backup] }
}

By default, it'll run the external resource check every 10 seconds, and if it doesn't complete within five minutes then it fails, causing all dependent resources (in this case, your import) to be skipped. You can tune both the frequency and timeout, but I haven't tested it with a timeout of 0; it might just sleep infinitely in that case.

--
There is only one success - to be able to spend your life in your own
way. -- Christopher Morley
---------------------------------------------------------------------
Luke Kanies  -|-   http://reductivelabs.com   -|-   +1(615)594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to