mysqlbackup将重要的进度和错误信息写入stderr
流中。这些信息对于跟踪操作过程中发生的问题通常非常有价值。从 MySQL Enterprise Backup 3.9 开始,stderr
流的输出也默认保存到日志文件中(对于大多数
mysqlbackup操作),以便在任何调试过程中都可以轻松访问错误信息。
消息记录的工作方式类似于类 Unix 系统上的tee进程,其中程序的输出被拆分以显示并保存到文件中。这样生成的日志文件以以下格式命名:
,其中是运行的
mysqlbackup操作(例如,
、
等),
是运行该操作的日期和时间。以下是日志文件名称的一些示例:
MEB_
timestamp
_operation
.logoperation
backup
apply-log
timestamp
MEB_2013-06-24.16-32-43_backup.log
MEB_2013-06-28.11-07-18_apply_log.log
MEB_2013-06-29.10-08-06_list_image.log
以下选项控制消息记录功能:
跳过消息记录。日志记录默认开启(
list-image
和validate
操作除外,详见--messages-logdir
选项说明),通过该选项关闭。-
命令行格式 --messages-logdir=PATH
类型 目录名称 默认值 backup_dir/meta
指定用于存储消息日志的现有目录的路径名。如果指定的目录不存在,则消息记录失败并返回一条错误消息。省略该选项时,使用默认目录
,其中backup_dir
/metabackup_dir
是该--backup-dir
选项指定的目录。笔记Use this option to turn on message logging for the
list-image
andvalidate
operations. Message logging is turned off by default for the two operations, because they do not modify any files and a message log is usually not required for debugging them. And because the default path name ofbackup_dir/meta
is not meaningful for the two operations, this option is required for both turning on message logging and for supplying the path name of a directory in which to save the log file. However, if the--skip-messages-logdir
option is also specified, it takes precedence and message logging is skipped.
The following are some examples showing how the message logging is controlled.
This creates a log file for the
backup
operation in the directory
/home/backup_dir/meta
due to the default
settings:
mysqlbackup -uroot --port=3306 --backup-dir=/home/backup_dir backup
This skips message logging for the
backup
operation:
mysqlbackup -uroot --port=3306 --backup-dir=/home/backup_dir \
--skip-messages-logdir backup
This creates a log file for the
apply-log
operation in an existing
directory named /home/teelog_dir
, rather
than the default location:
mysqlbackup -uroot --port=3306 --backup-dir=/home/backup_dir \
--messages-logdir=/home/teelog_dir apply-log
This creates a log file for the
list-image
operation in an existing
directory named /home/teelog_dir
:
mysqlbackup -uroot --port=3306 --backup-image=/backup/my.mbi \
--messages-logdir=/home/teelog_dir list-image