5.7.3list backups命令

list backups [{--backupid=|-I }backup_id] [-all|-a] cluster_name

list backups [{--backupid=|-I }backup_id] [--agent|-A] site_name

如果没有该 选项,该命令将列出此 MySQL Cluster Manager 实例已知--agent的 MySQL NDB Cluster 的所有备份 。cluster_name输出包括备份和节点 ID 以及每个备份的 UTC 时间戳,如下所示:

mcm> list backups mycluster;
+----------+--------+---------+----------------------+-------+---------+
| BackupId | NodeId | Host    | Timestamp            | Parts | Comment |
+----------+--------+---------+----------------------+-------+---------+
| 1        | 1      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
| 1        | 2      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
| 2        | 1      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
| 2        | 2      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
+----------+--------+---------+----------------------+-------+---------+
4 rows in set (0.02 sec)

Timestamp列显示出现在任何备份实例文件夹中的第一个文件的时间戳(UTC)。每个备份文件集中有 3 个文件: *.ctl*.data*.log。如果备份实例文件夹为空,则显示文件夹本身的时间戳。

使用该--backupid 选项后,这些命令仅列出具有指定 ID 的备份:

mcm> list backups --backupid=2 mycluster;
+----------+--------+---------+----------------------+-------+---------+
| BackupId | NodeId | Host    | Timestamp            | Parts | Comment |
+----------+--------+---------+----------------------+-------+---------+
| 2        | 1      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
| 2        | 2      | tonfisk | 2016-10-24 22:24:54Z | 1     |         |
+----------+--------+---------+----------------------+-------+---------+
2 rows in set (0.02 sec)

该命令还为集群的 NDB 表创建元数据的备份,这些表在使用该选项时由命令 backup cluster列出。元数据备份由备份列表中 的注释标记 :list backups--allSchema

mcm> list backups --all newcluster;
+----------+--------+---------+----------------------+------+---------+
| BackupId | NodeId | Host    | Timestamp            | Part | Comment |
+----------+--------+---------+----------------------+------+---------+
| 1        | 1      | tonfisk | 2016-08-12 16:55:52Z | 1    |         |
| 1        | 2      | tonfisk | 2016-08-12 16:55:52Z | 1    |         |
| 1        | 3      | tonfisk | 2016-08-12 16:55:52Z | 1    |         |
| 1        | 4      | tonfisk | 2016-08-12 16:55:52Z | 1    |         |
| 1        | 50     | tonfisk | 2016-08-12 16:55:55Z |      | Schema  |
+----------+--------+---------+----------------------+------+---------+
5 rows in set (0.02 sec)

有关元数据备份的详细信息,请参阅导航台表元数据的逻辑备份。

使用该--agent 选项并site_name指定 a 时,该命令会列出为特定站点创建的代理备份:

mcm> list backups --agent mysite;
+------------+-------+---------+----------------------+-------+--------------+
| BackupId   | Agent | Host    | Timestamp            | Files | Comment      |
+------------+-------+---------+----------------------+-------+--------------+
| 1522914101 | 0     | tonfisk | 2018-04-05 07:41:41Z | 5     | Agent backup |
| 1522914105 | 0     | tonfisk | 2018-04-05 07:41:45Z | 5     | Agent backup |
| 1522914121 | 0     | tonfisk | 2018-04-05 07:42:01Z | 5     | Agent backup |
+------------+-------+---------+----------------------+-------+--------------+
3 rows in set (0.00 sec)

备份 ID 反映了进行备份时的 Unix Epoch 时间。

可以使用以下 --backupid选项过滤输出:

mcm> list backups --agent --backupid=1522914121 mysite;
+------------+-------+---------+----------------------+-------+--------------+
| BackupId   | Agent | Host    | Timestamp            | Files | Comment      |
+------------+-------+---------+----------------------+-------+--------------+
| 1522914121 | 0     | tonfisk | 2018-04-05 07:42:01Z | 5     | Agent backup |
+------------+-------+---------+----------------------+-------+--------------+
1 row in set (0.07 sec)