Cloning web.inf

When testing updates of edweb, I’d just been manually coping the live edweb directory and the most recent mysql dump from web.inf, and then restoring them on my test machine. All fairly mechanical, so I decided to script it to make it more automatic.

The thoughts are that this will be useful for maintaining a DR copy of web.inf too. It works, but at the moment there are a couple of potential gotchas. The first is that I rsync the most recent mysql backup dump (we currently take them every 2 hours), but rsync the live/current edweb directory. So there could be a discrepancy between file changes (eg uploaded images) in the edweb dir, and any record of them in the DB which could be a couple of hours older.

This could be solved by rsyncing the corresponding regular tarball of the edweb dir that we also take every 2 hours, or by somehow running a remote ‘om mysql dump’ to generate a “now” copy of the DB. Either way there is still the possibility of the directory and mysql being slightly out of sync, as these are not atomic processes.

The other gotcha seems to be a bug in the mysql component. After doing the rsync and DB restore, I restart MySQL for good measure. The default is for the mysql component to do a mysql dump at “stop”. This seems to continue to run even after the component reports “stopped”, and if it is restarted while the dump is still running, problems ensue. My work around is to add an arbitrary sleep between the stop and start. (note that om mysql restart is also affected). This should be submitted as a bug against the mysql component.

 

Leave a Reply

Your email address will not be published. Required fields are marked *