问题描述:使用mariabackup对maridb10.6.4进行物理备份,进行增量恢复的时候报错。截止到目前,还是mariadb的一个bug,还没有修复。在增备的过程中如果出现新库的建立,数据库就会在相应的物理路径上创建文件夹。所以在恢复合并备份的过程中需要创建新库的文件夹,在全备的文件夹上,否则就会合并增量失败。
--备份报错
[root@mariadb ~]# mariabackup --prepare --target-dir=/backup/2022-11-15 --incremental-dir=/backup/2022-11-15_incr1 mariabackup based on MariaDB server 10.6.4-MariaDB Linux (x86_64) [00] 2022-11-15 19:33:37 incremental backup from 48452 is enabled. [00] 2022-11-15 19:33:37 cd to /backup/2022-11-15/ [00] 2022-11-15 19:33:37 open files limit requested 0, set to 1024 [00] 2022-11-15 19:33:37 Renaming /backup/2022-11-15_incr1//incr1/t1.new to ./incr1/t1.ibd mariabackup: Error on rename of '/backup/2022-11-15_incr1//incr1/t1.new' to './incr1/t1.ibd' (errno: 20 "Not a directory") [00] FATAL ERROR: 2022-11-15 19:33:37 Can't rename /backup/2022-11-15_incr1//incr1/t1.new to ./incr1/t1.ibd errno 2 [root@mariadb ~]# mariabackup --prepare --target-dir=/backup/2022-11-15 --incremental-dir=/backup/2022-11-15_incr2 mariabackup based on MariaDB server 10.6.4-MariaDB Linux (x86_64) [00] 2022-11-15 19:33:41 incremental backup from 48452 is enabled. [00] 2022-11-15 19:33:41 cd to /backup/2022-11-15/ [00] 2022-11-15 19:33:41 open files limit requested 0, set to 1024 [00] 2022-11-15 19:33:41 Renaming /backup/2022-11-15_incr2//incr1/t1.new to ./incr1/t1.ibd mariabackup: Error on rename of '/backup/2022-11-15_incr2//incr1/t1.new' to './incr1/t1.ibd' (errno: 20 "Not a directory") [00] FATAL ERROR: 2022-11-15 19:33:41 Can't rename /backup/2022-11-15_incr2//incr1/t1.new to ./incr1/t1.ibd errno 2 [root@mariadb ~]#
相关链接:https://jira.mariadb.org/browse/MDEV-26884
解决方法:
--增备语句
mariabackup --defaults-file=/etc/my.cnf --user=root --password=123 --socket=/tmp/mysql.sock --backup --target-dir=/backup/2022-11-15_incr1 --incremental-basedir=/backup/2022-11-15 mariabackup --defaults-file=/etc/my.cnf --user=root --password=123 --socket=/tmp/mysql.sock --backup --target-dir=/backup/2022-11-15_incr2 --incremental-basedir=/backup/2022-11-15_incr1 --全备整理
mariabackup --prepare --target-dir=/backup/2022-11-15
--增备整理 mariabackup --prepare --target-dir=/backup/2022-11-15 --incremental-dir=/backup/2022-11-15_incr1 mariabackup --prepare --target-dir=/backup/2022-11-15 --incremental-dir=/backup/2022-11-15_incr2 --恢复 mariabackup --copy-back --target-dir=/backup/2022-11-15
--备份文件
[root@mariadb /]# ll /backup/ total 0 drwx------. 8 root root 273 Nov 15 19:39 2022-11-15 drwx------. 7 root root 265 Nov 15 19:39 2022-11-15_incr1 drwx------. 8 root root 278 Nov 15 19:39 2022-11-15_incr2
标签:11,15,incr1,prepare,--,failed,step,2022,backup From: https://www.cnblogs.com/houzhiheng/p/16893666.html