Schedule Mysql Backups to Amazon S3 in Windows server 2008 R2

1 – Access Amazon Services, S3
2 – Create a New Bucket if there’s no one.
3 – Create credentials in  IAM Amazon Services
4 – Download the tool s3.exe for windows, from s3.codeplex.com

5 – Create batch files for “mysqldump” and  “s3.exe

MySqlDump.bat sample:

echo Running dump...
"C:\Program Files (x86)\MySQL\bin\mysqldump" --add-drop-table -uroot -pmyrootpasswd --result-file="C:\backup\_SQLDump\myDB_%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%_%TIME:~0,2%h%TIME:~3,2%.sql" mydbname
echo ok!

S3Put.bat sample:

s3 auth myKey mySecret
s3 put mybucketname C:\backup\_SQLDump\myDB_*.sql /sync

6 – Schedule tasks for batch files, first   MySqlDump.bat then  S3Put.bat

at \\mySevername 02:00 /every:M,T,W,Th,F,S,Su "C:\backup\MySqlDump.bat"
at \\mySevername 06:00 /every:M,T,W,Th,F,S,Su "C:\backup\S3Put.bat"

ok, it’s done 😉

s3.exe Documentation:  http://s3.codeplex.com/documentation
How To Use the AT Command to Schedule Tasks:  http://support.microsoft.com/kb/313565

Author: Carlos Galhano

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *