mysql xtrabackup在windows平臺的備份測試
Xtrabackup有2款主要工具:xtrabackup和innobackupex
xtrabackup只能備份和恢復innodb,而且只備份.ibd檔案,.frm檔案它不管,恢復時DBA要自己提供
innobackupex能備份和恢復MyISAM檔案及.frm檔案,並且對xtrabackup作了友好的封裝,所以可用它進行全庫備份
windows 64位平臺下載地址:
下載完解壓縮到C盤xtrabackup目錄下,發現共有4個檔案,xtrabackup.exe是可執行檔案:
C:\xtrabackup>dir
驅動器 C 中的卷是 Windows8_OS
卷的序列號是 0E54-579B
C:\xtrabackup 的目錄
2016/06/03 09:42 .
2016/06/03 09:42 ..
2009/12/08 14:37 6,656 cat.exe
2003/10/23 17:35 135,680 grep.exe
2011/04/21 15:23 90,876 innobackupex.pl
2011/04/20 11:39 4,863,488 xtrabackup.exe
這裡我們用xtrabackup命令進行innodb全庫備份測試:
xtrabackup命令的用法:
Usage: [C:\xtrabackup\xtrabackup [--defaults-file=#] --backup | C:\xtrabackup\xtrabackup [--defaults-file=#] --prepare] [OPTIONS]
建立innodb測試庫:
mysql> create database duansf;
Query OK, 1 row affected (0.17 sec)
mysql> use duansf
Database changed
mysql>
mysql>
mysql>
mysql>
mysql> create table dsf(id int);
Query OK, 0 rows affected (0.37 sec)
mysql> insert into dsf values(1);
Query OK, 1 row affected (0.11 sec)
mysql> insert into dsf values(2);
Query OK, 1 row affected (0.14 sec)
mysql> insert into dsf values(3);
Query OK, 1 row affected (0.06 sec)
mysql> insert into dsf values(4);
Query OK, 1 row affected (0.17 sec)
mysql> insert into dsf values(5);
Query OK, 1 row affected (0.09 sec)
mysql> select * from dsf;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.03 sec)
mysql>
檢視資料檔案所在目錄:
mysql> show variables like 'datadir';
+---------------+---------------------------------------------+
| Variable_name | Value |
+---------------+---------------------------------------------+
| datadir | C:\ProgramData\MySQL\MySQL Server 5.5\Data\ |
+---------------+---------------------------------------------+
1 row in set (0.00 sec)
mysql>
完全備份:
C:\xtrabackup\xtrabackup --target-dir=C:\xtrabackup\full --backup --datadir="C:\ProgramData\MySQL\MySQL Server 5.5\Data\"
c:\xtrabackup>C:\xtrabackup\xtrabackup --target-dir=C:\xtrabackup\full --backup
--datadir="C:\ProgramData\MySQL\MySQL Server 5.5\Data\duansf"
C:\xtrabackup\xtrabackup Ver undefined Rev undefined for 5.5.9 Win64 (x86)
xtrabackup: cd to C:\ProgramData\MySQL\MySQL Server 5.5\Data\duansf
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = .\
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = .\
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 5242880
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
160603 10:32:56 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
xtrabackup: Something wrong with source files...
發現有報錯,後來研究了一下,把C:\Program Files (x86)\MySQL\MySQL Server 5.5\my.ini複製到c:\xtrabackup目錄下再執行以下命令後測試透過:
c:\xtrabackup>xtrabackup.exe --defaults-file=C:\xtrabackup\my.ini --backup --target-dir=C:\xtrabackup\full
xtrabackup.exe Ver undefined Rev undefined for 5.5.9 Win64 (x86)
xtrabackup: cd to C:/ProgramData/MySQL/MySQL Server 5.5/Data/
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = .\
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = .\
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 118489088
>> log scanned up to (1625547)
[01] Copying .\ibdata1
to C:\xtrabackup\full/ibdata1
[01] ...done
xtrabackup: The latest check point (for incremental): '1625547'
xtrabackup: Stopping log copying thread..>> log scanned up to (1625547)
xtrabackup: Transaction log of lsn (1625547) to (1625547) was copied.
注意:如果重複執行xtrabackup命令執行備份就會報錯,我猜測這可能是由於xtrabackup在windows平臺只是個測試版,沒有釋出正式版,因此
生產環境還是慎用windows平臺版本。
xtrabackup只能備份和恢復innodb,而且只備份.ibd檔案,.frm檔案它不管,恢復時DBA要自己提供
innobackupex能備份和恢復MyISAM檔案及.frm檔案,並且對xtrabackup作了友好的封裝,所以可用它進行全庫備份
windows 64位平臺下載地址:
下載完解壓縮到C盤xtrabackup目錄下,發現共有4個檔案,xtrabackup.exe是可執行檔案:
C:\xtrabackup>dir
驅動器 C 中的卷是 Windows8_OS
卷的序列號是 0E54-579B
C:\xtrabackup 的目錄
2016/06/03 09:42 .
2016/06/03 09:42 ..
2009/12/08 14:37 6,656 cat.exe
2003/10/23 17:35 135,680 grep.exe
2011/04/21 15:23 90,876 innobackupex.pl
2011/04/20 11:39 4,863,488 xtrabackup.exe
這裡我們用xtrabackup命令進行innodb全庫備份測試:
xtrabackup命令的用法:
Usage: [C:\xtrabackup\xtrabackup [--defaults-file=#] --backup | C:\xtrabackup\xtrabackup [--defaults-file=#] --prepare] [OPTIONS]
建立innodb測試庫:
mysql> create database duansf;
Query OK, 1 row affected (0.17 sec)
mysql> use duansf
Database changed
mysql>
mysql>
mysql>
mysql>
mysql> create table dsf(id int);
Query OK, 0 rows affected (0.37 sec)
mysql> insert into dsf values(1);
Query OK, 1 row affected (0.11 sec)
mysql> insert into dsf values(2);
Query OK, 1 row affected (0.14 sec)
mysql> insert into dsf values(3);
Query OK, 1 row affected (0.06 sec)
mysql> insert into dsf values(4);
Query OK, 1 row affected (0.17 sec)
mysql> insert into dsf values(5);
Query OK, 1 row affected (0.09 sec)
mysql> select * from dsf;
+------+
| id |
+------+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+------+
5 rows in set (0.03 sec)
mysql>
檢視資料檔案所在目錄:
mysql> show variables like 'datadir';
+---------------+---------------------------------------------+
| Variable_name | Value |
+---------------+---------------------------------------------+
| datadir | C:\ProgramData\MySQL\MySQL Server 5.5\Data\ |
+---------------+---------------------------------------------+
1 row in set (0.00 sec)
mysql>
完全備份:
C:\xtrabackup\xtrabackup --target-dir=C:\xtrabackup\full --backup --datadir="C:\ProgramData\MySQL\MySQL Server 5.5\Data\"
c:\xtrabackup>C:\xtrabackup\xtrabackup --target-dir=C:\xtrabackup\full --backup
--datadir="C:\ProgramData\MySQL\MySQL Server 5.5\Data\duansf"
C:\xtrabackup\xtrabackup Ver undefined Rev undefined for 5.5.9 Win64 (x86)
xtrabackup: cd to C:\ProgramData\MySQL\MySQL Server 5.5\Data\duansf
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = .\
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = .\
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 5242880
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
160603 10:32:56 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
xtrabackup: Something wrong with source files...
發現有報錯,後來研究了一下,把C:\Program Files (x86)\MySQL\MySQL Server 5.5\my.ini複製到c:\xtrabackup目錄下再執行以下命令後測試透過:
c:\xtrabackup>xtrabackup.exe --defaults-file=C:\xtrabackup\my.ini --backup --target-dir=C:\xtrabackup\full
xtrabackup.exe Ver undefined Rev undefined for 5.5.9 Win64 (x86)
xtrabackup: cd to C:/ProgramData/MySQL/MySQL Server 5.5/Data/
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = .\
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = .\
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 118489088
>> log scanned up to (1625547)
[01] Copying .\ibdata1
to C:\xtrabackup\full/ibdata1
[01] ...done
xtrabackup: The latest check point (for incremental): '1625547'
xtrabackup: Stopping log copying thread..>> log scanned up to (1625547)
xtrabackup: Transaction log of lsn (1625547) to (1625547) was copied.
注意:如果重複執行xtrabackup命令執行備份就會報錯,我猜測這可能是由於xtrabackup在windows平臺只是個測試版,沒有釋出正式版,因此
生產環境還是慎用windows平臺版本。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2113337/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL:xtrabackup備份MySql
- 使用Xtrabackup遠端備份MysqlMySql
- 【MySQL】xtrabackup 2.4.12備份觸發的bugMySql
- xtrabackup備份mysql“ib_logfile0 is ofMySql
- MySQL Backup--Xtrabackup備份限速問題MySql
- 【MySQL】Xtrabackup備份及恢復指令碼MySql指令碼
- Xtrabackup增量備份
- MySQL備份與恢復——基於Xtrabackup物理備份恢復MySql
- 【Xtrabackup】Xtrabackup備份基礎知識
- 【Xtrabackup】Xtrabackup全備、增量備份及恢復示例
- Xtrabackup全量備份
- MySQL運維實戰之備份和恢復(8.1)xtrabackup全量備份MySql運維
- xtrabackup備份mysql以及建立自動定時任務MySql
- 從原始碼分析 XtraBackup 的備份原理原始碼
- 基於percona xtrabackup 2.4.14的增量備份恢復還原mysql 5.6MySql
- 記一次mysql熱備份xtrabackup(沒有解決問題)MySql
- xtrabackup 8 備份 Mysql 8.0.18 (全備全過程)身臨其境無腦版MySql
- windows/linux自動備份mysql並刪除7天前的備份WindowsLinuxMySql
- 如何對xtrabackup 備份限制使用IO大小
- 故障分析 | DDL 導致的 Xtrabackup 備份失敗
- MySQL:Windows下分庫備份指令碼MySqlWindows指令碼
- 使用Xtrabackup完整備份中恢復單表
- mysql的冷備份與熱備份MySql
- 阿里面試官:知道 MySQL 邏輯備份與恢復測試麼?阿里面試MySql
- 測試平臺之介面測試
- 測試平臺起航
- golang在windows平臺使用zmqGolangWindowsMQ
- 關於測試平臺的搭建 (我們要不要搭建測試平臺)
- RMAN備份與恢復測試
- 新潮測試平臺之效能測試
- 終於解決了《====》記一次mysql熱備份xtrabackup(沒有解決問題)MySql
- 聊聊效能測試平臺
- RestCloud測試平臺,支援壓力測試RESTCloud
- Windows平臺下MySQL常用操作與命令WindowsMySql
- 簡單的mysqldump備份(windows)MySqlWindows
- MySQL的冷備份和熱備份概念理解(轉)MySql
- Java備份MySQLJavaMySql
- Mysql備份系列MySql
- Windows備份工具——FreeFileSyncWindows