先注册 滴滴云账号,进入:https://app.didiyun.com/#/s3/add 申请 Bucket,如下图:
填写名称和设置访问权限,点立即创建即可。
操作步骤:
即可得到的 SecretID 和 SecretKey 值.
brew install minio/stable/mc
mc --help
wget https://dl.minio.io/client/mc/release/linux-amd64/mc
chmod +x mc
cp mc /usr/bin
mc --help
获取到 S3 API 密钥后,得到 SecretID 和 SecretKey 值,通过这两个值来配置滴滴云 S3。
mc config host add didiyuns3 https://s3.didiyunapi.com AKDD002DYS7H379X1YQKZFSCGOFNX1 V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
mc config host add didiyuns3 https://s3-internal.didiyunapi.com AKDD002DYS7H379X1YQKZFSCGOFNX1 V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
配置成功后,在用户目录下 .mc/config.json
会生成新的配置信息。
{
"version": "9",
"hosts": {
"didiyuns3": {
"url": "https://s3-gz.didiyunapi.com",
"accessKey": "AKDD002DYS7H379X1YQKZFSCGOFNX1",
"secretKey": "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12",
"api": "s3v4",
"lookup": "auto"
}
}
}
➜ ~ mc ls didiyuns3
[2018-02-09 15:08:04 CST] 0B didiyun/
➜ ~ mc ls didiyuns3/didiyun
[2018-11-04 10:57:03 CST] 107KiB 6a6f178b009847dca.jpg
[2018-10-31 10:24:09 CST] 40B test
[2018-08-30 15:50:07 CST] 13MiB test.mp4
[2018-08-24 09:59:25 CST] 107KiB test_6a6f178b009847163649c7cb9s
[2018-12-10 17:49:36 CST] 0B test/
➜ ~ mc cp ./test1 didiyuns3/didiyun/
./test1: 40 B / 40 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00% 296 B/s 0s
➜ ~ mc ls didiyuns3/didiyun
[2018-11-04 10:57:03 CST] 107KiB 6a6f178b009847163649c7cb96a9e4ca.jpg
[2018-11-13 17:56:44 CST] 3.1KiB das.graffle
[2018-10-31 10:24:09 CST] 40B test
[2018-08-30 15:50:07 CST] 13MiB test.mp4
[2018-12-10 17:52:30 CST] 40B test1
[2018-08-24 09:59:25 CST] 107KiB test_6a6f178b009847163649c7cb96a9e4ca
[2018-12-10 17:53:39 CST] 0B test/
使用 MC CP 上传成功后,再重新获取到列表就会多出 test1 文件。
➜ ~ mc cp didiyuns3/didiyun/test1 ./
...gz.didiyunapi.com/didiyun/test1: 40 B / 40 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00% 109 B/s 0s
➜ ~ mc help
NAME:
mc - Minio Client for cloud storage and filesystems.
USAGE:
mc [FLAGS] COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
COMMANDS:
ls List files and folders.
mb Make a bucket or a folder.
cat Display file and object contents.
pipe Redirect STDIN to an object or file or STDOUT.
share Generate URL for sharing.
cp Copy files and objects.
mirror Mirror buckets and folders.
find Search for files and objects.
select Run select queries on objects.
stat Stat contents of objects and folders.
diff List differences in object name, size, and date between folders.
rm Remove files and objects.
events Manage object notifications.
watch Watch for file and object events.
policy Manage anonymous access to objects.
admin Manage Minio servers
session Manage saved sessions for cp command.
config Manage mc configuration file.
update Check for a new software update.
version Print version info.
GLOBAL FLAGS:
--config-folder value, -C value Path to configuration folder. (default: "/Users/didi/.mc")
--quiet, -q Disable progress bar display.
--no-color Disable color theme.
--json Enable JSON formatted output.
--debug Enable debug output.
--insecure Disable SSL certificate verification.
--help, -h Show help.
VERSION:
2018-10-18T00:40:05Z