innobackupex 使用--tables-file报 xtrabackup: `mysql.user...` name is too long 错误

mac2025-04-20  3

最近使用innobackupex这个备份工具,使用了--tables-file参数,原命令如下:

/usr/bin/innobackupex --no-timestamp --user='xxx' --password='xxxx' --rsync --compress --compress-threads=5 --compress-chunk-size=64K --slave-info --tables-file=/data/deploy/mysql_backup/tables.txt /data/deploy/mysql_backup/backup_dir/full

报错:

IMPORTANT: Please check that the backup run completes successfully.            At the end of a successful backup run innobackupex            prints "completed OK!". 191101 11:26:49  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/var/run/mysqld/mysqld.sock' as 'bkpuser'  (using password: YES). 191101 11:26:49  version_check Connected to MySQL server 191101 11:26:49  version_check Executing a version check against the server... 191101 11:26:49  version_check Done. 191101 11:26:49 Connecting to MySQL server host: localhost, user: bkpuser, password: set, port: 3306, socket: /var/run/mysqld/mysqld.sock Using server version 5.6.44-86.0-log /usr/bin/innobackupex version 2.3.10 based on MySQL server 5.6.24 Linux (x86_64) (revision id: bd0d4403f36) xtrabackup: uses posix_fadvise(). xtrabackup: cd to /data/mysqldb xtrabackup: open files limit requested 0, set to 655350 xtrabackup: using the following InnoDB configuration: xtrabackup:   innodb_data_home_dir = ./ xtrabackup:   innodb_data_file_path = ibdata1:100M:autoextend xtrabackup:   innodb_log_group_home_dir = /data/mysqldb/ xtrabackup:   innodb_log_files_in_group = 3 xtrabackup:   innodb_log_file_size = 268435456 xtrabackup: using O_DIRECT xtrabackup: `mysql.user...` name is too long

 

发现mysql.user表长度,字段长度并无异常,且是mysql自动维护的表,不应该会有错误。

于是检查/data/deploy/mysql_backup/tables.txt文件,发现也并无异常,每行一个表。

经过测试发现每次都是最后一行的表名提示报错。于是查看 xtrabackup 源码:

发现xtrabackup工具对于每一行都会去查找“\n”, 即使是最后一行,也要求末尾有"\n",否则指定 --tables-file 参数就会报错。

于是在 生成的tables.txt内容最后一行添加"\n", 测试问题解决。

最新回复(0)