RSS

Tag Archives: S3

Backup mysql database to amazon S3

Below is the simple code to create sql script of database on Amazon EC2 server using “mysqldump”…

then upload this sql script to Amazon S3 bucket using command line S3 tool “s3cmd”…

<?php

$sqlbackup=”/usr/bin/mysqldump -v -u root -h localhost -r /var/www/html/backup/”.date(“Y-m-d-H-i-s”).”_db.sql -pdbusername  databasename 2>&1″;

exec($sqlbackup, $o);
echo implode(“<br /> “, $o);

$file = “/var/www/html/backup/”.date(“Y-m-d-H-i-s”).”_db.sql”;
$bucket = “s3bucketname”;

exec(“/usr/bin/s3cmd  put –acl-public –guess-mime-type  –config=/var/www/html/.s3cfg   “.$file.”  s3://”.$bucket.”  2>&1″, $o);

echo implode(“<br /> “, $o);

?>


Lunarpages.com Web Hosting

 

Tags: , , , , , , , , , , , , , ,

Amazon S3

http://www.lalit.org/lab/setting-cache-headers-files-in-amazon-s3

http://www.s3browse.com

www.bucketexplorer.com

 
2 Comments

Posted by on November 7, 2008 in Uncategorized

 

Tags: , , , ,