如何将一个对象从一个桶移动到另一个桶?

yas*_*dev 3 minio

我在 Minio 中存储了大量对象。我需要将它们从一个桶移到另一个桶。由于对象数量很大(以及对象本身的大小),我不想将它们上传到内存中。

到目前为止,我发现的唯一方法是将对象复制到目标存储桶并将它们从源存储桶中删除。

有没有一种方法可以用一个命令来移动它们(例如mv)?

小智 5

自 2020 年 4 月起,minio 客户端实用程序确实支持移动功能:

$ mc mv -h
NAME:
  mc mv - move objects

USAGE:
  mc mv [FLAGS] SOURCE [SOURCE...] TARGET

FLAGS:
  --recursive, -r                    move recursively
  --older-than value                 move objects older than L days, M hours and N minutes
  --newer-than value                 move objects newer than L days, M hours and N minutes
  --storage-class value, --sc value  set storage class for new object(s) on target
  --encrypt value                    encrypt/decrypt objects (using server-side encryption with server managed keys)
  --attr value                       add custom metadata for the object
  --continue, -c                     create or resume move session
  --preserve, -a                     preserve filesystem attributes (mode, ownership, timestamps)
  --disable-multipart                disable multipart upload feature
  --encrypt-key value                encrypt/decrypt objects (using server-side encryption with customer provided keys)
  --config-dir value, -C value       path to configuration folder (default: "/Users/prerok/.mc")
  --quiet, -q                        disable progress bar display
  --no-color                         disable color theme
  --json                             enable JSON formatted output
  --debug                            enable debug output
  --insecure                         disable SSL certificate verification
  --help, -h                         show help
Run Code Online (Sandbox Code Playgroud)

S3 API 不支持移动功能,因此 mc 实用程序实际上首先执行复制,然后删除对象。来源: https: //github.com/minio/mc/blob/133dd1f7da237a91dc291cbf8f3a5ad66fffc425/cmd/mv-main.go#L363