Dump MySQL databases and/or archive a directory and puts them in Amazon S3.
-
Install s3cmd (do only once)
wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add - sudo wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list sudo apt-get update && sudo apt-get install s3cmd
-
Configure s3cmd (do only once)
s3cmd --configure
-
Download script
cd /usr/local/bin wget https://raw.githubusercontent.com/creads/mysqldump2amazon-s3/master/mysqldump2amazon-s3.sh chmod +x mysqldump2amazon-s3.sh
-
Create mysql user
mysql -u root -p CREATE USER 'backup'@'localhost'; GRANT SELECT, LOCK TABLES ON *.* TO 'backup'@'localhost' IDENTIFIED BY '***'; FLUSH PRIVILEGES; exit;
-
Edit script config
nano mysqldump2amazon-s3.sh
-
Execute
./mysqldump2amazon-s3.sh
Optionaly edit your crontab
crontab -e
0 3 * * * sh /usr/local/bin/mysqldump2amazon-s3.sh
-
Install s3cmd (do only once)
wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add - sudo wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list sudo apt-get update && sudo apt-get install s3cmd
-
Configure s3cmd (do only once)
s3cmd --configure
-
Download script
cd /usr/local/bin wget https://raw.githubusercontent.com/creads/mysqldump2amazon-s3/master/filedump2amazon-s3.sh chmod +x filedump2amazon-s3.sh
-
Edit script config
nano filedump2amazon-s3.sh
-
Execute
./filedump2amazon-s3.sh
Optionaly edit your crontab
crontab -e
0 3 * * * sh /usr/local/bin/filedump2amazon-s3.sh