Xtrabackup and MySQL 5.6 on Amazon instance   Recently updated !

加入dbDao.com Oracle技术学习QQ群:171092051

 

如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!

诗檀软件专业数据库修复团队

服务热线 : 400-690-3643 备用电话: 13764045638 邮箱:service@parnassusdata.com

 

Have you ever tried to install Xtrabackup on Amazon EC2 instance with Oracle’s MySQL 5.6? Dependencies hell strikes when you ask pretty common and reasonable thing – run the GA version of MySQL and backup it with the most popular open-source tool – XtraBackup. From this post you will learn how to resolve the conflicts and make everybody happy.

mysql55-libs conflicts with mysql-community-libs-5.6.22

A fresh Amazon Linux AMI, 2014.09 EC2 instance comes with MySQL 5.5.40 in amzn-updates repository. Today MySQL 5.5 turns five years old. It’s a good and stable version. But many people want to run MySQL 5.6, because it’s better than 5.5, it supports full-text indexes and Oracle ends support of 5.5 this year.

Oracle distributes MySQL releases via YUM repository. Installing MySQL from the YUM repository is a good idea because YUM takes care of dependencies (what an irony, the post is about dependencies conflict) and getting new releases as simple as yum update.

So, there is EC2 instance with Amazon Linux and MySQL 5.6

# rpm -qa | grep mysql
mysql-community-client-5.6.22-2.el6.x86_64
mysql-community-release-el6-5.noarch
mysql-community-server-5.6.22-2.el6.x86_64
mysql-community-common-5.6.22-2.el6.x86_64
mysql-community-libs-5.6.22-2.el6.x86_64

We need to backup the database. Xtrabackup is the most popular open-source tool. Percona also distributes their packages via YUM repository. Let’s install Xtrbackup with YUM:

# yum -y install percona-xtrabackup
Loaded plugins: priorities, update-motd, upgrade-helper
6 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package percona-xtrabackup.x86_64 0:2.2.7-5050.el6 will be installed
--> Processing Dependency: perl(DBD::mysql) for package: percona-xtrabackup-2.2.7-5050.el6.x86_64
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-5.17.amzn1 will be installed
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.023-5.17.amzn1.x86_64
--> Running transaction check
---> Package mysql55-libs.x86_64 0:5.5.40-1.3.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
==============================================================================================================================================================
 Package                                 Arch                        Version                                Repository                                   Size
==============================================================================================================================================================
Installing:
 percona-xtrabackup                      x86_64                      2.2.7-5050.el6                         percona-release-x86_64                      4.6 M
Installing for dependencies:
 mysql55-libs                            x86_64                      5.5.40-1.3.amzn1                       amzn-updates                                813 k
 perl-DBD-MySQL                          x86_64                      4.023-5.17.amzn1                       amzn-main                                   148 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total size: 5.6 M
Total download size: 148 k
Installed size: 24 M
Downloading packages:
perl-DBD-MySQL-4.023-5.17.amzn1.x86_64.rpm                                                                                             | 148 kB     00:00
Running transaction check
Running transaction test


Transaction check error:
  file /usr/lib64/mysql/libmysqlclient.so.18 from install of mysql55-libs-5.5.40-1.3.amzn1.x86_64 conflicts with file from package mysql-community-libs-5.6.22-2.el6.x86_64

Error Summary
-------------

Bummer! The conflict happens because yum wants to install file /usr/lib64/mysql/libmysqlclient.so.18 from package mysql55-libs-5.5.40-1.3.amzn1.x86_64, but the file is already installed from package mysql-community-libs-5.6.22-2.el6.x86_64.

What’s wrong here? Why can’t yum use libmysqlclient.so.18 from mysql-community-libs-5.6.22 ? Let’s have a closer look.
Xtrabackup depends on perl-DBD-MySQL which depends on two virtual packages:

# yum deplist perl-DBD-MySQL | grep depend
...
  dependency: libmysqlclient.so.18()(64bit)
  dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit)
...

Let’s see what mysql-community-libs-5.6.22 provides:

# rpm -qp --provides /var/cache/yum/x86_64/latest/mysql56-community/packages/mysql-community-libs-5.6.22-2.el6.x86_64.rpm
...
libmysqlclient.so.18()(64bit)
libmysqlclient.so.18(libmysqlclient_18)(64bit)

Now it’s clear why yum can’t use mysql-community-libs-5.6.22 for perl-DBD-MySQL – it doesn’t provide libmysqlclient.so.18(libmysqlclient_16)(64bit).

mysql55-libs.x86_64 however does provide both libmysqlclient.so.18(libmysqlclient_16)(64bit) and libmysqlclient.so.18()(64bit):

# yum deplist perl-DBD-MySQL
...
  dependency: libmysqlclient.so.18()(64bit)
   provider: mysql55-libs.x86_64 5.5.40-1.3.amzn1
   provider: mysql-community-libs.x86_64 5.6.22-2.el6
...
  dependency: libmysqlclient.so.18(libmysqlclient_16)(64bit)
   provider: mysql55-libs.x86_64 5.5.40-1.3.amzn1
...

Thus YUM picks up mysql55-libs.x86_64, but fails to install it because file /usr/lib64/mysql/libmysqlclient.so.18 is already installed by other package.

Resolving dependency conflict

Understanding the problem is a half of the solution. But how to resolve the conflict anyway?

No Oracle package provides libmysqlclient.so.18(libmysqlclient_16)(64bit). In fact, the mix of symbol versions libmysqlclient_16 and libmysqlclient_18 existed for short time in MySQL 5.5. Several OS vendors including Amazon distributed libraries with the mix of symbol versions.

The dependencies of a package are auto-generated unless you disable it with “AutoReqProv: no“. So an rpm package requires a library that was used to build it.

I took step back and used MySQL 5.1 library to rebuild perl-DBD-MySQL. When the new perl-DBD-MySQL is installed YUM will pick up either mysql51-libs.x86_64 or mysql-community-libs-compat.x86_64.

To build perl-DBD-MySQL with MySQL 5.1 library install mysql51-libs.x86_64 on a clean instance. You’d also need mysql51-devel.x86_64, gcc, rpm-build and may be some other packages.

Get a source rpm of perl-DBD-MySQL and rebuild it:

# rpmbuild -ba perl-DBD-MySQL.spec

It builds package perl-DBD-MySQL-4.029-1.amzn1.x86_64.rpm with MySQL 5.1 libraries:

# rpm -qp --requires perl-DBD-MySQL-4.029-1.amzn1.x86_64.rpm

...

libmysqlclient.so.16()(64bit)
libmysqlclient.so.16(libmysqlclient_16)(64bit)

Several packages provide MySQL 5.1 libraries:

# yum provides "libmysqlclient.so.16()(64bit)"

...

mysql-community-libs-compat-5.6.22-2.el6.x86_64 : Shared compat libraries for
...: MySQL 5.1.72 database client applications
Repo        : mysql56-community
Matched from:
Provides    : libmysqlclient.so.16()(64bit)

...

mysql51-libs-5.1.73-3.69.amzn1.x86_64 : The shared libraries required for MySQL
: clients
Repo        : @amzn-main
Matched from:
Provides    : libmysqlclient.so.16()(64bit)

None of them conflicts with any installed version of MySQL server: 5.1, 5.5 or 5.6.

twittergoogle_plusby feather

The post Xtrabackup and MySQL 5.6 on Amazon instance   Recently updated ! appeared first on Backup and Data Recovery for MySQL.


PlanetMySQL Voting: Vote UP / Vote DOWN

关注dbDao.com的新浪微博

扫码关注dbDao.com 微信公众号:

关注dbDao.com的新浪微博

扫码加入微信Oracle小密圈,了解Oracle最新技术下载分享资源

TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569