mc undo

mc undo 命令用来撤消 PUT/DELETE 操作,语法如下:

C:\>mc undo -h
NAME:
  mc undo - undo PUT/DELETE operations

USAGE:
  mc undo [FLAGS] SOURCE [SOURCE...]

FLAGS:
  --recursive, -r               undo last S3 put/delete operations
  --force                       force recursive operation
  --last value                  undo N last changes (default: 1)
  --dry-run                     fake an undo operation
  --config-dir value, -C value  path to configuration folder (default: "C:\\Users\\Administrator\\mc")
  --quiet, -q                   disable progress bar display
  --no-color                    disable color theme
  --json                        enable JSON lines formatted output
  --debug                       enable debug output
  --insecure                    disable SSL certificate verification
  --help, -h                    show help

示例

(1)撤消最近 1 次上传和/或删除特定对象

# 上传一个文件到本地 MinIO
D:\server\minio>mc cp ping.txt local/images
ping.txt:           443 B / 443 B [==========================================================] 19.98 KiB/s 0s

# 查看上传的文件信息
D:\server\minio>mc ls local/images/ping.txt
[2021-07-17 08:08:44 CST]   443B ping.txt

# 尝试回滚操作,报错了,提示该命令只支持启用了 S3 版本控制的存储桶
D:\server\minio>mc undo local/images/ping.txt --last 1
mc: <ERROR> Undo command works only with S3 versioned-enabled buckets.

# 尝试去开启 images 存储桶的版本支持,提示功能没有实现,尴尬了
# 可能因为我这里是本地 MinIO 的原因吧,还没搞明白,可以试试注册 S3 MinIO 服务
D:\server\minio>mc version enable local/images
mc: <ERROR> Unable to enable versioning. A header you provided implies functionality that is not implemented.

注意:如果存储桶没有启用 S3 版本控制,执行上面命令将抛出“mc: <ERROR> Undo command works only with S3 versioned-enabled buckets.”错误。

(2)撤消对前缀下所有对象的最后一次上传/删除更改

C:\> mc undo --recursive --force s3/backups/prefix/
说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号