Xtrabackup 8.0.x关于MySQL的版本支持浅析

数据库 MySQL
看来MySQL 8.0.x的变更太快,Percona Xtrabackup 8.0.x的版本开发有点跟不上节奏了。开源免费的产品,在版本的更新发布上肯定不如商业软件那么高效,这也是开源软件的一些缺陷,没办法的事情。

本文转载自微信公众号「DBA闲思杂想录」,作者潇湘隐者 。转载本文请联系DBA闲思杂想录公众号。

我们知道从MySQL 8.0.x开始,我们必须用Percona Xtrabackup 8.0.x来备份,之前的Percona XtraBackup 2.4已经不支持MySQL 8.x的备份了。而且Percona Xtrabackup 8.0.x也不支持备份之前的MySQL 5.6/MySQL 5.7了。但是我们对Percona Xtrabackup的具体版本支持哪一些MySQL版本了解甚少,而且官方文档也没有很详细的介绍资料。

下面来看一个案例,最近安装了一个MySQL环境,MySQL版本为最新的MySQL 8.0.28版本,Percona XtraBackup版本也是下载最新的8.0.27-19版本。

MySQL版本:8.0.28 MySQL Community Server - GPL Xtrabackup版本:8.0.27-19

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.28 |
+-----------+
1 row in set (0.00 sec)
mysql>
$ xtrabackup --version
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql
xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda)

使用Percona Xtrabackup 8.0.27备份MySQL 8.0.28的时报错,如下所示:

xtrabackup: recognized server arguments: --datadir=/data/mysql/data --tmpdir=/data/mysql/mysql_temp --innodb_buffer_pool_size=8G  --server-id=1 --log_bin=/data/mysql/bin_logs/mysql_binlog
xtrabackup: recognized client arguments: --port=3306 --socket=/tmp/mysql.sock --user=bkuser --password=* --host=127.0.0.1 --port=3306 --backup=1 --target-dir=/mysql_backup/db_backup/backup_cycle_2022_02_06/full_backup_2022_02_12_08_57_02
/usr/bin/xtrabackup version 8.0.27-19 based on MySQL server 8.0.27 Linux (x86_64) (revision id: 50dbc8dadda)
220212 08:58:02 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=127.0.0.1;port=3306;mysql_socket=/tmp/mysql.sock' as 'bkuser' (using password: YES).
220212 08:58:02 version_check Connected to MySQL server
220212 08:58:02 version_check Executing a version check against the server...
220212 08:58:02 version_check Done.
220212 08:58:02 Connecting to MySQL server host: 127.0.0.1, user: bkuser, password: set, port: 3306, socket: /tmp/mysql.sock
Error: Unsupported server version 8.0.28.
Please upgrade PXB, if a new version is available. To continue with risk, use the option --no-server-version-check.

提示当前的Percona Xtrabackup(8.0.27-19)不支持MySQL 8.0.28. 但是当前时间节点(2022-02-11),Percona官方网址,Xtrabackup最新版本为percona-xtrabackup-80-8.0.27-19.1.el7.x86_64.rpm。而MySQL的官方最新版本为MySQL 8.0.28。看了一下发布日期,MySQL 8.0.28是Sep 28, 2021发布的。而percona-xtrabackup 8.0.27是February 2, 2022才发布的。也就是说目前官方还没有发布percona-xtrabackup 8.0.28

不过,根据官方文档,Percona XtraBackup 8.0.21 开始,新增了--no-server-version-check 参数。此参数控制是否将源系统版本与 Percona XtraBackup 版本进行比较。

 --no-server-version-check
This option allows backup to proceed when the server
version is greater (newer) than the PXB supported version

关于这个参数,搜索了一下官方资料,具体介绍如下所示

Percona XtraBackup 8.0.21 adds the --no-server-version-check parameter. This parameter compares the source system version to the Percona XtraBackup version.
The parameter checks for the following scenarios:
• The source system and the PXB version are the same, the backup proceeds
• The source system is less than the PXB version, the backup proceeds
• The source system is greater than the PXB version, and the parameter is not overridden, the backup is stopped and returns an error message
• The source system is greater than the PXB version, and the parameter is overridden, the backup proceeds

Explicitly adding the --no-server-version-check parameter, like the example, overrides the parameter and the backup proceeds.
$ xtrabackup --backup --no-server-version-check --target-dir=$mysql/backup1


When you override the parameter, the following events can happen:
• Backup fails
• Creates a corrupted backup
• Backup successful

该参数检查以下场景:

  • 源系统和PXB版本一样,备份继续
  • 源系统低于PXB版本,备份继续
  • 源系统大于PXB版本,且参数未被覆盖,停止备份并返回错误信息
  • 源系统大于PXB版本,参数被覆盖,备份继续

所以我们如果使用参数--no-server-version-check备份的话,可能可以备份成功。也可能备份失败,还有可能创建了一个损坏的备份。

xtrabackup --defaults-file=/data/mysql/my.cnf --login-path=dbbackup --backup --no-server-version-check --target-dir=/mysql_backup/db_backup

后面在搜索相关资料时,也看到了其他人遇到了类似问题,详见链接:When will xtrabackup-8.0.26-18 release[1]

关于Percona Xtrabackup 8.0.x的版本支持与限制,其实之前也是很少去了解这方面的内容,而Percona官方也没有详细的资料介绍,那么Xtrabackup 8.0.x是否能向下兼容支持呢 ?

例如 Xtrabackup 8.0.27-19 是否支持备份 MySQL 8.0.26 或MySQL 8.0.26之下的MySQL 8.x.x的版本呢,简单测试了一下,我安装了一个MySQL 8.0.26,然后安装Xtrabackup 8.0.27-19, 测试验证它能否备份成功,看来Xtrabackup 8.0.x应该是向下兼容(当然Xtrabackup 8.0.x只能向下兼容 MySQL 8.0.x的版本)

后面我搜索相关资料时,也看到了官方一则博客,它也只是简单介绍了一下,Percona XtraBackup 8.0.12之前的版本不支持MySQL 8.0.20或以上版本的备份。因为此版本包含对 InnoDB 重做日志格式的更改,这破坏了与所有当前发布的 Percona XtraBackup 8.x 系列版本的兼容性。详见Percona XtraBackup 8.x and MySQL 8.0.20[2]

Update: Percona XtraBackup 8.0.12 now supports backup and restore processing for versions of MySQL 8.x; previous versions of Percona XtraBackup will not work with MySQL 8.0.20 and higher. More information

On Monday, April 27, 2020, Oracle released the highly anticipated 8.0.20 version of the MySQL database server. This release contains changes to the InnoDB redo log format which breaks compatibility with all currently released versions of the Percona XtraBackup 8.x series. At this time, there are no known workarounds that will allow any version of Percona XtraBackup 8.x to function properly with MySQL 8.0.20. We have identified the specific cause of the issue and diligently working towards a new release that will safely solve this issue as soon as possible. Thank you for your patience.

看来MySQL 8.0.x的变更太快,Percona Xtrabackup 8.0.x的版本开发有点跟不上节奏了。开源免费的产品,在版本的更新发布上肯定不如商业软件那么高效,这也是开源软件的一些缺陷,没办法的事情。

参考资料

[1]When will xtrabackup-8.0.26-18 release: https://forums.percona.com/t/when-will-xtrabackup-8-0-26-18-release/11944

[2]Percona XtraBackup 8.x and MySQL 8.0.20: https://www.percona.com/blog/2020/04/28/percona-xtrabackup-8-x-and-mysql-8-0-20/

责任编辑:武晓燕 来源: DBA闲思杂想录
相关推荐

2022-01-25 09:58:21

IPython 8.代码命令行

2023-01-27 20:59:19

行锁表锁查询

2018-04-26 16:15:02

数据库MySQLMySQL 8.0

2009-11-27 13:43:21

MyEclipse 8Struts 2

2021-01-15 11:21:33

UbuntuPHP命令

2023-10-13 07:23:06

2010-01-14 08:48:29

Apache

2018-08-20 16:00:23

MySQL并发控制MVCC

2010-09-09 16:28:19

2013-08-08 10:09:22

ApacheTomcatJavaEE 7

2017-07-06 15:12:48

MySQLgtid特性数据恢复

2010-05-24 13:22:37

Swap空间

2009-04-21 11:31:45

MySQLRH5Linux

2019-02-25 06:46:59

iOS 工具 操作系统

2023-10-16 15:05:05

Ardour 8.0

2023-01-11 08:05:23

XtraBackupMySQL备份

2021-06-03 19:13:06

MySQLJson数据

2024-02-26 07:39:16

2014-06-18 10:37:12

综合布线

2009-09-11 10:44:07

JavaScript实
点赞
收藏

51CTO技术栈公众号