su - root mkdir -p source/automysqlbackup cd source/automysqlbackup wget https://nchc.dl.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz tar -zxvf automysqlbackup-v3.0_rc6.tar.gz ./install.sh
: CONFIG_mysql_dump_username='root' CONFIG_mysql_dump_password='xxxx' CONFIG_mysql_dump_host='localhost' CONFIG_backup_dir='/backup/db' :
automysqlbackup /etc/automysqlbackup/myserver.conf
vi /etc/cron.daily/runmysqlbackup
#!/bin/sh /usr/local/bin/automysqlbackup /etc/automysqlbackup/myserver.conf chown root.root /var/backup/db* -R find /var/backup/db* -type f -exec chmod 400 {} \; find /var/backup/db* -type d -exec chmod 700 {} \;
chmod a+x /etc/cron.daily/runmysqlbackup service crond restart
yum install pigz
: # While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents and # binary log coordinates), no other connection should use the following statements: ALTER TABLE, CREATE TABLE, # DROP TABLE, RENAME TABLE, TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of # them on a table to be dumped can cause the SELECT that is performed by mysqldump to retrieve the table # contents to obtain incorrect contents or fail. CONFIG_mysql_dump_single_transaction='yes' # http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html#option_mysqldump_master-data :