MySQL備份與恢複之percona-xtrabackup軟體的使用

來源:互聯網
上載者:User

一 使用percona-xtrabackup的原因

在前面,我們講到MySQL冷備、熱備、mysqldump、熱拷貝、保證資料的一致性。因為mysql冷備、mysqldump、mysql熱拷貝均不能實現增量備份,在實際環境中增量備份是使用較多的,percona-xtrabackup就是為實現增量備份而生,因此我們需要使用percona-xtrabackup。

MySQL備份與恢複之真實環境使用冷備

MySQL備份與恢複之冷備

MySQL備份與恢複之熱備

MySQL 備份與恢複mysqldump 

MySQL備份與恢複之熱拷貝 

MySQL備份與恢複之保證資料一致性

本文講解percona-xtrabackup軟體的使用,下一篇文章講解percona-xtrabackup實現增量備份及恢複 。

 

二 什麼是percona-xtrabackup 

Percona XtraBackup is an open-source hot backup utility for MySQL -based servers that doesn’t lock your database during the backup.

 

It can back up data from InnoDB, XtraDB,and MyISAM tableson MySQL 5.1 [1], 5.5 and5.6 servers, as well as Percona Server with XtraDB.For a high-level overview of many of its advanced features, including a featurecomparison, please see AboutPercona Xtrabackup.

 

Whether it is a 24x7 highly loaded server or alow-transaction-volume environment, Percona XtraBackup isdesigned to make backups a seamless procedure without disrupting theperformance of the server in a production environment.Commercial support contracts areavailable.

 

Percona XtraBackup is a combination of the xtrabackup C program,and the innobackupex Perl script. The xtrabackupprogramcopies and manipulates InnoDB and XtraDB datafiles, and the Perl script enables enhanced functionality,such as interacting with a running MySQL server and backing up MyISAM tables.

 

三 軟體及文檔擷取

 

軟體擷取

http://www.percona.com/software/percona-xtrabackup/downloads

http://download.csdn.net/detail/wentasy/6638171

 

文檔擷取

http://www.percona.com/doc/percona-xtrabackup/2.1/

http://download.csdn.net/detail/wentasy/6638029

 

四 軟體使用講解

 

註:本文採用的percona-xtrabackup版本為2.0.2,作業系統版本為RHEL 6.1 Server,MySQL版本為5.1

 

第一步,準備檔案並拷貝檔案

[root@larrywen ule-mysql]# ll percona-xtrabackup-2.0.2-461.rhel6.x86_64.rpm -rwxr-xr-x. 1 root root 3786628 Sep 10 13:45 percona-xtrabackup-2.0.2-461.rhel6.x86_64.rpm[root@larrywen ule-mysql]# scp percona-xtrabackup-2.0.2-461.rhel6.x86_64.rpm 192.168.1.11:/opt

 

第二步,該軟體需要依賴MySQL用戶端,所以使用yum安裝。注意,此處安裝的只是MySQL的用戶端,和本身使用源碼安裝的MySQL不衝突

[root@serv01 opt]# yum install percona-xtrabackup-2.0.2-461.rhel6.x86_64.rpm -yInstalled:  percona-xtrabackup.x86_64 0:2.0.2-461.rhel6                                                                                         Dependency Installed:  mysql.x86_64 0:5.1.52-1.el6_0.1

 

第三步,初始化備份

[root@serv01 databackup]# innobackupex --user=root --password=123456 /databackup/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2012.  All Rights Reserved.……innobackupex: Backup created in directory '/databackup/2013-09-10_21-49-44'innobackupex: MySQL binlog position: filename 'mysql-bin.000001', position 7312130910 21:50:03  innobackupex: completed OK!

 

第四步,這樣的備份檔案無法使用,我們需要做統一檢查

[root@serv01 databackup]# lltotal 4drwxr-xr-x. 9 root root 4096 Sep 10 21:50 2013-09-10_21-49-44#做統一檢查[root@serv01 databackup]# innobackupex --apply-log /databackup/2013-09-10_21-49-44/InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oyand Percona Inc 2009-2012.  All Rights Reserved.……xtrabackup: starting shutdown with innodb_fast_shutdown = 1130910 21:51:52  InnoDB: Starting shutdown...130910 21:51:56  InnoDB: Shutdown completed; log sequence number 2098188130910 21:51:56  innobackupex: completed OK!

 

第五步,類比資料丟失

[root@serv01 databackup]# rm -rf /usr/local/mysql/data/*[root@serv01 databackup]# ll /usr/local/mysql/data/total 0

更多詳情見請繼續閱讀下一頁的精彩內容:

  • 1
  • 2
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.