
MinIO
1 基础知识
– MinIO Client简称mc
– MinIO Client提供操作MinIO服务端的类UNIX命令(如ls、cat、cp、mirror、difffind等)
– MinIO Client支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和V4)
2 最佳实践
2.1 部署MinIO集群
2.2 部署MinIO客户端
2.2.1 下载客户端
wget https://dl.min.io/client/mc/release/linux-amd64/mc
以上只是演示,如下载异常或者需要其他版本,请冲如下连接下载,
https://dl.min.io/client/mc/release/linux-amd64/
2.2.2 部署客户端
mv mc /usr/local/bin/ chmod +x /usr/local/bin/mc
2.2.3 测试安装
mc -v
可见如下提示,
mc version RELEASE.2025-08-13T08-35-41Z (commit-id=7394ce0dd2a80935aded936b09fa12cbb3cb8096) Runtime: go1.24.6 linux/amd64 Copyright (c) 2015-2025 MinIO, Inc. License GNU AGPLv3
2.3 使用MinIO客户端
2.3.1 获取帮助
mc -h
可见如下提示,
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 admin manage MinIO servers anonymous manage anonymous access to buckets and objects batch manage batch jobs cp copy objects cat display object contents cors manage bucket CORS configuration diff list differences in object name, size, and date between two buckets du summarize disk usage recursively encrypt manage bucket encryption config event manage object notifications find search for objects get get s3 object to local head display first 'n' lines of an object ilm manage bucket lifecycle idp manage MinIO IDentity Provider server configuration license license related commands legalhold manage legal hold for object(s) ls list buckets and objects mb make a bucket mv move objects mirror synchronize object(s) to a remote site od measure single stream upload and download ping perform liveness check pipe stream STDIN to an object put upload an object to a bucket quota manage bucket quota rm remove object(s) retention set retention for object(s) rb remove a bucket replicate configure server side bucket replication ready checks if the cluster is ready or not sql run sql queries on objects stat show object metadata support support related commands share generate URL for temporary access to an object tree list buckets and objects in a tree format tag manage tags for bucket and object(s) undo undo PUT/DELETE operations update update mc to latest release version manage bucket versioning watch listen for object notification events GLOBAL FLAGS: --autocompletion install auto-completion for your shell --config-dir value, -C value path to configuration folder (default: "/root/.mc") [$MC_CONFIG_DIR] --quiet, -q disable progress bar display [$MC_QUIET] --disable-pager, --dp disable mc internal pager and print to raw stdout [$MC_DISABLE_PAGER] --no-color disable color theme [$MC_NO_COLOR] --json enable JSON lines formatted output [$MC_JSON] --debug enable debug output [$MC_DEBUG] --resolve value resolves HOST[:PORT] to an IP address. Example: minio.local:9000=10.10.75.1 [$MC_RESOLVE] --insecure disable SSL certificate verification [$MC_INSECURE] --limit-upload value limits uploads to a maximum rate in KiB/s, MiB/s, GiB/s. (default: unlimited) [$MC_LIMIT_UPLOAD] --limit-download value limits downloads to a maximum rate in KiB/s, MiB/s, GiB/s. (default: unlimited) [$MC_LIMIT_DOWNLOAD] --custom-header value, -H value add custom HTTP header to the request. 'key:value' format. --help, -h show help --version, -v print the version TIP: Use 'mc --autocompletion' to enable shell autocompletion COPYRIGHT: Copyright (c) 2015-2025 MinIO, Inc. LICENSE: GNU AGPLv3
2.3.2 设置MinIO存储别名
mc alias set minio https://minio.cmdschool.org:9000 minio miniopwd
可见如下提示,
mc: Configuration written to `/root/.mc/config.json`. Please update your access credentials. mc: Successfully created `/root/.mc/share`. mc: Initialized share uploads `/root/.mc/share/uploads.json` file. mc: Initialized share downloads `/root/.mc/share/downloads.json` file. Added `minio` successfully.
然后,我们可以使用如下命令测试配置,
mc admin info minio
可见如下提示,
● minio01.cmdschool.org:9000 Uptime: 1 hour Version: 2025-09-07T16:13:09Z Network: 4/4 OK Drives: 1/1 OK Pool: 1 ● minio02.cmdschool.org:9000 Uptime: 1 hour Version: 2025-09-07T16:13:09Z Network: 4/4 OK Drives: 1/1 OK Pool: 1 ● minio03.cmdschool.org:9000 Uptime: 1 hour Version: 2025-09-07T16:13:09Z Network: 4/4 OK Drives: 1/1 OK Pool: 1 ● minio04.cmdschool.org:9000 Uptime: 1 hour Version: 2025-09-07T16:13:09Z Network: 4/4 OK Drives: 1/1 OK Pool: 1 ┌──────┬───────────────────────┬─────────────────────┬──────────────┐ │ Pool │ Drives Usage │ Erasure stripe size │ Erasure sets │ │ 1st │ 0.0% (total: 278 GiB) │ 4 │ 1 │ └──────┴───────────────────────┴─────────────────────┴──────────────┘ 0 B Used, 1 Bucket, 0 Objects 4 drives online, 0 drives offline, EC:2
2.4 常用的操作
创建桶和配置桶权限,
参阅文档
==============
https://docs.min.io/community/minio-object-store/
https://docs.min.io/docs/minio-admin-complete-guide.html
https://docs.min.io/docs/minio-client-quickstart-guide.html
没有评论