由于线上环境数据库特别大,只能采取 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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
[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!
完成
本文转自 cs312779641 51CTO博客,原文链接:http://blog.51cto.com/chenhao6/1718587