minio命令行详解

客户端命令–mc

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

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

COMMANDS:
  alias      manage server credentials in configuration file
  ls         list buckets and objects
  mb         make a bucket
  rb         remove a bucket
  cp         copy objects
  mv         move objects
  rm         remove object(s)
  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
  find       search for objects
  sql        run sql queries on objects
  stat       show object metadata
  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)
  support    support related commands
  license    license related commands
  share      generate URL for temporary access to an object
  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)
  diff       list differences in object name, size, and date between two buckets
  replicate  configure server side bucket replication
  admin      manage MinIO servers
  update     update mc to latest release
  ready      checks if the cluster is ready or not
  ping       perform liveness check
  od         measure single stream upload and download
  batch      manage batch jobs
  
GLOBAL FLAGS:
  --autocompletion              install auto-completion for your shell
  --config-dir value, -C value  path to configuration folder (default: "/root/.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
  --version, -v                 print the version  

bucket子命令

ls

NAME:
  mc ls - list buckets and objects

USAGE:
  mc ls [FLAGS] TARGET [TARGET ...]

FLAGS:
  --rewind value                     list all object versions no later than specified date
  --versions                         list all versions
  --recursive, -r                    list recursively
  --incomplete, -I                   list incomplete uploads
  --summarize                        display summary information (number of objects, total size)
  --storage-class value, --sc value  filter to specified storage class
  --zip                              list files inside zip archive (MinIO servers only)
  --config-dir value, -C value       path to configuration folder (default: "/root/.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

mb

NAME:
  mc mb - make a bucket

USAGE:
  mc mb [FLAGS] TARGET [TARGET...]

FLAGS:
  --region value                specify bucket region; defaults to 'us-east-1' (default: "us-east-1")
  --ignore-existing, -p         ignore if bucket/directory already exists
  --with-lock, -l               enable object lock
  --with-versioning             enable versioned bucket
  --config-dir value, -C value  path to configuration folder (default: "/root/.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

rb

NAME:
  mc rb - remove a bucket

USAGE:
  mc rb [FLAGS] TARGET [TARGET...]

FLAGS:
  --force                       force a recursive remove operation on all object versions
  --dangerous                   allow site-wide removal of objects
  --config-dir value, -C value  path to configuration folder (default: "/root/.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

object子命令

cp

拷贝本地文件到minio服务器 ,或者从minio服务器拷贝文件到本地。

NAME:
  mc cp - copy objects

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

FLAGS:
  --rewind value                     roll back object(s) to current version at specified time
  --version-id value, --vid value    select an object version to copy
  --recursive, -r                    copy recursively
  --older-than value                 copy objects older than value in duration string (e.g. 7d10h31s)
  --newer-than value                 copy objects newer than value in duration string (e.g. 7d10h31s)
  --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 copy session
  --preserve, -a                     preserve filesystem attributes (mode, ownership, timestamps)
  --disable-multipart                disable multipart upload feature
  --md5                              force all upload(s) to calculate md5sum checksum
  --tags value                       apply one or more tags to the uploaded objects
  --retention-mode value             retention mode to be applied on the object (governance, compliance)
  --retention-duration value         retention duration for the object in d days or y years
  --legal-hold value                 apply legal hold to the copied object (on, off)
  --zip                              Extract from remote zip file (MinIO server source only)
  --encrypt-key value                encrypt/decrypt objects (using server-side encryption with customer provided keys)
  --config-dir value, -C value       path to configuration folder (default: "/root/.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
  
ENVIRONMENT VARIABLES:
  MC_ENCRYPT:      list of comma delimited prefixes
  MC_ENCRYPT_KEY:  list of comma delimited prefix=secret values

配置子命令

config

NAME:
  mc config - configure MinIO client

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

COMMANDS:
  host  add, remove and list hosts in configuration file
  
FLAGS:
  --config-dir value, -C value  path to configuration folder (default: "/root/.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
  

alias

管理服务器凭据。

  mc alias - manage server credentials in configuration file

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

COMMANDS:
  set, s      set a new alias to configuration file
  list, ls    list aliases in configuration file
  remove, rm  remove an alias from configuration file
  import, i   import configuration info to configuration file from a JSON formatted string 
  
FLAGS:
  --config-dir value, -C value  path to configuration folder (default: "/home/jurassic/.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

示例

配置minio客户端

#查看配置的host列表
mc config host list
#增加minio服务器端配置
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> [--api API-SIGNATURE]

操作minio服务器端

#格式
mc ls   <ALIAS> /<BUCKET>/<OBJECT>
mc ls prod/cloud-quality/

上传文件到minio

mc cp <localFile>  <objectName>

下载文件到本地

mc cp  <objectName>  <localFile>
mc cp prod/cloud-quality/mc.txt ./

附录

参考

版本:c version RELEASE.2022-10-09T21-10-59Z (commit-id=27322636ae33611cf193a0fe4b5de18f3b096549)

相关推荐

  1. minio命令详解

    2023-12-31 08:54:03       37 阅读
  2. Python命令参数处理:详解argparse模块

    2023-12-31 08:54:03       8 阅读
  3. Windows Shell命令详解:掌握命令的高级用法

    2023-12-31 08:54:03       22 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-31 08:54:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-31 08:54:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-31 08:54:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-31 08:54:03       20 阅读

热门阅读

  1. mysql聚合函数andjson_object 例子

    2023-12-31 08:54:03       32 阅读
  2. 【全网首发】洛谷P2678 [NOIP2015 提高组] 跳石头

    2023-12-31 08:54:03       40 阅读
  3. redis在linux集群部署

    2023-12-31 08:54:03       28 阅读
  4. [原创][R语言]股票分析实战[5]:加载股票数据

    2023-12-31 08:54:03       39 阅读
  5. CentOS 8 上安装 Python 3.10.12

    2023-12-31 08:54:03       36 阅读
  6. Docker启动各种服务

    2023-12-31 08:54:03       35 阅读
  7. 【12.30】转行小白历险记-刷算法06

    2023-12-31 08:54:03       33 阅读