由于線上環境資料庫特别大,隻能采取 xtrabackup備份還原
特點:
(1)備份過程快速、可靠;
(2)備份過程不會打斷正在執行的事務;
(3)能夠基于壓縮等功能節約磁盤空間和流量;
(4)自動實作備份檢驗;
(5)還原速度快;
innobackupex --defaults-file=/etc/my.cnf --user=root -password='root' --database=root -socket=/var//mysql/mysql.sock /root/bakmysql
一直顯示報錯資訊
innobackupex: Waiting for ibbackup (pid=1004) to suspend
innobackupex: Suspend file '/root/bakmysql/2015-12-01_17-06-01/xtrabackup_suspended_2'
libgcc_s.so.1 must be installed for pthread_cancel to work
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 2703
main::wait_for_ibbackup_file_create('/root/bakmysql/2015-12-01_17-06-01/xtrabackup_suspended_2') called at /usr/bin/innobackupex line 2723
main::wait_for_ibbackup_suspend('/root/bakmysql/2015-12-01_17-06-01/xtrabackup_suspended_2') called at /usr/bin/innobackupex line 1976
main::backup() called at /usr/bin/innobackupex line 1601
innobackupex: Error: The xtrabackup child process has died at /usr/bin/innobackupex line 2703.
原來發現庫沒安裝
解決方法:yum install libgcc.i686
第二個報錯還原時候出現
151201 18:51:26 innobackupex: Starting the apply-log operation
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!".
innobackupex:: Warning: Ignored unrecognized line 2 in options : 'xtrabackup: Error: Please set parameter 'datadir'
'
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 4511
main::get_option('innodb_data_file_path') called at /usr/bin/innobackupex line 2623
main::apply_log() called at /usr/bin/innobackupex line 1570
innobackupex: Error: no 'mysqld' group in server configuration file '/etc/my.cnf' at /usr/bin/innobackupex line 4511.
[root@ bakmysql]# rpm -ivh percona-xtrabackup-2.2.12-1.el6.x86_64.rpm
warning: percona-xtrabackup-2.2.12-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
file /usr/bin/innobackupex from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/bin/xbcrypt from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/bin/xbstream from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/bin/xtrabackup from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/share/man/man1/innobackupex.1.gz from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/share/man/man1/xbcrypt.1.gz from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/share/man/man1/xbstream.1.gz from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
file /usr/share/man/man1/xtrabackup.1.gz from install of percona-xtrabackup-2.2.12-1.el6.x86_64 conflicts with file from package percona-xtrabackup-2.2.10-1.el6.x86_64
[root@ bakmysql]# yum remove percona-xtrabackup-2.2.10-1.el6.x86_64
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup.x86_64 0:2.2.10-1.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================
Package Arch Version Repository Size
======================================================================================================================
Removing:
percona-xtrabackup x86_64 2.2.10-1.el6 installed 21 M
Transaction Summary
======================================================================================================================
Remove 1 Package(s)
Installed size: 21 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : percona-xtrabackup-2.2.10-1.el6.x86_64 1/1
Verifying : percona-xtrabackup-2.2.10-1.el6.x86_64 1/1
Removed:
percona-xtrabackup.x86_64 0:2.2.10-1.el6
Complete!
[root@ bakmysql]# rpm -ivh percona-xtrabackup-2.2.12-1.el6.x86_64.rpm
warning: percona-xtrabackup-2.2.12-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-xtrabackup ########################################### [100%]
[root@ bakmysql]#
[root@ mysqlbak]# innobackupex --user=root --password='root' --defaults-file=/etc/my.cnf --apply-log /root/ROOT/2015-12-01_19-23-53
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
151201 20:02:34 innobackupex: Starting the apply-log operation
IMPORTANT: Please check that the apply-log run completes successfully.
At the end of a successful apply-log run innobackupex
prints "completed OK!".
innobackupex:: Warning: Ignored unrecognized line 2 in options : 'xtrabackup: Error: Please set parameter 'datadir'
'
innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 4511
main::get_option('innodb_data_file_path') called at /usr/bin/innobackupex line 2623
main::apply_log() called at /usr/bin/innobackupex line 1570
innobackupex: Error: no 'mysqld' group in server configuration file '/etc/my.cnf' at /usr/bin/innobackupex line 4511.
[root@ data]# mv mysql mysql1
[root@ data]# mkdir mysql
[root@ data]# innobackupex --user=root --password='root' --defaults-file=/etc/my.cnf --copy-back /root/ROOT/2015-12-01_19-23-53
InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
and Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.
This software is published under
the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
Get the latest version of Percona XtraBackup, documentation, and help resources:
http://www.percona.com/xb/p
151201 20:16:38 innobackupex: Starting the copy-back operation
IMPORTANT: Please check that the copy-back run completes successfully.
At the end of a successful copy-back run innobackupex
prints "completed OK!".
innobackupex: Starting to copy files in '/root/ROOT/2015-12-01_19-23-53'
innobackupex: back to original data directory '/data/mysql'
innobackupex: Copying '/root/ROOT/2015-12-01_19-23-53/xtrabackup_info' to '/data/mysql/xtrabackup_info'
'/data/mysql/wash/ws_user.frm'
innobackupex: Copying '/root/ROOT/2015-12-01_19-23-53/wash/ws_order_file.frm' to '/data/mysql/wash/ws_order_file.frm'
innobackupex: Copying '/root/ROOT/2015-12-01_19-23-53/wash/ws_beautician_time.frm' to '/data/mysql/wash/ws_beautician_time.frm'
innobackupex: Copying '/root/ROOT/2015-12-01_19-23-53/wash/db.opt' to '/data/mysql/wash/db.opt'
'/data/mysql/mysql/procs_priv.MYD'
innobackupex: Copying '/root/ROOT/2015-12-01_19-23-53/mysql/user.frm' to '/data/mysql/mysql/user.frm'
'/data/mysql/ib_logfile1'
innobackupex: Finished copying back files.
151201 20:16:38 innobackupex: completed OK!
完成