5.7.4delete backup命令

delete backup {--backupid=|-I }backup_id [--skip-nodeid=nodeid-list] cluster_name

nodeid-list:
    nodeid[, nodeid[, ...]]

对于 MySQL Cluster Manager 8.0.28 及更高版本:该命令删除备份的目录及其在名为的集群的 数据节点和mysqldcluster_name节点上的内容:

mcm> list backups mycluster;
+----------+--------+---------+----------------------+-------+---------+
| BackupId | NodeId | Host    | Timestamp            | Parts | Comment |
+----------+--------+---------+----------------------+-------+---------+
| 1        | 1      | flundra | 2018-04-04 06:31:12Z | 1     |         |
| 1        | 2      | tonfish | 2018-04-04 06:31:12Z | 1     |         |
+----------+--------+---------+----------------------+-------+---------+
2 rows in set (0.04 sec)

mcm> delete backup --backupid=1 mycluster;
+-----------------------------+
| Command result              |
+-----------------------------+
| Backup deleted successfully |
+-----------------------------+
1 row in set (1.22 sec)

mcm> list backups mycluster;
+----------+--------+---------+----------------------+-------+------------------+
| BackupId | NodeId | Host    | Timestamp            | Parts | Comment          |
+----------+--------+---------+----------------------+-------+------------------+
| None     | 2      | tonfish |                      |       | No backups found |
| None     | 1      | flundra |                      |       | No backups found |
+----------+--------+---------+----------------------+-------+------------------+
2 rows in set (0.09 sec)

必须使用该 --backupid选项指定要删除的备份 ID。要删除所有备份,请对每个备份运行该命令。

如果在创建指定备份后添加了 任何数据节点或mysqld--skip-nodeid节点,请使用 选项列出它们的节点 ID,否则操作将失败并抱怨这些节点上不存在备份目录。

笔记

如果要删除的备份目录中有备份文件以外的文件,则命令失败。在运行命令之前手动删除这些额外的文件。