MySQL Enterprise Backup 除了将消息输出到
stderr
流和日志文件之外,每次备份的进度和历史记录也会记录到备份服务器上的
mysql.backup_progress
和
mysql.backup_history
表中(要跳过更新两个表,请使用
--no-history-logging
backup 命令的选项).
backup_progress
桌子
表中的每一行都backup_progress
记录了状态更改或来自正在运行的备份作业的消息。该
backup_progress
表包含以下列:
mysql> DESCRIBE mysql.backup_progress;
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
| backup_id | bigint(20) | NO | | NULL | |
| tool_name | varchar(4096) | NO | | NULL | |
| error_code | int(11) | NO | | NULL | |
| error_message | varchar(4096) | NO | | NULL | |
| current_time | timestamp | NO | | CURRENT_TIMESTAMP | DEFAULT_GENERATED on update CURRENT_TIMESTAMP |
| current_state | varchar(200) | NO | | NULL | |
+---------------+---------------+------+-----+-------------------+-----------------------------------------------+
6 rows in set (0.00 sec)
该backup_progress
表为 CSV 格式。可以用mysql.CSV
客户端查询表,也可以用应用程序或脚本
解析对应的文件。
以下是一些使用
backup_progress
表中信息的方法:
使用该
backup_id
值查询单个备份操作的不同阶段的所有信息,并在表中找到同一备份的对应行 (该行 仅在备份完成后backup_history
写入表中)。backup_history
使用
error_code
和error_message
值跟踪已发生的任何错误,并查看备份操作是否应因任何严重错误而终止。使用
current_time
和current_state
值来跟踪操作的进度。它们还允许您测量备份的每个阶段需要多长时间,这有助于您规划未来的备份。
backup_history
桌子
表中的每一行都记录了由mysqlbackup命令backup_history
生成的一个完整备份的详细信息
。该
表包含以下列:
backup_history
mysql> DESCRIBE mysql.backup_history;
+---------------------------+---------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------------------+---------------+------+-----+---------------------+-------+
| backup_id | bigint(20) | NO | | NULL | |
| tool_name | varchar(4096) | NO | | NULL | |
| start_time | timestamp | NO | | 0000-00-00 00:00:00 | |
| end_time | timestamp | NO | | 0000-00-00 00:00:00 | |
| binlog_pos | bigint(20) | NO | | NULL | |
| binlog_file | varchar(255) | NO | | NULL | |
| compression_level | int(11) | NO | | NULL | |
| engines | varchar(100) | NO | | NULL | |
| innodb_data_file_path | varchar(2048) | NO | | NULL | |
| innodb_file_format | varchar(100) | NO | | NULL | |
| start_lsn | bigint(20) | NO | | NULL | |
| end_lsn | bigint(20) | NO | | NULL | |
| incremental_base_lsn | bigint(20) | NO | | NULL | |
| backup_type | varchar(50) | NO | | NULL | |
| backup_format | varchar(50) | NO | | NULL | |
| mysql_data_dir | varchar(2048) | NO | | NULL | |
| innodb_data_home_dir | varchar(2048) | NO | | NULL | |
| innodb_log_group_home_dir | varchar(2048) | NO | | NULL | |
| innodb_log_files_in_group | varchar(100) | NO | | NULL | |
| innodb_log_file_size | varchar(100) | NO | | NULL | |
| backup_destination | varchar(4096) | NO | | NULL | |
| lock_time | double(7,3) | NO | | NULL | |
| exit_state | varchar(10) | NO | | NULL | |
| last_error | varchar(4096) | NO | | NULL | |
| last_error_code | int(11) | NO | | NULL | |
| start_time_utc | bigint(20) | NO | | NULL | |
| end_time_utc | bigint(20) | NO | | NULL | |
| consistency_time_utc | bigint(20) | NO | | NULL | |
| meb_version | varchar(20) | NO | | 0.0.0 | |
+---------------------------+---------------+------+-----+---------------------+-------+
29 rows in set (0.00 sec)
因为成功的备份总是记录在
表中,命令阶段的
backup_history
失败
不会反映在表中。检查mysqlbackup的输出以查看操作是否完全完成而没有错误
总是很重要的
。apply-log
backup-and-apply-log
backup_history
以下是有关
backup_history
表格某些列的信息,以及使用这些信息的一些方法:
该
tool_name
列记录了触发备份的完整 mysqlbackup命令,包括使用的所有选项。You can use the
end_lsn
value of your latest backup as the starting LSN value for you next incremental backup by specifying it with the--start-lsn
option. (An alternative to specifying the start LSN value for an incremental backup is to use the--incremental-base
option).The
binlog_pos
column gives the position of the binary log up to where log events have been covered by the backup. Because thebackup_history
table used to be in the CSV format, which cannot registerNULL
values directly, if binary logging is not enabled, a value of-1
is entered into the column; the same applies to other columns for the logging ofNULL
values.的值为、、 或
backup_type
之一 。FULL
PARTIAL
INCREMENTAL
TTS
的值
backup_format
是IMAGE
(对于单文件备份)或DIRECTORY
(对于目录备份)之一。使用显示备份设置的值(例如
mysql_data_dir
、innodb_data_home_dir
和backup_destination
)确认备份使用的是正确的源目录和目标目录。的 值为
exit_state
或 。如果is 和 is ,则备份操作成功;如果不是这种情况,请参阅 和 以获取最新的操作错误。要检索该备份操作的完整错误列表,请转至该表。SUCCESS
FAILURE
exit_state
SUCCESS
last_error
'NO_ERROR'
last_error
last_error_code
backup_progress