如何通过标签查找minio对象?

问题描述 投票:0回答:3

我正在使用minio

mc
客户端。可以使用
mc find
命令来查找 minio 文件或对象。但我找不到如何按标签查找或过滤文件。有什么想法吗?

NAME:
  mc find - search for objects

USAGE:
  mc find PATH [FLAGS]

FLAGS:
  --exec value                  spawn an external process for each matching object (see FORMAT)
  --ignore value                exclude objects matching the wildcard pattern
  --name value                  find object names matching wildcard pattern
  --newer-than value            match all objects newer than L days, M hours and N minutes
  --older-than value            match all objects older than L days, M hours and N minutes
  --path value                  match directory names matching wildcard pattern
  --print value                 print in custom format to STDOUT (see FORMAT)
  --regex value                 match directory and object name with PCRE regex pattern
  --larger value                match all objects larger than specified size in units (see UNITS)
  --smaller value               match all objects smaller than specified size in units (see UNITS)
  --maxdepth value              limit directory navigation to specified depth (default: 0)
  --watch                       monitor a specified path for newly created object(s)
  --config-dir value, -C value  path to configuration folder (default: "/Users/kolisko/.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
  

NAME:
  mc - MinIO Client for cloud storage and filesystems.

USAGE:
  mc [FLAGS] COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]

COMMANDS:
  alias      set, remove and list aliases in configuration file
  ls         list buckets and objects
  mb         make a bucket
  rb         remove a bucket
  cp         copy objects
  mirror     synchronize object(s) to a remote site
  cat        display object contents
  head       display first 'n' lines of an object
  pipe       stream STDIN to an object
  share      generate URL for temporary access to an object
  find       search for objects
  sql        run sql queries on objects
  stat       show object metadata
  mv         move objects
  tree       list buckets and objects in a tree format
  du         summarize disk usage recursively
  retention  set retention for object(s)
  legalhold  manage legal hold for object(s)
  diff       list differences in object name, size, and date between two buckets
  rm         remove objects
  version    manage bucket versioning
  ilm        manage bucket lifecycle
  encrypt    manage bucket encryption config
  event      manage object notifications
  watch      listen for object notification events
  undo       undo PUT/DELETE operations
  anonymous  manage anonymous access to buckets and objects
  tag        manage tags for bucket and object(s)
  replicate  configure server side bucket replication
  admin      manage MinIO servers
  update     update mc to latest release

tags minio
3个回答
1
投票

S3 的 ListObject API 不返回对象标签,因此您不能使用

mc find
来查询标签。相反,您必须使用
GetObjectTagging
S3 API 来获取对象的标签。

GET /{Key+}?tagging&versionId=VersionId HTTP/1.1
Host: Bucket.s3.amazonaws.com
x-amz-expected-bucket-owner: ExpectedBucketOwner
x-amz-request-payer: RequestPaye

0
投票

在 MinIO 客户端中您可以使用以下命令: mc find --tags="tag=value" AliasMinIOName/BucketName/

例如: 我的 MinIO 别名是 myminio 我的存储桶名称是示例 我的标签键,标签值是key1=value1

最后: mc find --tags="key1=value1" myminio/sample/

列出示例存储桶中具有 key1=value1 标签的所有对象。


0
投票

--标签

可选 mc 版本新增:RELEASE.2023-04-12T02-21-51Z

仅适用于 MinIO 部署。

返回带有与指定 RE2 RegEx 模式匹配的标签的对象。使用格式 --tag="KEY=regexValue"。

您可以传递带有空值的键。在这种情况下, mc 查找匹配项 没有元数据键或元数据键值为空的对象。

您可以多次使用该标志来匹配附加标签的对象。要返回,对象必须具有所有标签的匹配值。

© www.soinside.com 2019 - 2024. All rights reserved.