Pull the mc binary:
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc --help
Add a Cloud Storage Service
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.
mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --lookup <BUCKET-LOOKUP-TYPE>
Alias is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
Lookup is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "dns", "path" or "auto" as valid values. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
Example - MinIO Cloud Storage
MinIO server displays URL, access and secret keys.
mc config host add minio http://192.168.1.32 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
or
./mc config host add fashionable-bird-minio-local http://<cluster ip>:9000 <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> S3v4
Example - Amazon S3 Cloud Storage
Get your AccessKeyID and SecretAccessKey by following AWS Credentials Guide.
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
Note: As an IAM user on Amazon S3 you need to make sure the user has full access to the buckets or set the following restricted policy for your IAM user
Make a bucket
mb command creates a new bucket.Example:
mc mb play/mybucket
Bucket created successfully `play/mybucket`.
Copy Objects
cp command copies data from one or more sources to a target.Example:
mc cp myobject.txt play/mybucket
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
Example:
List Objects in a Bucket
List object in the bucket "test"
mc ls fashionable-bird-minio-local/test
0 Comments