Files
Linux/Docs/Minio-Mc工具使用.md
offends a9821e9a38
All checks were successful
continuous-integration/drone Build is passing
更新Minio工具Mc最新命令使用方式笔记
2025-08-25 20:19:27 +08:00

130 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

> 本文作者:丁辉
# Minio-Mc工具使用
## 安装 MC 工具
[下载地址](https://dl.min.io/client/mc/release/)
**下载并安装**
```bash
wget https://dl.min.io/client/mc/release/linux-amd64/mc && chmod 777 mc && mv mc /usr/local/bin/
```
## 配置 Minio 信息
**配置 MC**
> 新版已弃用此命令,本文后续 `mc config` 都默认需要改为 `mc alias` ****
>
> ```bash
> mc config host add minio https://localhost:9000 MINIO_ACCESS_KEY MINIO_SECRET_KEY
> ```
```bash
mc alias set minio minio https://localhost:9000 MINIO_ACCESS_KEY MINIO_SECRET_KEY
```
> 配置格式
>
> ```bash
> mc config host add <命名> <Minio地址> <AccessKey 或 账号> <SecretKey 或 密码>
> ```
## MC 使用基础命令
- 查看主机配置信息
```bash
mc config host list minio
```
- 删除主机信息
```bash
mc config host remove minio
```
> 可使用如下命令查看主机列表
>
> ```bash
> mc config host list
> ```
- 查看存储文件
```bash
mc ls minio
```
- 创建存储桶
```bash
mc mb minio/<桶>
```
> 递归创建存储桶
>
> ```bash
> mc mb minio/<桶>/...
> ```
- 删除
- 删除文件
```bash
mc rm minio/<桶>/<文件>
```
- 删除目录
```bash
mc rm minio/<桶>/<目录>
```
> 强制删除有文件的目录添加参数 `--recursive --force`
- 删除桶
```bsah
mc rb minio/<桶>
```
>如果桶内咳存在文件, 强制删除添加参数 `--force`
- 配置存储通访问权限
- 查看访问权限
```bash
mc anonymous list minio/<桶>
```
- 公共
```bash
mc anonymous set public minio/<桶>
```
- 查看存储空间
```bash
mc du minio/<桶>
```
- 拷贝文件
```bash
mc cp ./<本地文件> minio/<桶>
```
- 以文件树结构列出内容
```bash
mc tree minio/<桶>
```