Xtrabackup 8.0.x關於MySQL的版本支持的淺析


 

我們知道從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

 

后面在搜索相關資料時,也看到了其他人遇到了類似問題,詳見參考資料鏈接。 

 

 

關於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.*.*的版本呢,簡單測試了一下,我安裝了一個MySQL 8.0.26,然后安裝Xtrabackup 8.0.27-19, 測試驗證它能否備份成功,看來Xtrabackup 8.0.x應該是向下兼容(當然Xtrabackup 8.0.x只能向下兼容 MySQL8.0.x的版本)

 

 

后面我搜索相關資料時,也看到了官方一則博客,它也只是簡單介紹了一下,Percona XtraBackup 8.0.12之前的版本不支持MySQL 8.0.20或以上版本的備份。因為此版本包含對 InnoDB 重做日志格式的更改,這破壞了與所有當前發布的 Percona XtraBackup 8.x 系列版本的兼容性。

 

https://www.percona.com/blog/2020/04/28/percona-xtrabackup-8-x-and-mysql-8-0-20/

 

 

 

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.*的變更太快,Percona Xtrabackup 8.0.*的版本開發有點跟不上節奏了。開源免費的產品,在版本的更新發布上肯定不如商業軟件那么高效,這也是開源軟件的一些缺陷,沒辦法的事情。

 

 

 

參考資料:

 

https://forums.percona.com/t/when-will-xtrabackup-8-0-26-18-release/11944

https://www.percona.com/doc/percona-xtrabackup/LATEST/release-notes/8.0/8.0.27-19.0.html

https://www.percona.com/doc/percona-xtrabackup/LATEST/using_xtrabackup/comparison.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM