This is a quick backup script that you can run at the command line.
>
php backupdbs.php USER PASSWORD DATABASEPREFIX
It will dump all your database into one dump and compress it.
I use this on slaves. so it turns of the slave so you can get a consistent backup. Then turns it back on.
$PullCustomer="SHOW DATABASES LIKE 'mysiteinc%'";
$CsResults = mysql_query($PullCustomer,$dbconnection) or die("$PullCustomer Not valid order number please check your url.");
while(list($database) = mysql_fetch_row($CsResults)){
This is a quick backup script that you can run at the command line.
>
php backupdbs.php USER PASSWORD DATABASEPREFIX
It will dump all your database into one dump and compress it.
I use this on slaves. so it turns of the slave so you can get a consistent backup. Then turns it back on.
$PullCustomer="SHOW DATABASES LIKE 'mysiteinc%'";
$CsResults = mysql_query($PullCustomer,$dbconnection) or die("$PullCustomer Not valid order number please check your url.");
while(list($database) = mysql_fetch_row($CsResults)){
6593 pointsLike some sort of WPMU DEV GodExceptionally helpfulLifetime member
Keeper of the Dark Chocolate
—
2nd December 2010 (1 year ago)
#
Thanks.
As I read this and I;ve got to admit that I;m real tired, this is done via php. Gotta admit that I would not be doing such a script via php. Many installs have an upper file sized limit of say 2 megs or so. Seen way too many databases that top out over that size.
Having said that though, our optimize script is php so I guess I shouldn;t throw stones. :)
this is executed from the shell. It doesn't really use any ram as it just executes some shell commands.
I have used a similiar script with 30GB backups every day.
In order to get a consistent backup I stop the slave and get it's position in the binary log file.
Then I dump all the data with the log filename info and position in the filename.
Upon finish I start the slave again.
This way I don't have to take down a live machine or worry about data inconsistency in the backup.
I also tar gzip or rar the file usually those backups compress down to 2gb every day.
Responses (2)
Keeper of the Dark Chocolate — 2nd December 2010 (1 year ago) #
Thanks.
As I read this and I;ve got to admit that I;m real tired, this is done via php. Gotta admit that I would not be doing such a script via php. Many installs have an upper file sized limit of say 2 megs or so. Seen way too many databases that top out over that size.
Having said that though, our optimize script is php so I guess I shouldn;t throw stones. :)
Member — 27th December 2010 (1 year ago) #
this is executed from the shell. It doesn't really use any ram as it just executes some shell commands.
I have used a similiar script with 30GB backups every day.
In order to get a consistent backup I stop the slave and get it's position in the binary log file.
Then I dump all the data with the log filename info and position in the filename.
Upon finish I start the slave again.
This way I don't have to take down a live machine or worry about data inconsistency in the backup.
I also tar gzip or rar the file usually those backups compress down to 2gb every day.
Become a member