David Giragosian wrote:
So, Question 1 is: does mysqldump's connection to the slave db exist
for the
entire script execution time, or just for the length of time of its own
execution? I imagine if I used mysql_connect() in the script that it
would
be for the entire length of the script execution, but mysqldump makes its
own connection, so I'm just not sure about this.
Running mysqldump (an external program), the connection will only exist
while mysqldump is running. PHP's connections and that of external
programs are mostly unrelated. Besides, your problem isn't the
connection, it's the locking that you're worried about. You can pass
options to mysqldump to tell it to do as little locking as possible.
That's what I do, considering that running mysqldump on a live database
doesn't give you a totally up-to-date snapshot anyway. (I.e. as soon as
you take a snapshot with mysqldump, it's out of date the instant there's
another insert/update.)
Question 2: Should I, just to be on the safe side, break out the
mysqldump
code into its own scipt, and run it, say, 30 minutes before the tar
script?
I don't think it matters. See above. I put my sql dump scripts into
simple bash scripts that run from cron, but if you're more comfortable
with PHP, I don't see any reason to switch nor to break it out.
jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php