Xtrabackup安装

本文详细介绍了在Linux环境中安装Xtrabackup的步骤,包括确认MySQL安装、下载软件、安装过程以及解决在备份过程中遇到的常见错误,如'no 'mysqld' group in MySQL options'、'cannot execute binary file'和'error while loading shared libraries'等。同时,提供了卸载Xtrabackup的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Xtrabackup安装


1、确认服务器上已经安装MySQL

[root@PC ~]# rpm -qa mysql

mysql-5.1.73-5.el6_6.x86_64mysql  Ver 14.14 Distrib 5.6.20, for Linux (i686)using  EditLine wrapper

 

2:下载

进网站:

https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.2/binary/

选择适合自己的软件和硬件(这里选择64位x86_64)。

 

[root@pc download]# wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.3.2/binary/tarball/percona-xtrabackup-2.3.2-Linux-x86_64.tar.gz

3:安装xtrabackup

[root@pc download]# tar xvf percona-xtrabackup-2.3.2-Linux-x86_64.tar.gz

cd percona-xtrabackup-2.3.2-Linux-x86_64

cp bin/innobackupex /usr/bin   

cp bin/xtrabackup* /usr/bin

4:安装相关插件

yum install perl-DBI -y
yum install perl-DBD-MySQL -y
yum install perl-Time-HiRes -y
yum install perl-IO-Socket-SSL –y

yum install perl-TermReadKey.x86_64 -y

 

wget https://www.percona.com/downloads/percona-toolkit/2.2.16/RPM/percona-toolkit-2.2.16-1.noarch.rpm

 

rpm -ivh percona-toolkit-2.2.16-1.noarch.rpm

 

Xtrabackup备份

测试Xtrabackup是否安装成功,这里做个简单的备份:

 [root@pcbin]#  innobackupex --user=root --password='beijing' /backup/mysql/xtrabackup/

 

备份时遇到的问题


1:innobackupex: fatal error: no 'mysqld' group in MySQL options

 

[root@pc /]# innobackupex --user=root --password='beijing' /backup/mysql/xtrabackup/

 

InnoDB Backup Utility v1.5.1-xtrabackup;Copyright 2003, 2009 Innobase Oy

and Percona LLC and/or its affiliates2009-2013.  All Rights Reserved.

 

This software is published under

the GNU GENERAL PUBLIC LICENSE Version 2,June 1991.

 

151116 00:32:36  innobackupex: Starting mysql withoptions:  --password=xxxxxxxx--user='root' --unbuffered --

151116 00:32:36  innobackupex: Connected to database withmysql child process (pid=4218)

151116 00:32:42  innobackupex: Connection to database serverclosed

IMPORTANT: Please check that the backup runcompletes successfully.

          At the end of a successful backup run innobackupex

          prints "completed OK!".

 

innobackupex: Using mysql  Ver 14.14 Distrib 5.6.20, for Linux (i686)using  EditLine wrapper

Warning: Using a password on the commandline interface can be insecure.

innobackupex: Using mysql server versionCopyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

 

sh: /usr/bin/xtrabackup_56: cannot executebinary file

innobackupex: fatal error: no 'mysqld'group in MySQL options

 

 

解决办法:试试下载一个高版本的Xtrabackup。

 

2:-bash: /usr/bin/innobackupex: cannot executebinary file

 

[root@pc bin]# innobackupex --user=root --password='beijing' /backup/mysql/xtrabackup/

-bash: /usr/bin/innobackupex: cannotexecute binary file

 

出错原因是没有下载适合自己机器版本的软件(查看机器多少位命令:getconf LONG_BIT)该问题得到解决参考http://askubuntu.com/questions/184280/bash-filename-cannot-execute-binary-file

 

3:innobackupex: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file ordirectory

 

 

[root@PCdandan]# innobackupex --user=root --password='system@123'  /backup/mysql/xtrabackup/

innobackupex:error while loading shared libraries: libaio.so.1: cannot open shared objectfile: No such file or directory

 

解决办法:

yum install libaio -y


4.version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock' as 'orthdoctor'  (using password: YES).
Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
Failed to connect to MySQL server: DBI connect(';mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock','orthdoctor',...) failed: Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/) at - line 1314
161110 17:07:10 Connecting to MySQL server host: localhost, user: orthdoctor, password: set, port: 3306, socket: /tmp/mysql.sock
Using server version 5.5.13-log
Error: option 'datadir' has different values:
  '.' in defaults file
  '/data/mysqldata/' in SHOW VARIABLES

解决办法:这是因为在/etc/my.cnf中mysqld下没有datadir的设置,识别不出来mysql数据在哪。则需要修改my.cnf或者是innobackupex --defaults-file=/etc/my.cnf --datadir=/data/mysqldata --user=root --password='system@123'  /backup/mysql/xtrabackup/



卸载Xtrabackup

 

[root@pc download]# cd /usr/bin

[root@pc bin]# rm -rf innobackupex

[root@pc bin]# rm -rf xtrabackup*

 

--本篇文章参考: http://www.cnblogs.com/ylqmf/archive/2011/10/27/2226958.html,

http://blog.youkuaiyun.com/yangzhawen/article/details/28864763,

http://www.51bbo.com/archives/2052

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值