mc 命令使用

一、 mc 命令使用#

1. 下载客户端#

软件包路径: https://dl.min.io/client/mc/release/linux-amd64/

# wget https://dl.min.io/client/mc/release/linux-amd64/mc

2. 安装客户端#

# chmod a+x mc
# mv mc /usr/local/bin/

# mv --version
mv (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Parker, David MacKenzie, and Jim Meyering.

3. 配置访问 minio#

需要提前安装 minio 服务,如何安装请自行百度

## 
# mc config host add minio http://172.16.0.189:9000 minio minio123

## 查看配置
# mc config host list
## 不同 mc 版本,以下内容输出可能不一定完全相同
gcs
  URL       : https://storage.googleapis.com
  AccessKey : YOUR-ACCESS-KEY-HERE
  SecretKey : YOUR-SECRET-KEY-HERE
  API       : S3v2
  Path      : dns

local
  URL       : http://localhost:9000
  AccessKey :
  SecretKey :
  API       :
  Path      : auto

minio		## 新增的私网 minio 配置
  URL       : http://10.0.0.1:9000
  AccessKey : minio
  SecretKey : minio123
  API       : s3v4
  Path      : auto

play
  URL       : https://play.min.io
  AccessKey : Q3AM3UQ867SPQQA43P2F
  SecretKey : zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG
  API       : S3v4
  Path      : auto

s3
  URL       : https://s3.amazonaws.com
  AccessKey : YOUR-ACCESS-KEY-HERE
  SecretKey : YOUR-SECRET-KEY-HERE
  API       : S3v4
  Path      : dns

4. minio 常用命令#

a | 显示 minio 的存储桶#

# mc ls minio
[2022-04-29 11:22:45 CST]     0B test1/
[2022-04-29 11:30:45 CST]     0B evescn/

b | 显示 minio 存储桶内部数据#

# mc ls minio/evescn/
[2022-04-29 14:35:39 CST]  18MiB STANDARD 1.tar.gz
[2022-04-29 14:35:38 CST]  14MiB STANDARD 2.tar.gz

c | 上传数据#

# mc cp /etc/fstab minio/evescn/

d | 下载数据#

# mc cp minio/evescn/fstab /tmp/fstab 

# ls /tmp/
fstab

e | 其他命令#

其他详细命令,查看下面的参考文档

参考文档#

http://docs.minio.org.cn/docs/master/minio-client-complete-guide

https://github.com/minio/mc