1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MinIO Client (mcコマンド) 備忘録

Posted at

環境情報

  • Ubuntu 18.04.3
  • MinIO: RELEASE.2021-06-17T00-10-46Z-28-gac7697426
  • MinIO Client: RELEASE.2021-06-13T17-48-22Z

インストール

MinIO Client Quickstart Guideを参考に実施

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

... snip ...

$ chmod +x mc 
$ sudo mv mc /usr/local/bin/
$ mc -v
mc version RELEASE.2021-06-13T17-48-22Z

コマンド一覧

以下のコマンド一覧は、MinIO Client Quickstart Guideを参考にしています。

ストレージサービスの追加

mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --path <BUCKET-LOOKUP-TYPE>

MinIOを追加

$ mc alias set minio http://xx.xx.xx.xx:9000/ xxxxxxx xxxxxxx
Added `minio` successfully.
ubuntu@ansible-01:~$ cat ~/.mc/config.json | jq -r .aliases.minio
{
  "url": "http://xx.xx.xx.xx:9000",
  "accessKey": "xxxxxxx",
  "secretKey": "xxxxxxx",
  "api": "s3v4",
  "path": "auto"
}

バケットの追加

$ mc mb minio/backup/redmine-issue
Bucket created successfully `minio/backup/redmine-issue`.
$ mc ls minio
[2021-07-27 09:44:02 UTC]     0B backup/
$ mc ls minio/backup
[2021-07-27 09:46:18 UTC]     0B redmine-issue/

ファイルのアップロード

単一のファイルのアップロード

$ mc cp /srv/docker/redmine/redmine_mysql/backups/1627453357_redmine_backup.tar minio/backup/redmine-issue
...3357_redmine_backup.tar:  1.21 MiB / 1.21 MiB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 1.46 MiB/s 0s
$ mc ls minio/backup/redmine-issue
[2021-07-28 06:50:39 UTC] 1.2MiB 1627453357_redmine_backup.tar

ディレクトリ配下の複数ファイルをアップロード

$ mc cp -r /srv/docker/redmine/redmine_mysql/backups/ minio/backup/redmine-issue
...3357_redmine_backup.tar:  24.22 MiB / 24.22 MiB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 15.55 MiB/s 1subuntu@ansible-01:~/mo-$ mc ls minio/backup/redmine-issue
[2021-07-28 07:21:21 UTC] 1.2MiB 1627438434_redmine_backup.tar
[2021-07-28 07:21:21 UTC] 1.2MiB 1627438554_redmine_backup.tar
[2021-07-28 07:21:21 UTC] 1.2MiB 1627438875_redmine_backup.tar

... snip ...

ファイルの削除

1分前よりも古いファイルを全て削除

$ mc rm -r --force --older-than 1m minio/backup/redmine-issue
Removing `minio/backup/redmine-issue/1627452985_redmine_backup.tar`.
Removing `minio/backup/redmine-issue/1627453357_redmine_backup.tar`.
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?