On Tue, October 3, 2006 9:29 am, 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?

exec() runs its own little mini-not-quite-shell, so as soon as it
ends, the connection would, almost-for-sure, be dead, even if
mysqldump itself didn't close it, which, almost-for-sure it does.

You could write another cron job to send that one query to mysql to
show the open connections...  Or am I thinking PostgreSQL?...  Well,
MySQL probably has it too anyway...

Run that 20 minutes into the other script, and see if the mysqldump
connection looks open, if you can detect that sort of thing...

> 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?

The problem with the "disjoint" is what if mysqldump doesn't work for
whatever reason?

Then you tar up the wrong thing, and pretend it's "OK"?

Gotta plan this out, if it matters.

You are *probably* fine, but it's better to check on your own system
than to just take whatever some goof like me says on a mailing list.

It should not be too hard to test it reliably to be 100% sure.



Another option to consider:
Set up a whole 'nother slave, and then do your dump and backup from THAT.
So you really don't CARE if you manage to screw it up, in terms of
your failure-is-not-an-option stream of incoming data to the master.

Your backup is at slightly higher risk of failing.

You have some "timing" issues of maybe losing a few more
transactions/inserts/whatever.

But reducing risk to the master and its input stream is drastic, so
probably worth considering.


I understand it's common to also set up an extra slave JUST for
reporting, so your Marketing guys can't bring down the whole system
just because they want to play "what happened" and "what if" games by
generating a cross-indexed report of every field in every table... :-)

This is definitely straying into the area of things you really would
better find covered on the MySQL mailing list/forum/whatever.


PS
[re-arranged original post, sorry]
> 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.

You could always use mysql_connect and then mysql_close() to manage a
connection, but that would not be the fast way to get a dump in the
first place, so is kind of moot.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to