我們知道從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
掃描上面二維碼關注我
如果你真心覺得文章寫得不錯,而且對你有所幫助,那就不妨幫忙“推薦"一下,您的“推薦”和”打賞“將是我最大的寫作動力!
本文著作權歸作者所有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連接.
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/425004.html
標籤:其他
上一篇:快取和資料庫一致性問題
下一篇:快取和資料庫一致性問題
