顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== 安裝與設定 AutoMySQLBackup ====== * 安裝環境 : CentOS 6.9 x86_64 * 安裝版本 : automysqlbackup-v3.0_rc6 ===== 下載與安裝 ===== * <code sh> 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 </code> * 如果都採用預設值, 設定檔將會安裝至 /etc/automysqlbackup/ , 執行檔將會安裝至 /usr/local/bin/ ===== 修改與設定 ===== * 更改 /etc/automysqlbackup/myserver.conf 成為符合自己環境的設定 Exp. <file> : CONFIG_mysql_dump_username='root' CONFIG_mysql_dump_password='xxxx' CONFIG_mysql_dump_host='localhost' CONFIG_backup_dir='/backup/db' : </file> * 第一次手動執行 <code sh> automysqlbackup /etc/automysqlbackup/myserver.conf </code> * 設定每天自動執行 <code sh> vi /etc/cron.daily/runmysqlbackup </code><file> #!/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 {} \; </file><code sh> chmod a+x /etc/cron.daily/runmysqlbackup service crond restart </code> ===== 出現的警告與異常訊息解法 ===== ==== 1. WARNING: Turning off multicore support, since pigz isn't there. ==== * 安裝 pigz 來解決 <code sh> yum install pigz </code> ==== 2.mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES ==== * 參數檔內的 CONFIG_mysql_dump_single_transaction 設為'yes' 來解決 <file> : # 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 : </file> ===== 參考網址 ===== * https://sourceforge.net/projects/automysqlbackup/ * http://www.ttwen.info/article/405332 * https://www.redeo.nl/2013/11/automysqlbackup-warning-using-password-command-line-interface-can-insecure/ {{tag>類型:系統備份 狀態:已發行 mysql backup}} tech/automysqlbackup.txt 上一次變更: 2018/04/20 01:05由 Jonathan Tsai