{"id":145808,"date":"2019-05-31T08:20:56","date_gmt":"2019-05-31T00:20:56","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=145808"},"modified":"2019-05-24T09:26:03","modified_gmt":"2019-05-24T01:26:03","slug":"mysql-design-xtrabackup","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/mysql-design-xtrabackup.html","title":{"rendered":"MySQL5.5\u5907\u4efd\u8bbe\u8ba1\u4e4bXtraBackup"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u57fa\u4e8e\u4f01\u4e1a\u73af\u5883\u7684MySQL5.5\u5907\u4efd\u8bbe\u8ba1\uff0c\u9996\u5148\u5b89\u88c5innobackupex\uff0c\u7f51\u4e0a\u6709\u5f88\u591a\u8d44\u6599\uff0c\u53ef\u81ea\u884c\u641c\u7d22\uff0c\u53ef\u81ea\u884c\u5728https:\/\/www.percona.com\/downloads\/XtraBackup\/LATEST\/ \u5bfb\u627e\u5305\u8d44\u6e90<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1.\u5b89\u88c5<\/strong><\/div>\n
\r\nwget  https:\/\/www.percona.com\/downloads\/XtraBackup\/Percona-XtraBackup-2.4.9\/binary\/debian\/trusty\/x86_64\/Percona-XtraBackup-2.4.9-ra467167cdd4-trusty-x86_64-bundle.tar\r\n\r\ntar -xvf  Percona-XtraBackup-2.4.9-ra467167cdd4-trusty-x86_64-bundle.tar\r\n\r\ndpkg -i *.deb\r\n\r\napt-get install  -f\r\n<\/pre>\n
2.\u589e\u52a0\u811a\u672c<\/strong><\/div>\n

\u5b89\u88c5\u5b8c\u6210\u80fd\u770b\u5230\u7cfb\u7edf\u6709innobackupex \u547d\u4ee4\u5373\u53ef<\/p>\n

\u81ea\u52a8\u6bcf\u5929\u5168\u5907\u811a\u672c\uff1aall_backup.sh<\/p>\n

\r\n#!\/bin\/bash\r\nbasedir=\"\/data\/innobackupex\/$(date \"+%y%m%d\")\" ;\r\nsudo innobackupex --defaults-file=\/etc\/mysql\/my.cnf --user=root --password='xxxx'  $basedir   &>> \"\/data\/innobackupex\/$(date \"+%y%m%d\").log\"\r\n<\/pre>\n

\u81ea\u52a8\u6bcf\u5c0f\u65f6\u589e\u5907\u811a\u672c\uff1aadd_backup.sh<\/p>\n

\r\n#!\/bin\/bash\r\nbasedir=\"\/data\/innobackupex\/$(date \"+%y%m%d\")\" ;\r\nadd_basedir=\"$basedir\/`ls $basedir|tail -n1`\";\r\nsudo innobackupex  --defaults-file=\/etc\/mysql\/my.cnf  --user=root --password='xxxxx' --incremental-basedir=\"$add_basedir\" --incremental $basedir  &>> \"$basedir\/$(date \"+%y%m%d%H%M\").log\" ;\r\n<\/pre>\n
3.\u4e3a\u811a\u672c\u521b\u5efa\u76f8\u5e94\u7684\u5b9a\u65f6\u4efb\u52a1<\/strong><\/div>\n
\r\n5 0 * * * sudo \/bin\/bash \/data\/innobackupex\/all_backup.sh     #\u6bcf\u5929\u96f6\u70b95\u5206\u5168\u5907\r\n55 * * * * sudo \/bin\/bash \/data\/innobackupex\/add_backup.sh    #\u6bcf\u4e2a\u5c0f\u65f6\u768455\u5206\u8fdb\u884c\u4e00\u6b21\u589e\u5907\r\n<\/pre>\n

\u540e\u7eed\u8fd8\u9700\u8981\u4e00\u4e9b\u81ea\u52a8\u6e05\u7406\u7a7a\u95f4\u7684\u811a\u672c<\/p>\n

4.\u6548\u679c\u5c55\u793a<\/strong><\/div>\n
\r\nroot@xx:\/data\/innobackupex# pwd\r\n\/data\/innobackupex\r\nroot@xx:\/data\/innobackupex# ls\r\n181115  181115.log  add_backup.sh  all_backup.sh\r\n\r\nroot@xx:\/data\/innobackupex\/181115# pwd \r\n\/data\/innobackupex\/181115\r\nroot@xx:\/data\/innobackupex\/181115# ls\r\n1811151113.log  1811151255.log  1811151455.log       2018-11-15_11-08-39  2018-11-15_11-13-07  2018-11-15_12-55-02  2018-11-15_14-55-01\r\n1811151155.log  1811151355.log  2018-11-15_11-05-33  2018-11-15_11-11-14  2018-11-15_11-55-01  2018-11-15_13-55-01\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

wget https:\/\/www.percona.com\/downloads\/XtraBackup\/Perco […]<\/p>\n","protected":false},"author":63,"featured_media":145809,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-145808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/145808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=145808"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/145808\/revisions"}],"predecessor-version":[{"id":145897,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/145808\/revisions\/145897"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/145809"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=145808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=145808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=145808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}