一、先决条件说明
- xtrabackup 版本
[root@db ~]# xtrabackup --version
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql
xtrabackup version 8.0.11 based on MySQL server 8.0.18 Linux (x86_64) (revision id: 486c270)
- MySQL 版本
[root@db ~]# /data/mysql/base/8.0.21/bin/mysql -S /data/mysql/data/3306/mysqld.sock -Ne "select @@version"
+--------+
| 8.0.21 |
+--------+
二、开始备份
[root@db ~]# xtrabackup --defaults-file=/data/mysql/conf/3306/my.cnf --backup --target-dir=/backup/full --user=wsp --password=123456. --host=127.0.0.1 --port=3306
xtrabackup: recognized server arguments: --server-id=1605005099 --datadir=/data/mysql/data/3306 --log_bin=/data/mysql/log/binlog/3306/mysql-bin --tmpdir=/data/mysql/tmp/3306 --innodb_log_group_home_dir=/data/mysql/log/redolog/3306 --innodb_buffer_pool_size=2048M --innodb_data_file_path=ibdata1:1G:autoextend --innodb_file_per_table=1 --innodb_flush_log_at_trx_commit=1 --innodb_flush_method=O_DIRECT --innodb_io_capacity=1000 --innodb_log_buffer_size=64M --innodb_log_file_size=2G --innodb_log_files_in_group=2 --innodb_max_dirty_pages_pct=60 --innodb_read_io_threads=8 --innodb_write_io_threads=8 --open_files_limit=65535
xtrabackup: recognized client arguments: --backup=1 --target-dir=/backup/full --user=wsp --password=* --host=127.0.0.1 --port=3306
xtrabackup version 8.0.11 based on MySQL server 8.0.18 Linux (x86_64) (revision id: 486c270)
201110 10:55:48 version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;host=127.0.0.1;port=3306' as 'wsp' (using password: YES).
201110 10:55:48 version_check Connected to MySQL server
201110 10:55:48 version_check Executing a version check against the server...
201110 10:55:48 version_check Done.
201110 10:55:48 Connecting to MySQL server host: 127.0.0.1, user: wsp, password: set, port: 3306, socket: not set
Using server version 8.0.21
xtrabackup: uses posix_fadvise().
xtrabackup: cd to /data/mysql/data/3306
xtrabackup: open files limit requested 65535, set to 65535
xtrabackup: using the following InnoDB configuration:
xtrabackup: innodb_data_home_dir = .
xtrabackup: innodb_data_file_path = ibdata1:1G:autoextend
xtrabackup: innodb_log_group_home_dir = /data/mysql/log/redolog/3306
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 2147483648
xtrabackup: using O_DIRECT
Number of pools: 1
201110 10:55:48 Connecting to MySQL server host: 127.0.0.1, user: wsp, password: set, port: 3306, socket: not set
xtrabackup: Redo Log Archiving is not set up.
Unknown redo log format (4). Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/ upgrading-downgrading.html.
xtrabackup: Error: recv_find_max_checkpoint() failed.
注意错误: Unknown redo log format (4). Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/ upgrading-downgrading.html.
- 大家应该都知道 xtrabackup 备份时需要开一个子进程持续备份 MySQL 的 redo log 重做日志。那现在的状态是 xtrabackup 识别不了 8.0.21 版本的 redo log 重做日志,必然也是会备份失败退出的。
三、MySQL 官方说明
- https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-20.html
- MySQL redo log 格式变更原因:https://github.com/mysql/mysql-server/commit/3ee5f8b1f262c3014a4e6f267216869098ef151e
InnoDB: Redo log records for modifications to undo tablespaces increased in size in MySQL 8.0 due to a change in undo tablespace ID values, which required additional bytes. The change in redo log record size caused a performance regression in workloads with heavy write I/O. To address this issue, the redo log format was modified to reduce redo log record size for modifications to undo tablespaces. (Bug #29536710)
- 大概意思是在 8.0 版本里,由于 undo 表空间有一些变化,需要额外的字段存储数据,undo 表空间大小增加了,然后 redo log 大小也有变化,但导致了大量写 I/O 是性能下降,所以对 redo log 重做日志格式进行了修改。
四、Percona 官方说明
-
Percona博客:https://www.percona.com/blog/2020/04/28/percona-xtrabackup-8-x-and-mysql-8-0-20/
-
Percona官方网站:https://www.percona.com/doc/percona-xtrabackup/8.0/index.html
-
https://www.percona.com/doc/percona-xtrabackup/LATEST/release-notes/8.0/8.0.12.html
-
Percona Jira工单:https://jira.percona.com/browse/PXB-2162
Due to changes in MySQL 8.0.20 released by Oracle at the end of April 2020, Percona XtraBackup 8.0, up to version 8.0.11, is not compatible with MySQL version 8.0.20 or higher, or Percona products that are based on it: Percona Server for MySQL and Percona XtraDB Cluster.
- 有道翻译:由于Oracle在2020年4月底发布的MySQL 8.0.20中的更改, Percona XtraBackup 8.0(最高版本8.0.11)与MySQL 8.0.20或更高版本或基于该版本的Percona产品不兼容:适用于MySQL和Percona XtraDB群集的Percona服务器。
五、解决方法
- 更新 xtrabckup 版本到 8.0.12 ,因为 xtrabackup 8.0.12 版本就兼容 MySQL 8.0.20 版本的 redo 日志格式变更的问题了。