mirror of
https://github.com/minio/mc.git
synced 2025-04-18 10:04:03 +03:00
mc command cleanup (#2783)
This commit is contained in:
parent
2d691508c2
commit
56309a4999
@ -6,6 +6,6 @@ Besides `mc` is a single static binary and can reside inside your application an
|
||||
|
||||
Package managers are free to choose a different name if they like. One such solution [pointed out](https://github.com/minio/mc/issues/873#issuecomment-267583013) by one of our community members.
|
||||
|
||||
```sh
|
||||
```
|
||||
mv ./mc ./mcli
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
### Setup your mc Github Repository
|
||||
Fork [mc upstream](https://github.com/minio/mc/fork) source repository to your own personal repository.
|
||||
```sh
|
||||
```
|
||||
$ mkdir -p $GOPATH/src/github.com/minio
|
||||
$ cd $GOPATH/src/github.com/minio
|
||||
$ git clone https://github.com/$USER_ID/mc
|
||||
|
28
README.md
28
README.md
@ -43,7 +43,7 @@ docker run minio/mc:edge ls play
|
||||
|
||||
**Note:** Above examples run `mc` against MinIO [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
|
||||
|
||||
```sh
|
||||
```
|
||||
docker run -it --entrypoint=/bin/sh minio/mc
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ then use the [`mc config` command](#add-a-cloud-storage-service).
|
||||
### Homebrew
|
||||
Install mc packages using [Homebrew](http://brew.sh/)
|
||||
|
||||
```sh
|
||||
```
|
||||
brew install minio/stable/mc
|
||||
mc --help
|
||||
```
|
||||
@ -65,7 +65,7 @@ mc --help
|
||||
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|
||||
||64-bit PPC|https://dl.min.io/client/mc/release/linux-ppc64le/mc |
|
||||
|
||||
```sh
|
||||
```
|
||||
wget https://dl.min.io/client/mc/release/linux-amd64/mc
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
@ -77,7 +77,7 @@ chmod +x mc
|
||||
| ---------- | -------- |------|
|
||||
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -86,7 +86,7 @@ Source installation is intended only for developers and advanced users. `mc upda
|
||||
|
||||
If you do not have a working Golang environment, please follow [How to install Golang](https://docs.min.io/docs/how-to-install-golang).
|
||||
|
||||
```sh
|
||||
```
|
||||
go get -d github.com/minio/mc
|
||||
cd ${GOPATH}/src/github.com/minio/mc
|
||||
make
|
||||
@ -97,7 +97,7 @@ If you are planning to use `mc` only on POSIX compatible filesystems, you may sk
|
||||
|
||||
To add one or more Amazon S3 compatible hosts, please follow the instructions below. `mc` stores all its configuration information in ``~/.mc/config.json`` file.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --lookup <BUCKET-LOOKUP-TYPE>
|
||||
```
|
||||
|
||||
@ -108,14 +108,14 @@ Lookup is an optional argument. It is used to indicate whether dns or path style
|
||||
### Example - MinIO Cloud Storage
|
||||
MinIO server displays URL, access and secret keys.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
```
|
||||
|
||||
### Example - Amazon S3 Cloud Storage
|
||||
Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
```
|
||||
|
||||
@ -149,7 +149,7 @@ mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo
|
||||
### Example - Google Cloud Storage
|
||||
Get your AccessKeyID and SecretAccessKey by following [Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
```
|
||||
|
||||
@ -162,7 +162,7 @@ NOTE: Google Cloud Storage only supports Legacy Signature Version 2, so you have
|
||||
|
||||
List all buckets from https://play.min.io:9000
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
|
||||
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
|
||||
@ -175,7 +175,7 @@ Make a bucket
|
||||
`mb` command creates a new bucket.
|
||||
|
||||
*Example:*
|
||||
```sh
|
||||
```
|
||||
mc mb play/mybucket
|
||||
Bucket created successfully `play/mybucket`.
|
||||
```
|
||||
@ -184,7 +184,7 @@ Copy Objects
|
||||
`cp` command copies data from one or more sources to a target.
|
||||
|
||||
*Example:*
|
||||
```sh
|
||||
```
|
||||
mc cp myobject.txt play/mybucket
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
@ -197,7 +197,7 @@ myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
|
||||
### Shell aliases
|
||||
You may add shell aliases to override your common Unix tools.
|
||||
|
||||
```sh
|
||||
```
|
||||
alias ls='mc ls'
|
||||
alias cp='mc cp'
|
||||
alias cat='mc cat'
|
||||
@ -210,7 +210,7 @@ alias find='mc find'
|
||||
|
||||
In case you are using bash or zsh, the current shell will be automatically setup to use completion feature to suggest or auto-complete your mc commands.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc <TAB>
|
||||
admin config diff find ls mirror policy session sql update watch
|
||||
cat cp event head mb pipe rm share stat version
|
||||
|
@ -39,7 +39,7 @@ docker run minio/mc:edge ls play
|
||||
|
||||
**注意:** 上述示例默认使用MinIO[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器:
|
||||
|
||||
```sh
|
||||
```
|
||||
docker run -it --entrypoint=/bin/sh minio/mc
|
||||
```
|
||||
|
||||
@ -49,7 +49,7 @@ docker run -it --entrypoint=/bin/sh minio/mc
|
||||
### Homebrew
|
||||
使用[Homebrew](http://brew.sh/)安装mc。
|
||||
|
||||
```sh
|
||||
```
|
||||
brew install minio/stable/mc
|
||||
mc --help
|
||||
```
|
||||
@ -60,7 +60,7 @@ mc --help
|
||||
| ---------- | -------- |------|
|
||||
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
@ -71,7 +71,7 @@ chmod +x mc
|
||||
| ---------- | -------- |------|
|
||||
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -80,7 +80,7 @@ mc.exe --help
|
||||
|
||||
如果您没有Golang环境,请参照[如何安装Golang](https://docs.min.io/docs/how-to-install-golang)。
|
||||
|
||||
```sh
|
||||
```
|
||||
go get -d github.com/minio/mc
|
||||
cd ${GOPATH}/src/github.com/minio/mc
|
||||
make
|
||||
@ -91,7 +91,7 @@ make
|
||||
|
||||
添加一个或多个S3兼容的服务,请参考下面说明。`mc`将所有的配置信息都存储在``~/.mc/config.json``文件中。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> <API-SIGNATURE>
|
||||
```
|
||||
|
||||
@ -100,21 +100,21 @@ mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY
|
||||
### 示例-MinIO云存储
|
||||
从MinIO服务获得URL、access key和secret key。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
|
||||
```
|
||||
|
||||
### 示例-Amazon S3云存储
|
||||
参考[AWS Credentials指南](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)获取你的AccessKeyID和SecretAccessKey。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
|
||||
```
|
||||
|
||||
### 示例-Google云存储
|
||||
参考[Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)获取你的AccessKeyID和SecretAccessKey。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
|
||||
```
|
||||
|
||||
@ -127,7 +127,7 @@ mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1
|
||||
|
||||
列出https://play.min.io:9000上的所有存储桶。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
|
||||
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
|
||||
@ -141,7 +141,7 @@ mc ls play
|
||||
### Shell别名
|
||||
你可以添加shell别名来覆盖默认的Unix工具命令。
|
||||
|
||||
```sh
|
||||
```
|
||||
alias ls='mc ls'
|
||||
alias cp='mc cp'
|
||||
alias cat='mc cat'
|
||||
@ -153,12 +153,12 @@ alias find='mc find'
|
||||
### Shell自动补全
|
||||
你也可以下载[`autocomplete/bash_autocomplete`](https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete)到`/etc/bash_completion.d/`,然后将其重命名为`mc`。别忘了在这个文件运行source命令让其在你的当前shell上可用。
|
||||
|
||||
```sh
|
||||
```
|
||||
sudo wget https://raw.githubusercontent.com/minio/mc/master/autocomplete/bash_autocomplete -O /etc/bash_completion.d/mc
|
||||
source /etc/bash_completion.d/mc
|
||||
```
|
||||
|
||||
```sh
|
||||
```
|
||||
mc <TAB>
|
||||
admin config diff ls mirror policy session update watch
|
||||
cat cp events mb pipe rm share version
|
||||
|
@ -85,21 +85,29 @@ SCAN MODES:
|
||||
deep : Heal objects which are missing on one or more disks. Also heal objects with silent data corruption.
|
||||
|
||||
EXAMPLES:
|
||||
1. To format newly replaced disks in a MinIO server with alias 'play'
|
||||
$ {{.HelpName}} play
|
||||
1. To format newly replaced disks in a MinIO server with alias 'myminio'
|
||||
$ {{.HelpName}} myminio
|
||||
|
||||
2. Heal 'testbucket' in a MinIO server with alias 'play'
|
||||
$ {{.HelpName}} play/testbucket/
|
||||
2. Heal 'testbucket' in a MinIO server with alias 'myminio'
|
||||
$ {{.HelpName}} myminio/testbucket/
|
||||
|
||||
3. Heal all objects under 'dir' prefix
|
||||
$ {{.HelpName}} --recursive play/testbucket/dir/
|
||||
$ {{.HelpName}} --recursive myminio/testbucket/dir/
|
||||
|
||||
4. Issue a dry-run heal operation to inspect objects health but not heal them
|
||||
$ {{.HelpName}} --dry-run play
|
||||
$ {{.HelpName}} --dry-run myminio
|
||||
|
||||
5. Issue a dry-run heal operation to inspect objects health under 'dir' prefix
|
||||
$ {{.HelpName}} --recursive --dry-run play/testbucket/dir/
|
||||
$ {{.HelpName}} --recursive --dry-run myminio/testbucket/dir/
|
||||
|
||||
6. Force start a running heal sequence (meaning it will force kill the running heal sequence and start a new one)
|
||||
$ {{.HelpName}} --force-start myminio/testbucket/dir/
|
||||
|
||||
7. Force stop a running heal sequence (meaning it will force kill the running heal sequence)
|
||||
$ {{.HelpName}} --force-stop myminio/testbucket/dir/
|
||||
|
||||
8. Issue a dry-run heal operation to inspect objects health under 'dir' prefix
|
||||
$ {{.HelpName}} --dry-run myminio/testbucket/dir/
|
||||
`,
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
var adminUserPolicyCmd = cli.Command{
|
||||
Name: "policy",
|
||||
Name: "set-policy",
|
||||
Usage: "set policy for user",
|
||||
Action: mainAdminUserPolicy,
|
||||
Before: setGlobalsFromContext,
|
||||
|
@ -44,9 +44,9 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Add a new user 'foobar' to MinIO server with policy 'writeonly'.
|
||||
$ set -o history
|
||||
$ {{.HelpName}} myminio foobar foo12345 writeonly
|
||||
$ set +o history
|
||||
$ {{.HelpName}} myminio foobar foo12345 writeonly
|
||||
$ set -o history
|
||||
`,
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
|
||||
var configHostCmd = cli.Command{
|
||||
Name: "host",
|
||||
Usage: "list, modify and remove hosts in configuration file",
|
||||
Usage: "add, remove and list hosts in configuration file",
|
||||
Action: mainConfigHost,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
|
@ -121,6 +121,8 @@ EXAMPLES:
|
||||
11. Copy a folder recursively from MinIO cloud storage to Amazon S3 cloud storage with specified metadata.
|
||||
$ {{.HelpName}} --attr key1=value1,key2=value2 --recursive play/mybucket/burningman2011/ s3/mybucket/
|
||||
|
||||
12. Copy a text file to an object storage and assign REDUCED_REDUNDANCY storage-class to the uploaded object.
|
||||
$ {{.HelpName}} --storage-class REDUCED_REDUNDANCY myobject.txt play/mybucket
|
||||
`,
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,8 @@ DESCRIPTION:
|
||||
It *DOES NOT* compare objects' contents.
|
||||
|
||||
LEGEND:
|
||||
> - object is only in source.
|
||||
< - object is only in destination.
|
||||
< - object is only in source.
|
||||
> - object is only in destination.
|
||||
! - newer object is in source.
|
||||
|
||||
EXAMPLES:
|
||||
|
@ -142,7 +142,7 @@ EXAMPLES:
|
||||
$ {{.HelpName}} s3 --larger 64MB --smaller 1GB --print {url}
|
||||
|
||||
08. Find all objects created in the last week under "s3/bucket".
|
||||
$ {{.HelpName}} s3/bucket --newer 1w
|
||||
$ {{.HelpName}} s3/bucket --newer-than 7d
|
||||
|
||||
09. Find all objects which were created are older than 2 days, 5 hours and 10 minutes and exclude the ones with ".jpg"
|
||||
extension under "s3".
|
||||
|
@ -69,6 +69,9 @@ EXAMPLES:
|
||||
|
||||
6. Create multiple directories including its missing parents (behavior similar to 'mkdir -p').
|
||||
$ {{.HelpName}} /mnt/sdb/mydisk /mnt/sdc/mydisk /mnt/sdd/mydisk
|
||||
|
||||
7. Ignore if bucket/directory already exists.
|
||||
$ {{.HelpName}} --ignore-existing myminio/mynewbucket
|
||||
|
||||
`,
|
||||
}
|
||||
|
@ -235,8 +235,15 @@ func mainRemoveBucket(ctx *cli.Context) error {
|
||||
if !isForce && !isEmpty {
|
||||
fatalIf(errDummy().Trace(), "`"+targetURL+"` is not empty. Retry this command with ‘--force’ flag if you want to remove `"+targetURL+"` and all its contents")
|
||||
}
|
||||
|
||||
e := deleteBucket(targetURL)
|
||||
fatalIf(e.Trace(targetURL), "Failed to remove `"+targetURL+"`.")
|
||||
|
||||
if !isNamespaceRemoval(targetURL) {
|
||||
printMsg(removeBucketMessage{
|
||||
Bucket: targetURL, Status: "success",
|
||||
})
|
||||
}
|
||||
}
|
||||
return cErr
|
||||
}
|
||||
|
@ -88,30 +88,33 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
EXAMPLES:
|
||||
1. Remove a file.
|
||||
$ {{.HelpName}} 1999/old-backup.tgz
|
||||
$ {{.HelpName}} 1999/old-backup.tgz
|
||||
|
||||
2. Perform a fake remove operation.
|
||||
$ {{.HelpName}} --fake 1999/old-backup.tgz
|
||||
|
||||
2. Remove all objects recursively from bucket 'jazz-songs' matching 'louis' prefix.
|
||||
$ {{.HelpName}} --recursive s3/jazz-songs/louis/
|
||||
3. Remove all objects recursively from bucket 'jazz-songs' matching the prefix 'louis'.
|
||||
$ {{.HelpName}} --recursive --force s3/jazz-songs/louis/
|
||||
|
||||
3. Remove all objects older than '90' days recursively from bucket 'jazz-songs' that match 'louis' prefix.
|
||||
$ {{.HelpName}} --recursive --older-than 90d s3/jazz-songs/louis/
|
||||
4. Remove all objects older than '90' days recursively from bucket 'jazz-songs' matching the prefix 'louis'.
|
||||
$ {{.HelpName}} --recursive --force --older-than 90d s3/jazz-songs/louis/
|
||||
|
||||
4. Remove all objects newer than 7 days and 10 hours recursively from bucket 'pop-songs'
|
||||
$ {{.HelpName}} --recursive --newer-than 7d10h s3/pop-songs/
|
||||
5. Remove all objects newer than 7 days and 10 hours recursively from bucket 'pop-songs'
|
||||
$ {{.HelpName}} --recursive --force --newer-than 7d10h s3/pop-songs/
|
||||
|
||||
5. Remove all objects read from STDIN.
|
||||
6. Remove all objects read from STDIN.
|
||||
$ {{.HelpName}} --force --stdin
|
||||
|
||||
6. Remove all objects recursively from S3 host
|
||||
$ {{.HelpName}} --recursive --dangerous s3
|
||||
7. Remove all objects recursively from Amazon S3 cloud storage.
|
||||
$ {{.HelpName}} --recursive --force --dangerous s3
|
||||
|
||||
7. Remove all buckets and objects older than '90' days recursively from host
|
||||
$ {{.HelpName}} --recursive --dangerous --older-than 90d s3
|
||||
8. Remove all buckets and objects older than '90' days recursively from host
|
||||
$ {{.HelpName}} --recursive --dangerous --force --older-than 90d s3
|
||||
|
||||
8. Drop all incomplete uploads on 'jazz-songs' bucket.
|
||||
$ {{.HelpName}} --incomplete --recursive s3/jazz-songs/
|
||||
9. Drop all incomplete uploads on the bucket 'jazz-songs'.
|
||||
$ {{.HelpName}} --incomplete --recursive --force s3/jazz-songs/
|
||||
|
||||
9. Remove an encrypted object from Amazon S3 cloud storage.
|
||||
10. Remove an encrypted object from Amazon S3 cloud storage.
|
||||
$ {{.HelpName}} --encrypt-key "s3/sql-backups/=32byteslongsecretkeymustbegiven1" s3/sql-backups/1999/old-backup.tgz
|
||||
`,
|
||||
}
|
||||
|
@ -463,7 +463,9 @@ func mainUpdate(ctx *cli.Context) {
|
||||
}
|
||||
|
||||
quiet := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
||||
|
||||
if ctx.Bool("json") || ctx.GlobalBool("json") {
|
||||
globalJSON = true
|
||||
}
|
||||
updateMsg, sha256Hex, _, latestReleaseTime, err := getUpdateInfo(10 * time.Second)
|
||||
if err != nil {
|
||||
errorIf(err, "Unable to update ‘mc’.")
|
||||
|
@ -8,7 +8,7 @@ Please go through this link [Maintainer Responsibility](https://gist.github.com/
|
||||
|
||||
Fork [mc upstream](https://github.com/minio/mc/fork) source repository to your own personal repository.
|
||||
|
||||
```sh
|
||||
```
|
||||
|
||||
$ mkdir -p $GOPATH/src/github.com/minio
|
||||
$ cd $GOPATH/src/github.com/minio
|
||||
|
@ -28,7 +28,7 @@ docker run minio/mc:edge admin info play
|
||||
### Homebrew (macOS)
|
||||
Install mc packages using [Homebrew](http://brew.sh/)
|
||||
|
||||
```sh
|
||||
```
|
||||
brew install minio/stable/mc
|
||||
mc --help
|
||||
```
|
||||
@ -39,7 +39,7 @@ mc --help
|
||||
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|
||||
||64-bit PPC|https://dl.min.io/client/mc/release/linux-ppc64le/mc |
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
@ -49,7 +49,7 @@ chmod +x mc
|
||||
| ---------- | -------- |------|
|
||||
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -58,7 +58,7 @@ Source installation is intended only for developers and advanced users. `mc upda
|
||||
|
||||
If you do not have a working Golang environment, please follow [How to install Golang](https://docs.min.io/docs/how-to-install-golang).
|
||||
|
||||
```sh
|
||||
```
|
||||
go get -d github.com/minio/mc
|
||||
cd ${GOPATH}/src/github.com/minio/mc
|
||||
make
|
||||
@ -68,21 +68,21 @@ make
|
||||
|
||||
### GNU/Linux
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod 755 mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### Microsoft Windows
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -91,13 +91,13 @@ MinIO server displays URL, access and secret keys.
|
||||
|
||||
#### Usage
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add <ALIAS> <YOUR-MINIO-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY>
|
||||
```
|
||||
|
||||
Alias is simply a short name to your MinIO service. MinIO end-point, access and secret keys are supplied by your MinIO service. Admin API uses "S3v4" signature and cannot be changed.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add minio http://192.168.1.51:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
```
|
||||
|
||||
@ -107,7 +107,7 @@ mc config host add minio http://192.168.1.51:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqA
|
||||
|
||||
Get MinIO server information for the configured alias `minio`
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin info minio
|
||||
|
||||
● 192.168.1.51:9000
|
||||
@ -122,7 +122,7 @@ mc admin info minio
|
||||
## 5. Everyday Use
|
||||
You may add shell aliases for info, healing.
|
||||
|
||||
```sh
|
||||
```
|
||||
alias minfo='mc admin info'
|
||||
alias mheal='mc admin heal'
|
||||
```
|
||||
@ -134,7 +134,7 @@ Debug option enables debug output to console.
|
||||
|
||||
*Example: Display verbose debug output for `info` command.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin --debug info minio
|
||||
mc: <DEBUG> GET /minio/admin/v1/info HTTP/1.1
|
||||
Host: 192.168.1.51:9000
|
||||
@ -171,7 +171,7 @@ JSON option enables parseable output in JSON format.
|
||||
|
||||
*Example: MinIO server information.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin --json info minio
|
||||
{
|
||||
"status": "success",
|
||||
@ -226,7 +226,7 @@ Skip SSL certificate verification.
|
||||
### Command `service` - stop, restart or get status of MinIO server
|
||||
`service` command provides a way to restart, stop one or get the status of MinIO servers (distributed cluster)
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin service - stop, restart or get status of MinIO server
|
||||
|
||||
@ -241,7 +241,7 @@ COMMANDS:
|
||||
|
||||
*Example: Display service uptime for MinIO server.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin service status play
|
||||
Uptime: 1 days 19 hours 57 minutes 39 seconds.
|
||||
```
|
||||
@ -250,7 +250,7 @@ Uptime: 1 days 19 hours 57 minutes 39 seconds.
|
||||
|
||||
NOTE: `restart` and `stop` sub-commands are disruptive operations for your MinIO service, any on-going API operations will be forcibly canceled. So, it should be used only under certain circumstances. Please use it with caution.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin service restart play
|
||||
Restarted `play` successfully.
|
||||
```
|
||||
@ -259,7 +259,7 @@ Restarted `play` successfully.
|
||||
### Command `info` - Display MinIO server information
|
||||
`info` command displays server information of one or many MinIO servers (under distributed cluster)
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin info - get MinIO server information
|
||||
|
||||
@ -269,7 +269,7 @@ FLAGS:
|
||||
|
||||
*Example: Display MinIO server information.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin info play
|
||||
● play.min.io:9000
|
||||
Uptime : online since 1 day ago
|
||||
@ -284,7 +284,7 @@ mc admin info play
|
||||
### Command `policy` - Manage canned policies
|
||||
`policy` command to add, remove, list policies on MinIO server.
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin policy - manage policies
|
||||
|
||||
@ -299,19 +299,19 @@ COMMANDS:
|
||||
|
||||
*Example: Add a new policy 'newpolicy' on MinIO, with policy from /tmp/newpolicy.json.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin policy add myminio/ newpolicy /tmp/newpolicy.json
|
||||
```
|
||||
|
||||
*Example: Remove policy 'newpolicy' on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin policy remove myminio/ newpolicy
|
||||
```
|
||||
|
||||
*Example: List all policies on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin policy list --json myminio/
|
||||
{"status":"success","policy":"newpolicy"}
|
||||
```
|
||||
@ -320,7 +320,7 @@ mc admin policy list --json myminio/
|
||||
### Command `user` - Manage users
|
||||
`user` command to add, remove, enable, disable, list users on MinIO server.
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin user - manage users
|
||||
|
||||
@ -338,37 +338,37 @@ COMMANDS:
|
||||
|
||||
*Example: Add a new user 'newuser' on MinIO, with 'newpolicy' policy.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin user add myminio/ newuser newuser123 newpolicy
|
||||
```
|
||||
|
||||
*Example: Change policy for a user 'newuser' on MinIO to 'writeonly' policy.*
|
||||
|
||||
```sh
|
||||
mc admin user policy myminio/ newuser writeonly
|
||||
```
|
||||
mc admin user set-policy myminio/ newuser writeonly
|
||||
```
|
||||
|
||||
*Example: Disable a user 'newuser' on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin user disable myminio/ newuser
|
||||
```
|
||||
|
||||
*Example: Enable a user 'newuser' on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin user enable myminio/ newuser
|
||||
```
|
||||
|
||||
*Example: Remove user 'newuser' on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin user remove myminio/ newuser
|
||||
```
|
||||
|
||||
*Example: List all users on MinIO.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin user list --json myminio/
|
||||
{"status":"success","accessKey":"newuser","userStatus":"enabled"}
|
||||
```
|
||||
@ -377,7 +377,7 @@ mc admin user list --json myminio/
|
||||
### Command `config` - Manage server configuration
|
||||
`config` command to manage MinIO server configuration.
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin config - manage configuration file
|
||||
|
||||
@ -385,8 +385,8 @@ USAGE:
|
||||
mc admin config COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
COMMANDS:
|
||||
get get config of a MinIO server/cluster.
|
||||
set set new config file to a MinIO server/cluster.
|
||||
get get config of a MinIO server/cluster.
|
||||
set set new config file to a MinIO server/cluster.
|
||||
|
||||
FLAGS:
|
||||
--help, -h Show help.
|
||||
@ -394,13 +394,13 @@ FLAGS:
|
||||
|
||||
*Example: Get server configuration of a MinIO server/cluster.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin config get myminio > /tmp/my-serverconfig
|
||||
```
|
||||
|
||||
*Example: Set server configuration of a MinIO server/cluster.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin config set myminio < /tmp/my-serverconfig
|
||||
```
|
||||
|
||||
@ -408,32 +408,35 @@ mc admin config set myminio < /tmp/my-serverconfig
|
||||
### Command `heal` - Heal disks, buckets and objects on MinIO server
|
||||
`heal` command heals disks, missing buckets, objects on MinIO server. NOTE: This command is only applicable for MinIO erasure coded setup (standalone and distributed).
|
||||
|
||||
```sh
|
||||
```
|
||||
NAME:
|
||||
mc admin heal - heal disks, buckets and objects on MinIO server
|
||||
|
||||
FLAGS:
|
||||
--scan value select the healing scan mode (normal/deep) (default: "normal")
|
||||
--recursive, -r heal recursively
|
||||
--dry-run, -n only inspect data, but do not mutate
|
||||
--force-start, -f force start a new heal sequence
|
||||
--force-stop, -s force stop a running heal sequence
|
||||
--remove remove dangling objects in heal sequence
|
||||
--help, -h show help
|
||||
```
|
||||
|
||||
*Example: Heal MinIO cluster after replacing a fresh disk, recursively heal all buckets and objects, where 'myminio' is the MinIO server alias.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin heal -r myminio
|
||||
```
|
||||
|
||||
*Example: Heal MinIO cluster on a specific bucket recursively, where 'myminio' is the MinIO server alias.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin heal -r myminio/mybucket
|
||||
```
|
||||
|
||||
*Example: Heal MinIO cluster on a specific object prefix recursively, where 'myminio' is the MinIO server alias.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin heal -r myminio/mybucket/myobjectprefix
|
||||
```
|
||||
|
||||
@ -455,7 +458,7 @@ COMMANDS:
|
||||
|
||||
*Example: Get a list of the 10 oldest locks on a distributed MinIO cluster, where 'myminio' is the MinIO cluster alias.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc admin top locks myminio
|
||||
```
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
|
||||
|
||||
```sh
|
||||
```
|
||||
ls list buckets and objects
|
||||
mb make a bucket
|
||||
rb remove a bucket
|
||||
@ -42,7 +42,7 @@ docker run minio/mc:edge ls play
|
||||
|
||||
**Note:** Above examples run `mc` against MinIO [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
|
||||
|
||||
```sh
|
||||
```
|
||||
docker run -it --entrypoint=/bin/sh minio/mc
|
||||
```
|
||||
|
||||
@ -51,7 +51,7 @@ then use the [`mc config` command](#add-a-cloud-storage-service).
|
||||
### Homebrew (macOS)
|
||||
Install mc packages using [Homebrew](http://brew.sh/)
|
||||
|
||||
```sh
|
||||
```
|
||||
brew install minio/stable/mc
|
||||
mc --help
|
||||
```
|
||||
@ -62,7 +62,7 @@ mc --help
|
||||
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|
||||
||64-bit PPC|https://dl.min.io/client/mc/release/linux-ppc64le/mc |
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
@ -72,7 +72,7 @@ chmod +x mc
|
||||
| ---------- | -------- |------|
|
||||
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -81,7 +81,7 @@ Source installation is intended only for developers and advanced users. `mc upda
|
||||
|
||||
If you do not have a working Golang environment, please follow [How to install Golang](https://docs.min.io/docs/how-to-install-golang).
|
||||
|
||||
```sh
|
||||
```
|
||||
go get -d github.com/minio/mc
|
||||
cd ${GOPATH}/src/github.com/minio/mc
|
||||
make
|
||||
@ -91,21 +91,21 @@ make
|
||||
|
||||
### GNU/Linux
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod 755 mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### Microsoft Windows
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -116,7 +116,7 @@ To add one or more Amazon S3 compatible hosts, please follow the instructions be
|
||||
|
||||
#### Usage
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> <API-SIGNATURE>
|
||||
```
|
||||
|
||||
@ -126,33 +126,33 @@ Alias is simply a short name to your cloud storage service. S3 end-point, access
|
||||
MinIO server displays URL, access and secret keys.
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api S3v4
|
||||
```
|
||||
|
||||
### Example - Amazon S3 Cloud Storage
|
||||
Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html).
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api S3v4
|
||||
```
|
||||
|
||||
### Example - Google Cloud Storage
|
||||
Get your AccessKeyID and SecretAccessKey by following [Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api S3v2
|
||||
```
|
||||
|
||||
NOTE: Google Cloud Storage only supports Legacy Signature Version 2, so you have to pick - S3v2
|
||||
|
||||
### Specify host configuration through environment variable
|
||||
```sh
|
||||
```
|
||||
export MC_HOST_<alias>=https://<Access Key>:<Secret Key>@<YOUR-S3-ENDPOINT>
|
||||
```
|
||||
|
||||
Example:
|
||||
```sh
|
||||
```
|
||||
export MC_HOST_myalias=https://Q3AM3UQ867SPQQA43P2F:zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG@play.min.io:9000
|
||||
mc ls myalias
|
||||
```
|
||||
@ -164,7 +164,7 @@ mc ls myalias
|
||||
|
||||
List all buckets from https://play.min.io:9000
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
|
||||
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
|
||||
@ -176,7 +176,7 @@ mc ls play
|
||||
## 5. Everyday Use
|
||||
You may add shell aliases to override your common Unix tools.
|
||||
|
||||
```sh
|
||||
```
|
||||
alias ls='mc ls'
|
||||
alias cp='mc cp'
|
||||
alias cat='mc cat'
|
||||
@ -192,7 +192,7 @@ Debug option enables debug output to console.
|
||||
|
||||
*Example: Display verbose debug output for `ls` command.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc --debug ls play
|
||||
mc: <DEBUG> GET / HTTP/1.1
|
||||
Host: play.min.io:9000
|
||||
@ -227,7 +227,7 @@ JSON option enables parseable output in JSON format.
|
||||
|
||||
*Example: List all buckets from MinIO play service.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc --json ls play
|
||||
{"status":"success","type":"folder","lastModified":"2016-04-08T03:56:14.577+05:30","size":0,"key":"albums/"}
|
||||
{"status":"success","type":"folder","lastModified":"2016-04-04T16:11:45.349+05:30","size":0,"key":"backup/"}
|
||||
@ -262,9 +262,9 @@ Skip SSL certificate verification.
|
||||
|
||||
|
||||
### Command `ls` - List Objects
|
||||
`ls` command lists files, objects and objects. Use `--incomplete` flag to list partially copied content.
|
||||
`ls` command lists files, buckets and objects. Use `--incomplete` flag to list partially copied content.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc ls [FLAGS] TARGET [TARGET ...]
|
||||
|
||||
@ -276,7 +276,7 @@ FLAGS:
|
||||
|
||||
*Example: List all buckets on https://play.min.io:9000.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-04-08 03:56:14 IST] 0B albums/
|
||||
[2016-04-04 16:11:45 IST] 0B backup/
|
||||
@ -290,7 +290,7 @@ mc ls play
|
||||
`mb` command creates a new bucket on an object storage. On a filesystem, it behaves like `mkdir -p` command. Bucket is equivalent of a drive or mount point in filesystems and should not be treated as folders. MinIO does not place any limits on the number of buckets created per user.
|
||||
On Amazon S3, each account is limited to 100 buckets. Please refer to [Buckets Restrictions and Limitations on S3](http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html) for more information.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc mb [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -304,7 +304,7 @@ FLAGS:
|
||||
*Example: Create a new bucket named "mybucket" on https://play.min.io:9000.*
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mb play/mybucket
|
||||
Bucket created successfully ‘play/mybucket’.
|
||||
```
|
||||
@ -312,7 +312,7 @@ Bucket created successfully ‘play/mybucket’.
|
||||
*Example: Create a new bucket named "mybucket" on https://s3.amazonaws.com.*
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mb s3/mybucket --region=us-west-1
|
||||
Bucket created successfully ‘s3/mybucket’.
|
||||
```
|
||||
@ -324,11 +324,13 @@ Bucket created successfully ‘s3/mybucket’.
|
||||
Note that when a bucket is removed all policies associated with the bucket will also be removed. If you would like to just
|
||||
empty the objects in a bucket use `rm` command
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc rb [FLAGS] TARGET [TARGET...]
|
||||
|
||||
FLAGS:
|
||||
--force allow a recursive remove operation
|
||||
--dangerous allow site-wide removal of objects
|
||||
--help, -h show help
|
||||
|
||||
```
|
||||
@ -336,8 +338,8 @@ FLAGS:
|
||||
*Example: Remove a bucket named "mybucket" on https://play.min.io:9000.*
|
||||
|
||||
|
||||
```sh
|
||||
mc rb play/mybucket --recursive --force
|
||||
```
|
||||
mc rb play/mybucket --force
|
||||
Bucket removed successfully ‘play/mybucket’.
|
||||
```
|
||||
|
||||
@ -345,7 +347,7 @@ Bucket removed successfully ‘play/mybucket’.
|
||||
### Command `cat` - Concatenate Objects
|
||||
`cat` command concatenates contents of a file or object to another. You may also use it to simply display the contents to stdout
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc cat [FLAGS] SOURCE [SOURCE...]
|
||||
|
||||
@ -359,14 +361,14 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Display the contents of a text file `myobject.txt`*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cat play/mybucket/myobject.txt
|
||||
Hello MinIO!!
|
||||
```
|
||||
|
||||
*Example: Display the contents of a server encrypted object `myencryptedobject.txt`*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cat --encrypt-key "play/mybucket=32byteslongsecretkeymustbegiven1" play/mybucket/myencryptedobject.txt
|
||||
Hello MinIO!!
|
||||
```
|
||||
@ -375,7 +377,7 @@ Hello MinIO!!
|
||||
### Command `sql` - Run sql queries on objects
|
||||
`sql` run sql queries on objects.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc sql [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -437,19 +439,19 @@ COMPRESSION TYPE
|
||||
|
||||
*Example: Select all columns on a set of objects recursively on AWS S3*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc sql --recursive --query "select * from S3Object" s3/personalbucket/my-large-csvs/
|
||||
```
|
||||
|
||||
*Example: Run an aggregation query on an object on MinIO*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc sql --query "select count(s.power) from S3Object" myminio/iot-devices/power-ratio.csv
|
||||
```
|
||||
|
||||
*Example: Run an aggregation query on an encrypted object with customer provided keys*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc sql --encrypt-key "myminio/iot-devices=32byteslongsecretkeymustbegiven1" \
|
||||
--query "select count(s.power) from S3Object" myminio/iot-devices/power-ratio-encrypted.csv
|
||||
```
|
||||
@ -460,7 +462,7 @@ For more query examples refer to official AWS S3 documentation [here](https://do
|
||||
### Command `head` - Display few lines of object
|
||||
`head` display first 'n' lines of an object
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc head [FLAGS] SOURCE [SOURCE...]
|
||||
|
||||
@ -475,14 +477,14 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Display the first line of a text file `myobject.txt`*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc head -n 1 play/mybucket/myobject.txt
|
||||
Hello!!
|
||||
```
|
||||
|
||||
*Example: Display the first line of a server encrypted object `myencryptedobject.txt`*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc head -n 1 --encrypt-key "play/mybucket=32byteslongsecretkeymustbegiven1" play/mybucket/myencryptedobject.txt
|
||||
Hello!!
|
||||
```
|
||||
@ -491,7 +493,7 @@ Hello!!
|
||||
### Command `pipe` - Pipe to Object
|
||||
`pipe` command copies contents of stdin to a target. When no target is specified, it writes to stdout.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc pipe [FLAGS] [TARGET]
|
||||
|
||||
@ -507,15 +509,16 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Stream MySQL database dump to Amazon S3 directly.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mysqldump -u root -p ******* accountsdb | mc pipe s3/sql-backups/backups/accountsdb-oct-9-2015.sql
|
||||
```
|
||||
|
||||
|
||||
<a name="cp"></a>
|
||||
### Command `cp` - Copy Objects
|
||||
`cp` command copies data from one or more sources to a target. All copy operations to object storage are verified with MD5SUM checksums. Interrupted or failed copy operations can be resumed from the point of failure.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc cp [FLAGS] SOURCE [SOURCE...] TARGET
|
||||
|
||||
@ -524,6 +527,7 @@ FLAGS:
|
||||
--older-than value copy object(s) older than N days (default: 0)
|
||||
--newer-than value copy object(s) newer than N days (default: 0)
|
||||
--storage-class value, --sc value set storage class for new object(s) on target
|
||||
--attr add custom metadata for the object
|
||||
--encrypt value encrypt/decrypt objects (using server-side encryption with server managed keys)
|
||||
--encrypt-key value encrypt/decrypt objects (using server-side encryption with customer provided keys)
|
||||
--attr apply metadata to objects (format: KeyName1=string,KeyName2=string)
|
||||
@ -536,28 +540,35 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Copy a text file to an object storage.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cp myobject.txt play/mybucket
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
|
||||
*Example: Copy a text file to an object storage with specified metadata.*
|
||||
|
||||
```
|
||||
mc cp --attr key1=value1,key2=value2 myobject.txt play/mybucket
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
|
||||
*Example: Copy a text file to an object storage and assign storage-class `REDUCED_REDUNDANCY` to the uploaded object.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cp --storage-class REDUCED_REDUNDANCY myobject.txt play/mybucket
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
|
||||
*Example: Copy a server-side encrypted file to an object storage.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cp --recursive --encrypt-key "s3/documents/=32byteslongsecretkeymustbegiven1 , myminio/documents/=32byteslongsecretkeymustbegiven2" s3/documents/myobject.txt myminio/documents/
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
|
||||
*Example: Perform key-rotation on a server-side encrypted object*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cp --encrypt-key 'myminio1/mybucket=32byteslongsecretkeymustgenerate , myminio2/mybucket/=32byteslongsecretkeymustgenerat1' myminio1/mybucket/encryptedobject myminio2/mybucket/encryptedobject
|
||||
encryptedobject: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
@ -574,7 +585,7 @@ myscript.js: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
|
||||
### Command `rm` - Remove Objects
|
||||
Use `rm` command to remove file or object
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc rm [FLAGS] TARGET [TARGET ...]
|
||||
|
||||
@ -585,8 +596,8 @@ FLAGS:
|
||||
--incomplete, -I remove incomplete uploads
|
||||
--fake perform a fake remove operation
|
||||
--stdin read object names from STDIN
|
||||
--older-than value remove objects older than L days, M hours and N minutes LNM[d|h|m]. (default: 0)
|
||||
--newer-than value remove objects newer than L days, M hours and N minutes LNM[d|h|m]. (default: 0)
|
||||
--older-than value remove objects older than L days, M hours and N minutes LMN[d|h|m]. (default: 0)
|
||||
--newer-than value remove objects newer than L days, M hours and N minutes LMN[d|h|m]. (default: 0)
|
||||
--encrypt-key value encrypt/decrypt objects (using server-side encryption with customer provided keys)
|
||||
--help, -h show help
|
||||
|
||||
@ -596,20 +607,20 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Remove a single object.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm play/mybucket/myobject.txt
|
||||
Removing `play/mybucket/myobject.txt`.
|
||||
```
|
||||
*Example: Remove an encrypted object.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --encrypt-key "play/mybucket=32byteslongsecretkeymustbegiven1" play/mybucket/myobject.txt
|
||||
Removing `play/mybucket/myobject.txt`.
|
||||
```
|
||||
|
||||
*Example: Recursively remove a bucket's contents. Since this is a dangerous operation, you must explicitly pass `--force` option.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --recursive --force play/mybucket
|
||||
Removing `play/mybucket/newfile.txt`.
|
||||
Removing `play/mybucket/otherobject.txt`.
|
||||
@ -617,13 +628,13 @@ Removing `play/mybucket/otherobject.txt`.
|
||||
|
||||
*Example: Remove all uploaded incomplete files for an object.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --incomplete play/mybucket/myobject.1gig
|
||||
Removing `play/mybucket/myobject.1gig`.
|
||||
```
|
||||
*Example: Remove object and output a message only if the object is created older than 1 day, 2 hours and 30 minutes. Otherwise, the command stays quiet and nothing is printed out.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm -r --force --older-than 1d2h30m myminio/mybucket
|
||||
Removing `myminio/mybucket/dayOld1.txt`.
|
||||
Removing `myminio/mybucket/dayOld2.txt`.
|
||||
@ -636,7 +647,7 @@ Removing `myminio/mybucket/dayOld3.txt`.
|
||||
|
||||
Generated URL has access credentials encoded in it. Any attempt to tamper the URL will invalidate the access. To understand how this mechanism works, please follow [Pre-Signed URL](http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) technique.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc share [FLAGS] COMMAND
|
||||
|
||||
@ -652,7 +663,7 @@ COMMANDS:
|
||||
### Sub-command `share download` - Share Download
|
||||
`share download` command generates URLs to download objects without requiring access and secret keys. Expiry option sets the maximum validity period (no more than 7 days), beyond which the access is revoked automatically.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc share download [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -664,7 +675,7 @@ FLAGS:
|
||||
|
||||
*Example: Grant temporary access to an object with 4 hours expiry limit.*
|
||||
|
||||
```sh
|
||||
```
|
||||
|
||||
mc share download --expire 4h play/mybucket/myobject.txt
|
||||
URL: https://play.min.io:9000/mybucket/myobject.txt
|
||||
@ -676,7 +687,7 @@ Share: https://play.min.io:9000/mybucket/myobject.txt?X-Amz-Algorithm=AWS4-HMAC-
|
||||
#### Sub-command `share upload` - Share Upload
|
||||
`share upload` command generates a ‘curl’ command to upload objects without requiring access/secret keys. Expiry option sets the maximum validity period (no more than 7 days), beyond which the access is revoked automatically. Content-type option restricts uploads to only certain type of files.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc share upload [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -689,7 +700,7 @@ FLAGS:
|
||||
|
||||
*Example: Generate a `curl` command to enable upload access to `play/mybucket/myotherobject.txt`. User replaces `<FILE>` with the actual filename to upload*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc share upload play/mybucket/myotherobject.txt
|
||||
URL: https://play.min.io:9000/mybucket/myotherobject.txt
|
||||
Expire: 7 days 0 hours 0 minutes 0 seconds
|
||||
@ -699,7 +710,7 @@ Share: curl https://play.min.io:9000/mybucket -F x-amz-date=20160408T182356Z -F
|
||||
#### Sub-command `share list` - Share List
|
||||
`share list` command lists unexpired URLs that were previously shared
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc share list COMMAND
|
||||
|
||||
@ -712,7 +723,7 @@ COMMAND:
|
||||
### Command `mirror` - Mirror Buckets
|
||||
`mirror` command is similar to `rsync`, except it synchronizes contents between filesystems and object storage.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc mirror [FLAGS] SOURCE TARGET
|
||||
|
||||
@ -738,14 +749,14 @@ ENVIRONMENT VARIABLES:
|
||||
|
||||
*Example: Mirror a local directory to 'mybucket' on https://play.min.io:9000.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mirror localdir/ play/mybucket
|
||||
localdir/b.txt: 40 B / 40 B ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 73 B/s 0
|
||||
```
|
||||
|
||||
*Example: Continuously watch for changes on a local directory and mirror the changes to 'mybucket' on https://play.min.io:9000.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mirror -w localdir play/mybucket
|
||||
localdir/new.txt: 10 MB / 10 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 1 MB/s 15s
|
||||
```
|
||||
@ -754,7 +765,7 @@ localdir/new.txt: 10 MB / 10 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓
|
||||
### Command `find` - Find files and objects
|
||||
``find`` command finds files which match the given set of parameters. It only lists the contents which match the given set of criteria.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc find PATH [FLAGS]
|
||||
|
||||
@ -777,7 +788,7 @@ FLAGS:
|
||||
```
|
||||
|
||||
*Example: Find all jpeg images from s3 bucket and copy to MinIO "play/bucket" bucket continuously.*
|
||||
```sh
|
||||
```
|
||||
mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket"
|
||||
```
|
||||
|
||||
@ -787,7 +798,7 @@ mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket"
|
||||
|
||||
It *DOES NOT* compare the contents, so it is possible that the objects which are of same name and of the same size, but have difference in contents are not detected. This way, it can perform high speed comparison on large volumes or between sites
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc diff [FLAGS] FIRST SECOND
|
||||
|
||||
@ -801,14 +812,14 @@ FLAGS:
|
||||
--help, -h Show help.
|
||||
|
||||
LEGEND:
|
||||
> - object is only in source.
|
||||
< - object is only in destination.
|
||||
< - object is only in source.
|
||||
> - object is only in destination.
|
||||
! - newer object is in source.
|
||||
```
|
||||
|
||||
*Example: Compare a local directory and a remote object storage.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc diff localdir play/mybucket
|
||||
‘localdir/notes.txt’ and ‘https://play.min.io:9000/mybucket/notes.txt’ - only in first.
|
||||
```
|
||||
@ -818,7 +829,7 @@ JSON option enables parseable output in JSON format.
|
||||
|
||||
*Example: diff json output.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc diff minio1/diffbucket minio2/diffbucket --json
|
||||
{"status":"success","first":"","second":"http://127.0.0.1:9001/diffbucket/file1.png","diff":5}
|
||||
{"status":"success","first":"http://127.0.0.1:9000/diffbucket/file2.png","second":"","diff":4}
|
||||
@ -841,7 +852,7 @@ mc diff minio1/diffbucket minio2/diffbucket --json
|
||||
``watch`` provides a convenient way to watch on various types of event notifications on object
|
||||
storage and filesystem.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc watch [FLAGS] PATH
|
||||
|
||||
@ -855,7 +866,7 @@ FLAGS:
|
||||
|
||||
*Example: Watch for all events on object storage*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc watch play/testbucket
|
||||
[2016-08-18T00:51:29.735Z] 2.7KiB ObjectCreated https://play.min.io:9000/testbucket/CONTRIBUTING.md
|
||||
[2016-08-18T00:51:29.780Z] 1009B ObjectCreated https://play.min.io:9000/testbucket/MAINTAINERS.md
|
||||
@ -864,7 +875,7 @@ mc watch play/testbucket
|
||||
|
||||
*Example: Watch for all events on local directory*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc watch ~/Photos
|
||||
[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg
|
||||
[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg
|
||||
@ -876,7 +887,7 @@ mc watch ~/Photos
|
||||
### Command `event` - Manage bucket event notification.
|
||||
``event`` provides a convenient way to configure various types of event notifications on a bucket. MinIO event notification can be configured to use AMQP, Redis, ElasticSearch, NATS and PostgreSQL services. MinIO configuration provides more details on how these services can be configured.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc event COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -891,28 +902,28 @@ FLAGS:
|
||||
|
||||
*Example: List all configured bucket notifications*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc event list play/andoria
|
||||
MyTopic arn:minio:sns:us-east-1:1:TestTopic s3:ObjectCreated:*,s3:ObjectRemoved:* suffix:.jpg
|
||||
```
|
||||
|
||||
*Example: Add a new 'sqs' notification resource only to notify on ObjectCreated event*
|
||||
|
||||
```sh
|
||||
mc event add play/andoria arn:minio:sqs:us-east-1:1:your-queue --events put
|
||||
```
|
||||
mc event add play/andoria arn:minio:sqs:us-east-1:1:your-queue --event put
|
||||
```
|
||||
|
||||
*Example: Add a new 'sqs' notification resource with filters*
|
||||
|
||||
Add `prefix` and `suffix` filtering rules for `sqs` notification resource.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc event add play/andoria arn:minio:sqs:us-east-1:1:your-queue --prefix photos/ --suffix .jpg
|
||||
```
|
||||
|
||||
*Example: Remove a 'sqs' notification resource*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc event remove play/andoria arn:minio:sqs:us-east-1:1:your-queue
|
||||
```
|
||||
|
||||
@ -920,7 +931,7 @@ mc event remove play/andoria arn:minio:sqs:us-east-1:1:your-queue
|
||||
### Command `policy` - Manage bucket policies
|
||||
Manage anonymous bucket policies to a bucket and its contents
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc policy [FLAGS] PERMISSION TARGET
|
||||
mc policy [FLAGS] FILE TARGET
|
||||
@ -941,7 +952,7 @@ FLAGS:
|
||||
|
||||
Show current anonymous bucket policy for ``mybucket/myphotos/2020/`` sub-directory
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is ‘none’
|
||||
```
|
||||
@ -950,7 +961,7 @@ Access permission for ‘play/mybucket/myphotos/2020/’ is ‘none’
|
||||
|
||||
Set anonymous bucket policy for ``mybucket/myphotos/2020/`` sub-directory and its objects to ``download`` only. Now, objects under the sub-directory are publicly accessible. e.g ``mybucket/myphotos/2020/yourobjectname``is available at [https://play.min.io:9000/mybucket/myphotos/2020/yourobjectname](https://play.min.io:9000/mybucket/myphotos/2020/yourobjectname)
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy download play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'download'
|
||||
```
|
||||
@ -959,7 +970,7 @@ Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'download'
|
||||
|
||||
Configure bucket policy for ``mybucket`` with a policy JSON file.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy /tmp/policy.json play/mybucket
|
||||
Access permission for `play/mybucket` is set from `/tmp/policy.json`
|
||||
```
|
||||
@ -968,7 +979,7 @@ Access permission for `play/mybucket` is set from `/tmp/policy.json`
|
||||
|
||||
Remove any bucket policy for *mybucket/myphotos/2020/* sub-directory.
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy none play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'none'
|
||||
```
|
||||
@ -981,7 +992,7 @@ Please visit [here](https://docs.min.io/docs/minio-admin-complete-guide) for a m
|
||||
### Command `session` - Manage Sessions
|
||||
``session`` command manages previously saved sessions for `cp` and `mirror` operations
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc session COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -997,7 +1008,7 @@ FLAGS:
|
||||
|
||||
*Example: List all previously saved sessions.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session list
|
||||
IXWKjpQM -> [2016-04-08 19:11:14 IST] cp assets.go play/mybucket
|
||||
ApwAxSwa -> [2016-04-08 01:49:19 IST] mirror miniodoc/ play/mybucket
|
||||
@ -1005,14 +1016,14 @@ ApwAxSwa -> [2016-04-08 01:49:19 IST] mirror miniodoc/ play/mybucket
|
||||
|
||||
*Example: Resume a previously saved session.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session resume IXWKjpQM
|
||||
...assets.go: 1.68 KB / 1.68 KB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 784 B/s 2s
|
||||
```
|
||||
|
||||
*Example: Drop a previously saved session.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session clear ApwAxSwa
|
||||
Session ‘ApwAxSwa’ cleared successfully.
|
||||
```
|
||||
@ -1021,7 +1032,7 @@ Session ‘ApwAxSwa’ cleared successfully.
|
||||
### Command `config` - Manage Config File
|
||||
`config host` command provides a convenient way to manage host entries in your config file `~/.mc/config.json`. It is also OK to edit the config file manually using a text editor.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc config host COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -1038,17 +1049,29 @@ FLAGS:
|
||||
|
||||
Add MinIO server access and secret keys to config file host entry. Note that, the history feature of your shell may record these keys and pose a security risk. On `bash` shell, use `set -o` and `set +o` to disable and enable history feature momentarily.
|
||||
|
||||
```sh
|
||||
```
|
||||
set +o history
|
||||
mc config host add myminio http://localhost:9000 OMQAGGOL63D7UNVQFY8X GcY5RHNmnEWvD/1QxD3spEIGj+Vt9L7eHaAaBTkJ
|
||||
set -o history
|
||||
```
|
||||
|
||||
Remove the host from the config file.
|
||||
|
||||
```
|
||||
mc config host remove myminio
|
||||
```
|
||||
|
||||
List all configured host
|
||||
|
||||
```
|
||||
mc config host list
|
||||
```
|
||||
|
||||
<a name="update"></a>
|
||||
### Command `update` - Software Updates
|
||||
Check for new software updates from [https://dl.min.io](https://dl.min.io). Experimental flag checks for unstable experimental releases primarily meant for testing purposes.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc update [FLAGS]
|
||||
|
||||
@ -1060,7 +1083,7 @@ FLAGS:
|
||||
|
||||
*Example: Check for an update.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc update
|
||||
You are already running the most recent version of ‘mc’.
|
||||
```
|
||||
@ -1069,7 +1092,7 @@ You are already running the most recent version of ‘mc’.
|
||||
### Command `version` - Display Version
|
||||
Display the current version of `mc` installed
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc version [FLAGS]
|
||||
|
||||
@ -1081,7 +1104,7 @@ FLAGS:
|
||||
|
||||
*Example: Print version of mc.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc version
|
||||
Version: 2016-04-01T00:22:11Z
|
||||
Release-tag: RELEASE.2016-04-01T00-22-11Z
|
||||
@ -1091,7 +1114,7 @@ Commit-id: 12adf3be326f5b6610cdd1438f72dfd861597fce
|
||||
### Command `stat` - Stat contents of objects and folders
|
||||
`stat` command displays information on objects (with optional prefix) contained in the specified bucket on an object storage. On a filesystem, it behaves like `stat` command.
|
||||
|
||||
```sh
|
||||
```
|
||||
USAGE:
|
||||
mc stat [FLAGS] TARGET
|
||||
|
||||
@ -1107,7 +1130,7 @@ ENVIRONMENT VARIABLES:
|
||||
*Example: Display information on a bucket named "mybucket" on https://play.min.io:9000.*
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc stat play/mybucket
|
||||
Name : mybucket/
|
||||
Date : 2018-02-06 18:06:51 PST
|
||||
@ -1118,7 +1141,7 @@ Type : folder
|
||||
*Example: Display information on an encrypted object "myobject" in "mybucket" on https://play.min.io:9000.*
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc stat play/mybucket/myobject --encrypt-key "play/mybucket=32byteslongsecretkeymustbegiven1"
|
||||
Name : myobject
|
||||
Date : 2018-03-02 11:47:13 PST
|
||||
@ -1133,7 +1156,7 @@ Metadata :
|
||||
|
||||
*Example: Display information on objects contained in the bucket named "mybucket" on https://play.min.io:9000.*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc stat -r play/mybucket
|
||||
Name : mybucket/META/textfile
|
||||
Date : 2018-02-06 18:17:38 PST
|
||||
|
@ -7,7 +7,7 @@ MinIO Client configurations are stored in file name ``.mc``. It is a hidden fil
|
||||
|
||||
**This how the structure of the directory looks like:**
|
||||
|
||||
```sh
|
||||
```
|
||||
tree ~/.mc
|
||||
/home/supernova/.mc
|
||||
├── config.json
|
||||
@ -23,7 +23,7 @@ tree ~/.mc
|
||||
#### ``config.json``
|
||||
config.json is the configuration file for MinIO Client, it gets generated after you install and start MinIO. All the credentials, endpoint information we add via ``mc config host`` are stored/modified here.
|
||||
|
||||
```sh
|
||||
```
|
||||
cat config.json
|
||||
{
|
||||
"version": "8",
|
||||
|
@ -1,6 +1,6 @@
|
||||
### 设置你的mc Github Repository
|
||||
Fork [mc upstream](https://github.com/minio/mc/fork)源码仓库到你的个人仓库。
|
||||
```sh
|
||||
```
|
||||
$ mkdir -p $GOPATH/src/github.com/minio
|
||||
$ cd $GOPATH/src/github.com/minio
|
||||
$ git clone https://github.com/$USER_ID/mc
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
MinIO Client (mc)为ls,cat,cp,mirror,diff,find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。
|
||||
|
||||
```sh
|
||||
```
|
||||
ls 列出文件和文件夹。
|
||||
mb 创建一个存储桶或一个文件夹。
|
||||
cat 显示文件和对象内容。
|
||||
@ -37,7 +37,7 @@ docker run minio/mc:edge ls play
|
||||
|
||||
**注意:** 上述示例默认使用MinIO[演示环境](#test-your-setup)做演示,如果想用`mc`操作其它S3兼容的服务,采用下面的方式来启动容器:
|
||||
|
||||
```sh
|
||||
```
|
||||
docker run -it --entrypoint=/bin/sh minio/mc
|
||||
```
|
||||
|
||||
@ -46,7 +46,7 @@ docker run -it --entrypoint=/bin/sh minio/mc
|
||||
### Homebrew (macOS)
|
||||
使用[Homebrew](http://brew.sh/)安装mc。
|
||||
|
||||
```sh
|
||||
```
|
||||
brew install minio/stable/mc
|
||||
mc --help
|
||||
```
|
||||
@ -56,7 +56,7 @@ mc --help
|
||||
| ---------- | -------- |------|
|
||||
|GNU/Linux|64-bit Intel|https://dl.min.io/client/mc/release/linux-amd64/mc |
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
@ -66,7 +66,7 @@ chmod +x mc
|
||||
| ---------- | -------- |------|
|
||||
|Microsoft Windows|64-bit Intel|https://dl.min.io/client/mc/release/windows-amd64/mc.exe |
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -75,7 +75,7 @@ mc.exe --help
|
||||
|
||||
如果您没有Golang环境,请按照 [如何安装Golang](https://docs.min.io/docs/how-to-install-golang)。
|
||||
|
||||
```sh
|
||||
```
|
||||
go get -d github.com/minio/mc
|
||||
cd ${GOPATH}/src/github.com/minio/mc
|
||||
make
|
||||
@ -85,21 +85,21 @@ make
|
||||
|
||||
### GNU/Linux
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod +x mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
||||
```sh
|
||||
```
|
||||
chmod 755 mc
|
||||
./mc --help
|
||||
```
|
||||
|
||||
### Microsoft Windows
|
||||
|
||||
```sh
|
||||
```
|
||||
mc.exe --help
|
||||
```
|
||||
|
||||
@ -110,7 +110,7 @@ mc.exe --help
|
||||
|
||||
#### 使用
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> <API-SIGNATURE>
|
||||
```
|
||||
|
||||
@ -120,21 +120,21 @@ mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY
|
||||
从MinIO服务获得URL、access key和secret key。
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
|
||||
```
|
||||
|
||||
### 示例-Amazon S3云存储
|
||||
参考[AWS Credentials指南](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)获取你的AccessKeyID和SecretAccessKey。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4
|
||||
```
|
||||
|
||||
### 示例-Google云存储
|
||||
参考[Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)获取你的AccessKeyID和SecretAccessKey。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
|
||||
```
|
||||
|
||||
@ -147,7 +147,7 @@ mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1
|
||||
|
||||
列出[https://play.min.io:9000](https://play.min.io:9000)上的所有存储桶。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
|
||||
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
|
||||
@ -159,7 +159,7 @@ mc ls play
|
||||
## 5. 日常使用
|
||||
你可以添加shell别名来覆盖默认的Unix工具命令。
|
||||
|
||||
```sh
|
||||
```
|
||||
alias ls='mc ls'
|
||||
alias cp='mc cp'
|
||||
alias cat='mc cat'
|
||||
@ -175,7 +175,7 @@ Debug参数开启控制台输出debug信息。
|
||||
|
||||
*示例:输出`ls`命令的详细debug信息。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc --debug ls play
|
||||
mc: <DEBUG> GET / HTTP/1.1
|
||||
Host: play.min.io:9000
|
||||
@ -210,7 +210,7 @@ JSON参数启用JSON格式的输出。
|
||||
|
||||
*示例:列出MinIO play服务的所有存储桶。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc --json ls play
|
||||
{"status":"success","type":"folder","lastModified":"2016-04-08T03:56:14.577+05:30","size":0,"key":"albums/"}
|
||||
{"status":"success","type":"folder","lastModified":"2016-04-04T16:11:45.349+05:30","size":0,"key":"backup/"}
|
||||
@ -245,7 +245,7 @@ mc --json ls play
|
||||
### `ls`命令 - 列出对象
|
||||
`ls`命令列出文件、对象和存储桶。使用`--incomplete` flag可列出未完整拷贝的内容。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc ls [FLAGS] TARGET [TARGET ...]
|
||||
|
||||
@ -257,7 +257,7 @@ FLAGS:
|
||||
|
||||
*示例: 列出所有https://play.min.io:9000上的存储桶。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc ls play
|
||||
[2016-04-08 03:56:14 IST] 0B albums/
|
||||
[2016-04-04 16:11:45 IST] 0B backup/
|
||||
@ -270,7 +270,7 @@ mc ls play
|
||||
`mb`命令在对象存储上创建一个新的存储桶。在文件系统,它就和`mkdir -p`命令是一样的。存储桶相当于文件系统中的磁盘或挂载点,不应视为文件夹。MinIO对每个用户创建的存储桶数量没有限制。
|
||||
在Amazon S3上,每个帐户被限制为100个存储桶。有关更多信息,请参阅[S3上的存储桶限制和限制](http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html) 。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc mb [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -283,7 +283,7 @@ FLAGS:
|
||||
*示例:在https://play.min.io:9000上创建一个名叫"mybucket"的存储桶。*
|
||||
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mb play/mybucket
|
||||
Bucket created successfully ‘play/mybucket’.
|
||||
```
|
||||
@ -293,7 +293,7 @@ Bucket created successfully ‘play/mybucket’.
|
||||
### `cat`命令 - 合并对象
|
||||
`cat`命令将一个文件或者对象的内容合并到另一个上。你也可以用它将对象的内容输出到stdout。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc cat [FLAGS] SOURCE [SOURCE...]
|
||||
|
||||
@ -303,7 +303,7 @@ FLAGS:
|
||||
|
||||
*示例: 显示`myobject.txt`文件的内容*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cat play/mybucket/myobject.txt
|
||||
Hello MinIO!!
|
||||
```
|
||||
@ -311,7 +311,7 @@ Hello MinIO!!
|
||||
### `pipe`命令 - Pipe到对象
|
||||
`pipe`命令拷贝stdin里的内容到目标输出,如果没有指定目标输出,则输出到stdout。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc pipe [FLAGS] [TARGET]
|
||||
|
||||
@ -321,7 +321,7 @@ FLAGS:
|
||||
|
||||
*示例: 将MySQL数据库dump文件输出到Amazon S3。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mysqldump -u root -p ******* accountsdb | mc pipe s3/sql-backups/backups/accountsdb-oct-9-2015.sql
|
||||
```
|
||||
|
||||
@ -329,7 +329,7 @@ mysqldump -u root -p ******* accountsdb | mc pipe s3/sql-backups/backups/account
|
||||
### `cp`命令 - 拷贝对象
|
||||
`cp`命令拷贝一个或多个源文件目标输出。所有到对象存储的拷贝操作都进行了MD4SUM checkSUM校验。可以从故障点恢复中断或失败的复制操作。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc cp [FLAGS] SOURCE [SOURCE...] TARGET
|
||||
|
||||
@ -340,7 +340,7 @@ FLAGS:
|
||||
|
||||
*示例: 拷贝一个文本文件到对象存储。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc cp myobject.txt play/mybucket
|
||||
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
|
||||
```
|
||||
@ -348,7 +348,7 @@ myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
|
||||
### `rm`命令 - 删除存储桶和对象。
|
||||
使用`rm`命令删除文件对象或者存储桶。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc rm [FLAGS] TARGET [TARGET ...]
|
||||
|
||||
@ -365,14 +365,14 @@ FLAGS:
|
||||
|
||||
*示例: 删除一个对象。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm play/mybucket/myobject.txt
|
||||
Removed ‘play/mybucket/myobject.txt’.
|
||||
```
|
||||
|
||||
*示例:删除一个存储桶并递归删除里面所有的内容。由于这个操作太危险了,你必须传`--force`参数指定强制删除。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --recursive --force play/myobject
|
||||
Removed ‘play/myobject/newfile.txt’.
|
||||
Removed 'play/myobject/otherobject.txt’.
|
||||
@ -380,14 +380,14 @@ Removed 'play/myobject/otherobject.txt’.
|
||||
|
||||
*示例: 从`mybucket`里删除所有未完整上传的对象。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --incomplete --recursive --force play/mybucket
|
||||
Removed ‘play/mybucket/mydvd.iso’.
|
||||
Removed 'play/mybucket/backup.tgz’.
|
||||
```
|
||||
*示例: 删除一天前的对象。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc rm --force --older-than=1 play/mybucket/oldsongs
|
||||
```
|
||||
|
||||
@ -397,7 +397,7 @@ mc rm --force --older-than=1 play/mybucket/oldsongs
|
||||
|
||||
生成的网址中含有编码后的访问认证信息,任何企图篡改URL的行为都会使访问无效。想了解这种机制是如何工作的,请参考[Pre-Signed URL](http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html)技术。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc share [FLAGS] COMMAND
|
||||
|
||||
@ -413,7 +413,7 @@ COMMANDS:
|
||||
### 子命令`share download` - 共享下载
|
||||
`share download`命令生成不需要access key和secret key即可下载的URL,过期参数设置成最大有效期(不大于7天),过期之后权限自动回收。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc share download [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -425,7 +425,7 @@ FLAGS:
|
||||
|
||||
*示例: 生成一个对一个对象有4小时访问权限的URL。*
|
||||
|
||||
```sh
|
||||
```
|
||||
|
||||
mc share download --expire 4h play/mybucket/myobject.txt
|
||||
URL: https://play.min.io:9000/mybucket/myobject.txt
|
||||
@ -438,7 +438,7 @@ Share: https://play.min.io:9000/mybucket/myobject.txt?X-Amz-Algorithm=AWS4-HMAC-
|
||||
`share upload`命令生成不需要access key和secret key即可上传的URL。过期参数设置成最大有效期(不大于7天),过期之后权限自动回收。
|
||||
Content-type参数限制只允许上传指定类型的文件。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc share upload [FLAGS] TARGET [TARGET...]
|
||||
|
||||
@ -450,7 +450,7 @@ FLAGS:
|
||||
|
||||
*示例: 生成一个`curl`命令,赋予上传到`play/mybucket/myotherobject.txt`的权限。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc share upload play/mybucket/myotherobject.txt
|
||||
URL: https://play.min.io:9000/mybucket/myotherobject.txt
|
||||
Expire: 7 days 0 hours 0 minutes 0 seconds
|
||||
@ -460,7 +460,7 @@ Share: curl https://play.min.io:9000/mybucket -F x-amz-date=20160408T182356Z -F
|
||||
#### 子命令`share list` - 列出之前的共享
|
||||
`share list`列出没未过期的共享URL。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc share list COMMAND
|
||||
|
||||
@ -473,7 +473,7 @@ COMMAND:
|
||||
### `mirror`命令 - 存储桶镜像
|
||||
`mirror`命令和`rsync`类似,只不过它是在文件系统和对象存储之间做同步。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc mirror [FLAGS] SOURCE TARGET
|
||||
|
||||
@ -487,14 +487,14 @@ FLAGS:
|
||||
|
||||
*示例: 将一个本地文件夹镜像到https://play.min.io:9000上的'mybucket'存储桶。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mirror localdir/ play/mybucket
|
||||
localdir/b.txt: 40 B / 40 B ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 73 B/s 0
|
||||
```
|
||||
|
||||
*示例: 持续监听本地文件夹修改并镜像到https://play.min.io:9000上的'mybucket'存储桶。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc mirror -w localdir play/mybucket
|
||||
localdir/new.txt: 10 MB / 10 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00 % 1 MB/s 15s
|
||||
```
|
||||
@ -503,7 +503,7 @@ localdir/new.txt: 10 MB / 10 MB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓
|
||||
### `find`命令 - 查找文件和对象
|
||||
``find``命令通过指定参数查找文件,它只列出满足条件的数据。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc find PATH [FLAGS]
|
||||
|
||||
@ -516,7 +516,7 @@ FLAGS:
|
||||
```
|
||||
|
||||
*示例: 持续从s3存储桶中查找所有jpeg图像,并复制到minio "play/bucket"存储桶*
|
||||
```sh
|
||||
```
|
||||
mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket"
|
||||
```
|
||||
|
||||
@ -526,7 +526,7 @@ mc find s3/bucket --name "*.jpg" --watch --exec "mc cp {} play/bucket"
|
||||
|
||||
它*不*比较内容,所以可能的是,名称相同,大小相同但内容不同的对象没有被检测到。这样,它可以在不同站点或者大量数据的情况下快速比较。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc diff [FLAGS] FIRST SECOND
|
||||
|
||||
@ -536,7 +536,7 @@ FLAGS:
|
||||
|
||||
*示例: 比较一个本地文件夹和一个远程对象存储服务*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc diff localdir play/mybucket
|
||||
‘localdir/notes.txt’ and ‘https://play.min.io:9000/mybucket/notes.txt’ - only in first.
|
||||
```
|
||||
@ -545,7 +545,7 @@ FLAGS:
|
||||
### `watch`命令 - 监听文件和对象存储事件。
|
||||
``watch``命令提供了一种方便监听对象存储和文件系统上不同类型事件的方式。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc watch [FLAGS] PATH
|
||||
|
||||
@ -559,7 +559,7 @@ FLAGS:
|
||||
|
||||
*示例: 监听对象存储的所有事件*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc watch play/testbucket
|
||||
[2016-08-18T00:51:29.735Z] 2.7KiB ObjectCreated https://play.min.io:9000/testbucket/CONTRIBUTING.md
|
||||
[2016-08-18T00:51:29.780Z] 1009B ObjectCreated https://play.min.io:9000/testbucket/MAINTAINERS.md
|
||||
@ -568,7 +568,7 @@ mc watch play/testbucket
|
||||
|
||||
*示例: 监听本地文件夹的所有事件*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc watch ~/Photos
|
||||
[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg
|
||||
[2016-08-17T17:54:19.565Z] 3.7MiB ObjectCreated /home/minio/Downloads/tmp/5467026530_a8611b53f9_o.jpg
|
||||
@ -580,7 +580,7 @@ mc watch ~/Photos
|
||||
### `events`命令 - 管理存储桶事件通知。
|
||||
``events``提供了一种方便的配置存储桶的各种类型事件通知的方式。MinIO事件通知可以配置成使用 AMQP,Redis,ElasticSearch,NATS和PostgreSQL服务。MinIO configuration提供了如何配置的更多细节。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc events COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -595,14 +595,14 @@ FLAGS:
|
||||
|
||||
*示例: 列出所有存储桶通知。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc events list play/andoria
|
||||
MyTopic arn:minio:sns:us-east-1:1:TestTopic s3:ObjectCreated:*,s3:ObjectRemoved:* suffix:.jpg
|
||||
```
|
||||
|
||||
*示例: 添加一个新的'sqs'通知,仅接收ObjectCreated事件。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc events add play/andoria arn:minio:sqs:us-east-1:1:your-queue --events put
|
||||
```
|
||||
|
||||
@ -610,13 +610,13 @@ mc events add play/andoria arn:minio:sqs:us-east-1:1:your-queue --events put
|
||||
|
||||
给`sqs`通知添加`prefix`和`suffix`过滤规则。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc events add play/andoria arn:minio:sqs:us-east-1:1:your-queue --prefix photos/ --suffix .jpg
|
||||
```
|
||||
|
||||
*示例: 删除一个'sqs'通知*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc events remove play/andoria arn:minio:sqs:us-east-1:1:your-queue
|
||||
```
|
||||
|
||||
@ -624,7 +624,7 @@ mc events remove play/andoria arn:minio:sqs:us-east-1:1:your-queue
|
||||
### `policy`命令 - 管理存储桶策略
|
||||
管理匿名访问存储桶和其内部内容的策略。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc policy [FLAGS] PERMISSION TARGET
|
||||
mc policy [FLAGS] TARGET
|
||||
@ -641,7 +641,7 @@ FLAGS:
|
||||
|
||||
显示当前``mybucket/myphotos/2020/``子文件夹的匿名策略。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is ‘none’
|
||||
```
|
||||
@ -650,7 +650,7 @@ Access permission for ‘play/mybucket/myphotos/2020/’ is ‘none’
|
||||
|
||||
设置``mybucket/myphotos/2020/``子文件夹可匿名下载的策略。现在,这个文件夹下的对象可被公开访问。比如:``mybucket/myphotos/2020/yourobjectname``可通过这个URL [https://play.min.io:9000/mybucket/myphotos/2020/yourobjectname](https://play.min.io:9000/mybucket/myphotos/2020/yourobjectname)访问。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy download play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'download'
|
||||
```
|
||||
@ -659,7 +659,7 @@ Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'download'
|
||||
|
||||
删除所有*mybucket/myphotos/2020/*这个子文件夹下的匿名存储桶策略。
|
||||
|
||||
```sh
|
||||
```
|
||||
mc policy none play/mybucket/myphotos/2020/
|
||||
Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'none'
|
||||
```
|
||||
@ -668,7 +668,7 @@ Access permission for ‘play/mybucket/myphotos/2020/’ is set to 'none'
|
||||
### `session`命令 - 管理session
|
||||
``session``命令管理之前保存的`cp`和`mirror`操作的会话。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc session COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -684,7 +684,7 @@ FLAGS:
|
||||
|
||||
*示例: 列出所有之前保存的会话*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session list
|
||||
IXWKjpQM -> [2016-04-08 19:11:14 IST] cp assets.go play/mybucket
|
||||
ApwAxSwa -> [2016-04-08 01:49:19 IST] mirror miniodoc/ play/mybucket
|
||||
@ -692,14 +692,14 @@ ApwAxSwa -> [2016-04-08 01:49:19 IST] mirror miniodoc/ play/mybucket
|
||||
|
||||
*示例: 恢复一个之前保存的会话*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session resume IXWKjpQM
|
||||
...assets.go: 1.68 KB / 1.68 KB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 784 B/s 2s
|
||||
```
|
||||
|
||||
*示例: 清除一个之前保存的会话。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc session clear ApwAxSwa
|
||||
Session ‘ApwAxSwa’ cleared successfully.
|
||||
```
|
||||
@ -708,7 +708,7 @@ Session ‘ApwAxSwa’ cleared successfully.
|
||||
### `config`命令 - 管理配置文件
|
||||
`config host`命令提供了一个方便地管理`~/.mc/config.json`配置文件中的主机信息的方式,你也可以用文本编辑器手动修改这个配置文件。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc config host COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
|
||||
|
||||
@ -725,7 +725,7 @@ FLAGS:
|
||||
|
||||
添加MinIO服务的access和secret key到配置文件,注意,shell的history特性可能会记录这些信息,从而带来安全隐患。在`bash` shell,使用`set -o`和`set +o`来关闭和开启history特性。
|
||||
|
||||
```sh
|
||||
```
|
||||
set +o history
|
||||
mc config host add myminio http://localhost:9000 OMQAGGOL63D7UNVQFY8X GcY5RHNmnEWvD/1QxD3spEIGj+Vt9L7eHaAaBTkJ
|
||||
set -o history
|
||||
@ -735,7 +735,7 @@ set -o history
|
||||
### `update`命令 - 软件更新
|
||||
从[https://dl.min.io](https://dl.min.io)检查软件更新。Experimental标志会检查unstable实验性的版本,通常用作测试用途。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc update [FLAGS]
|
||||
|
||||
@ -747,7 +747,7 @@ FLAGS:
|
||||
|
||||
*示例: 检查更新*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc update
|
||||
You are already running the most recent version of ‘mc’.
|
||||
```
|
||||
@ -756,7 +756,7 @@ You are already running the most recent version of ‘mc’.
|
||||
### `version`命令 - 显示版本信息
|
||||
显示当前安装的`mc`版本。
|
||||
|
||||
```sh
|
||||
```
|
||||
用法:
|
||||
mc version [FLAGS]
|
||||
|
||||
@ -768,7 +768,7 @@ FLAGS:
|
||||
|
||||
*示例: 输出mc版本。*
|
||||
|
||||
```sh
|
||||
```
|
||||
mc version
|
||||
Version: 2016-04-01T00:22:11Z
|
||||
Release-tag: RELEASE.2016-04-01T00-22-11Z
|
||||
|
@ -7,7 +7,7 @@ MinIO Client配置信息存储在``.mc``文件夹,它是用户home目录下的
|
||||
|
||||
**这就是配置文件夹的目录结构:**
|
||||
|
||||
```sh
|
||||
```
|
||||
tree ~/.mc
|
||||
/home/supernova/.mc
|
||||
├── config.json
|
||||
@ -23,7 +23,7 @@ tree ~/.mc
|
||||
#### ``config.json``
|
||||
config.json是MinIO Client的配置文件,它在安装并启动MinIO后生成。我们通过``mc config host``添加的所有凭证,endpoint信息都存储在这里。
|
||||
|
||||
```sh
|
||||
```
|
||||
cat config.json
|
||||
{
|
||||
"version": "8",
|
||||
|
Loading…
x
Reference in New Issue
Block a user