doc: Improve examples.
This commit is contained in:
@@ -70,6 +70,10 @@ pkg-update:
|
||||
pkg-remove:
|
||||
@GO15VENDOREXPERIMENT=1 govendor remove $(PKG)
|
||||
|
||||
release: build
|
||||
@MINIO_RELEASE=OFFICIAL GO15VENDOREXPERIMENT=1 go build --ldflags $(BUILD_LDFLAGS) -o $(GOPATH)/bin/mc
|
||||
@mkdir -p $(HOME)/.mc
|
||||
|
||||
install: gomake-all
|
||||
|
||||
clean:
|
||||
|
||||
@@ -72,10 +72,6 @@ $ go get -u github.com/minio/mc
|
||||
|
||||
Minio cloud storage server is hosted at ``https://play.minio.io:9000`` for public use. This service is primarily intended for developers and users to familiarize themselves with Amazon S3 compatible cloud storage. Minio runs with filesystem backend with auto-expiry for objects in about 24 hours. No account signup is required, which means S3 compatible tools and applications can access this service without access and secret keys.
|
||||
|
||||
## How to use mc?
|
||||
|
||||
[](https://asciinema.org/a/21576?async)
|
||||
|
||||
## Configuring mc for Amazon S3
|
||||
|
||||
Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html).
|
||||
|
||||
+5
-5
@@ -54,19 +54,19 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Set bucket to "private" on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} set private https://s3.amazonaws.com/burningman2011
|
||||
$ mc {{.Name}} set private s3.amazonaws.com/burningman2011
|
||||
|
||||
2. Set bucket to "public" on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} set public https://s3.amazonaws.com/shared
|
||||
$ mc {{.Name}} set public s3.amazonaws.com/shared
|
||||
|
||||
3. Set bucket to "authenticated" on Amazon S3 cloud storage to provide read access to IAM Authenticated Users group.
|
||||
$ mc {{.Name}} set authorized https://s3.amazonaws.com/shared-authenticated
|
||||
$ mc {{.Name}} set authorized s3.amazonaws.com/shared-authenticated
|
||||
|
||||
4. Get bucket permissions.
|
||||
$ mc {{.Name}} get https://s3.amazonaws.com/shared
|
||||
$ mc {{.Name}} get s3.amazonaws.com/shared
|
||||
|
||||
5. Get bucket permissions.
|
||||
$ mc {{.Name}} get https://storage.googleapis.com/miniocloud
|
||||
$ mc {{.Name}} get storage.googleapis.com/miniocloud
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Stream an object from Amazon S3 cloud storage to mplayer standard input.
|
||||
$ mc {{.Name}} https://s3.amazonaws.com/ferenginar/klingon_opera_aktuh_maylotah.ogg | mplayer -
|
||||
$ mc {{.Name}} s3.amazonaws.com/ferenginar/klingon_opera_aktuh_maylotah.ogg | mplayer -
|
||||
|
||||
2. Concantenate contents of file1.txt and stdin to standard output.
|
||||
$ mc {{.Name}} file1.txt - > file.txt
|
||||
|
||||
+6
-6
@@ -43,19 +43,19 @@ FLAGS:
|
||||
EXAMPLES:
|
||||
1. Add host configuration for a URL, using default signature V4. For security reasons turn off bash history
|
||||
$ set +o history
|
||||
$ mc config {{.Name}} add https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
$ mc config {{.Name}} add s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
|
||||
$ set -o history
|
||||
|
||||
2. Add host configuration for a URL, using signature V2. For security reasons turn off bash history
|
||||
$ set +o history
|
||||
$ mc config {{.Name}} add https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
|
||||
$ mc config {{.Name}} add storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v2
|
||||
$ set -o history
|
||||
|
||||
3. List all hosts.
|
||||
$ mc config {{.Name}} list
|
||||
|
||||
4. Remove host config.
|
||||
$ mc config {{.Name}} remove https://s3.amazonaws.com
|
||||
$ mc config {{.Name}} remove s3.amazonaws.com
|
||||
|
||||
`,
|
||||
}
|
||||
@@ -171,9 +171,9 @@ func listHosts() {
|
||||
|
||||
func removeHost(hostURL string) {
|
||||
if !isValidHostURL(hostURL) {
|
||||
fatalIf(errDummy().Trace(hostURL), "Invalid host URL: ‘"+hostURL+"’ provided. Valid options are [https://example.test.io, https://bucket.s3.amazonaws.com].")
|
||||
fatalIf(errDummy().Trace(hostURL), "Invalid host URL: ‘"+hostURL+"’ provided. Valid options are [http://example.test.io, https://bucket.s3.amazonaws.com].")
|
||||
}
|
||||
if strings.TrimSpace(hostURL) == "https://dl.minio.io:9000" {
|
||||
if strings.TrimSpace(hostURL) == "dl.minio.io:9000" {
|
||||
fatalIf(errDummy().Trace(hostURL), "‘"+hostURL+"’ is reserved hostname and cannot be removed.")
|
||||
}
|
||||
config, err := newConfig()
|
||||
@@ -202,7 +202,7 @@ func removeHost(hostURL string) {
|
||||
func addHost(newHostURL, accessKeyID, secretAccessKey, api string) {
|
||||
if !isValidHostURL(newHostURL) {
|
||||
fatalIf(errDummy().Trace(newHostURL),
|
||||
"Invalid host URL: ‘"+newHostURL+"’ provided. Valid options are [https://example.test.io, https://bucket.s3.amazonaws.com].")
|
||||
"Invalid host URL: ‘"+newHostURL+"’ provided. Valid options are [example.test.io, bucket.s3.amazonaws.com].")
|
||||
}
|
||||
if len(accessKeyID) != 0 {
|
||||
if !isValidAccessKey(accessKeyID) {
|
||||
|
||||
+3
-3
@@ -65,13 +65,13 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Copy a list of objects from local file system to Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} Music/*.ogg https://s3.amazonaws.com/jukebox/
|
||||
$ mc {{.Name}} Music/*.ogg s3.amazonaws.com/jukebox/
|
||||
|
||||
2. Copy a folder recursively from Minio cloud storage to Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} --recursive https://play.minio.io:9000/mybucket/burningman2011/ https://s3.amazonaws.com/mybucket/
|
||||
$ mc {{.Name}} --recursive play.minio.io:9000/mybucket/burningman2011/ s3.amazonaws.com/mybucket/
|
||||
|
||||
3. Copy multiple local folders recursively to Minio cloud storage.
|
||||
$ mc {{.Name}} --recursive backup/2014/ backup/2015/ https://play.minio.io:9000/archive/
|
||||
$ mc {{.Name}} --recursive backup/2014/ backup/2015/ play.minio.io:9000/archive/
|
||||
|
||||
4. Copy a bucket recursively from aliased Amazon S3 cloud storage to local filesystem on Windows.
|
||||
$ mc {{.Name}} --recursive s3/documents/2014/ C:\Backups\2014
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ DESCRIPTION:
|
||||
|
||||
EXAMPLES:
|
||||
1. Compare a local folder with a folder on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} ~/Photos https://s3.amazonaws.com/MyBucket/Photos
|
||||
$ mc {{.Name}} ~/Photos s3.amazonaws.com/MyBucket/Photos
|
||||
|
||||
2. Compare two different folders on a local filesystem.
|
||||
$ mc {{.Name}} ~/Photos /Media/Backup/Photos
|
||||
|
||||
+2
-2
@@ -59,10 +59,10 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. List buckets on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} https://s3.amazonaws.com/
|
||||
$ mc {{.Name}} s3.amazonaws.com
|
||||
|
||||
2. List buckets and all its contents from Amazon S3 cloud storage recursively.
|
||||
$ mc {{.Name}} --recursive https://s3.amazonaws.com/
|
||||
$ mc {{.Name}} --recursive s3.amazonaws.com
|
||||
|
||||
3. List files recursively on a local filesystem on Microsoft Windows.
|
||||
$ mc {{.Name}} --recursive C:\Users\Worf\
|
||||
|
||||
+5
-2
@@ -50,10 +50,13 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Create a bucket on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} https://s3.amazonaws.com/mynewbucket
|
||||
$ mc {{.Name}} s3.amazonaws.com/mynewbucket
|
||||
|
||||
2. Create a new bucket on Google Cloud Storage.
|
||||
$ mc {{.Name}} https://storage.googleapis.com/miniocloud
|
||||
$ mc {{.Name}} storage.googleapis.com/miniocloud
|
||||
|
||||
3. Create a new bucket on Amazon S3 cloud storage, using virtual bucket request.
|
||||
$ mc {{.Name}} ferenginar.s3.amazonaws.com
|
||||
|
||||
3. Create a new directory including its missing parents (equivalent to ‘mkdir -p’).
|
||||
$ mc {{.Name}} /tmp/this/new/dir1
|
||||
|
||||
+2
-2
@@ -64,10 +64,10 @@ FLAGS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Mirror a bucket recursively from Minio cloud storage to a bucket on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} https://play.minio.io:9000/photos/2014 https://s3.amazonaws.com/backup-photos
|
||||
$ mc {{.Name}} play.minio.io:9000/photos/2014 s3.amazonaws.com/backup-photos
|
||||
|
||||
2. Mirror a local folder recursively to Minio cloud storage, Amazon S3 cloud storage and Google Cloud Storage.
|
||||
$ mc {{.Name}} backup/ https://play.minio.io:9000/archive https://s3.amazonaws.com/archive https://storage.googleapis.com/miniocloud
|
||||
$ mc {{.Name}} backup/ play.minio.io:9000/archive s3.amazonaws.com/archive storage.googleapis.com/miniocloud
|
||||
|
||||
3. Mirror a bucket from aliased Amazon S3 cloud storage to multiple folders on Windows.
|
||||
$ mc {{.Name}} s3/documents/2014/ C:\backup\2014 C:\shared\volume\backup\2014
|
||||
|
||||
+3
-3
@@ -51,13 +51,13 @@ EXAMPLES:
|
||||
$ mc {{.Name}} /tmp/hello-world.go
|
||||
|
||||
2. Write contents of stdin to an object on Amazon S3 cloud storage.
|
||||
$ mc {{.Name}} https://s3.amazonaws.com/personalbuck/meeting-notes.txt
|
||||
$ mc {{.Name}} s3.amazonaws.com/personalbuck/meeting-notes.txt
|
||||
|
||||
3. Copy an ISO image to an object on Amazon S3 cloud storage and Google Cloud Storage simultaneously.
|
||||
$ cat debian-8.2.iso | mc {{.Name}} https://s3.amazonaws.com/ferenginar/gnuos.iso https://storage.googleapis.com/miniocloud/gnuos.iso
|
||||
$ cat debian-8.2.iso | mc {{.Name}} s3.amazonaws.com/ferenginar/gnuos.iso storage.googleapis.com/miniocloud/gnuos.iso
|
||||
|
||||
4. Stream MySQL database dump to Amazon S3 directly.
|
||||
$ mysqldump -u root -p ******* accountsdb | mc {{.Name}} https://s3.amazonaws.com/ferenginar/backups/accountsdb-oct-9-2015.sql
|
||||
$ mysqldump -u root -p ******* accountsdb | mc {{.Name}} s3.amazonaws.com/ferenginar/backups/accountsdb-oct-9-2015.sql
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -77,19 +77,19 @@ EXAMPLES:
|
||||
$ mc {{.Name}} 1999/old-backup.tgz
|
||||
|
||||
2. Remove contents of a folder, excluding its sub-folders.
|
||||
$ mc {{.Name}} --force https://s3.amazonaws.com/jazz-songs/louis/
|
||||
$ mc {{.Name}} --force s3.amazonaws.com/jazz-songs/louis/
|
||||
|
||||
3. Remove contents of a folder recursively.
|
||||
$ mc {{.Name}} --force --recursive https://s3.amazonaws.com/jazz-songs/louis/
|
||||
$ mc {{.Name}} --force --recursive s3.amazonaws.com/jazz-songs/louis/
|
||||
|
||||
4. Remove all matching objects with this prefix.
|
||||
$ mc {{.Name}} --force https://s3.amazonaws.com/ogg/gunmetal
|
||||
$ mc {{.Name}} --force s3.amazonaws.com/ogg/gunmetal
|
||||
|
||||
5. Drop an incomplete upload of an object.
|
||||
$ mc {{.Name}} --incomplete https://s3.amazonaws.com/jazz-songs/louis/file01.mp3
|
||||
$ mc {{.Name}} --incomplete s3.amazonaws.com/jazz-songs/louis/file01.mp3
|
||||
|
||||
6. Drop all incomplete uploads recursively matching this prefix.
|
||||
$ mc {{.Name}} --incomplete --force --recursive https://s3.amazonaws.com/jazz-songs/louis/
|
||||
$ mc {{.Name}} --incomplete --force --recursive s3.amazonaws.com/jazz-songs/louis/
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
@@ -51,16 +51,16 @@ OPTIONS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Share this object with 7 days default expiry.
|
||||
$ mc share {{.Name}} https://s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
$ mc share {{.Name}} s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
|
||||
2. Share this object with 10 minutes expiry.
|
||||
$ mc share {{.Name}} --expire=10m https://s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
$ mc share {{.Name}} --expire=10m s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
|
||||
3. Share all objects under this folder with 5 days expiry.
|
||||
$ mc share {{.Name}} --expire=120h https://s3.amazonaws.com/backup/
|
||||
$ mc share {{.Name}} --expire=120h s3.amazonaws.com/backup/
|
||||
|
||||
4. Share all objects under this folder and all its sub-folders with 5 days expiry.
|
||||
$ mc share {{.Name}} --recursive --expire=120h https://s3.amazonaws.com/backup/
|
||||
$ mc share {{.Name}} --recursive --expire=120h s3.amazonaws.com/backup/
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
@@ -49,13 +49,13 @@ OPTIONS:
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Generate a curl command to allow upload access for a single object. Command expires after 7 days (default).
|
||||
$ mc share {{.Name}} https://s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
$ mc share {{.Name}} s3.amazonaws.com/backup/2006-Mar-1/backup.tar.gz
|
||||
|
||||
2. Generate a curl command to allow upload access to a folder. Command expires in 120 hours.
|
||||
$ mc share {{.Name}} --expire=120h https://s3.amazonaws.com/backup/2007-Mar-2/...
|
||||
$ mc share {{.Name}} --expire=120h s3.amazonaws.com/backup/2007-Mar-2/...
|
||||
|
||||
3. Generate a curl command to allow upload access of only '.png' images to a folder. Command expires in 2 hours.
|
||||
$ mc share {{.Name}} --expire=2h --content-type=image/png https://s3.amazonaws.com/backup/2007-Mar-2/...
|
||||
$ mc share {{.Name}} --expire=2h --content-type=image/png s3.amazonaws.com/backup/2007-Mar-2/...
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user