这个文章只是单纯的记录一下OSS中的数据下载到Linux服务器中 简单的操作过程,整理一个小文档,详细的还是要看阿里云官方文档
官网文档:https://help.aliyun.com/document_detail/179389.html
📢:注意 云服务要做好快照
🎐 安装ossutil
wget https://gosspublic.alicdn.com/ossutil/1.7.9/ossutil64
chmod 755 ossutil64
🎐 生成配置文件
[root@iz2zedn97o5noj7k3j4s85z ~]# ./ossutil64 config
The command creates a configuration file and stores credentials.
Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
No config file entered, will use the default config file /root/.ossutilconfig
For the following settings, carriage return means skip the configuration. Please try "help config" to see the meaning of the settings
# 默认是在当前目录下生成配置文件
Please enter endpoint: oss-cn-beijing-internal.aliyuncs.com
# 可以填写公网endpoint 也可以是私网的 可以带https或http
accessKeyID:accesskey ID
Please enter accessKeySecret: accesskey密钥
Please enter stsToken:
❗❗❗ 注意 可能是软件有bug 生成配置文件之后,需要检查下
我执行 ./ossutil64 cp -r oss://shopimg/data/ /data0/www/shop/data1/
报错:Error: invalid endpoint, endpoint is empty, please check your config
查看生成的配置文件发现 endpoint信息跑到accessKeyID里面了
[Credentials]
language=EN
endpoint=
accessKeyID=oss-cn-beijing-internal.aliyuncs.com111111111
accessKeySecret=j111111111111111
🎐 OSS数据下载到本地
下载单个文件 在shopimg中 将data目录下file.txt 复制到本地目录中
./ossutil64 cp oss://shopimg/data/file.txt /data0/www/shop/data/
将bucket目录下所有文件复制到本地
[root@guguzai公众号 ~]# ./ossutil64 cp -r oss://shopimg/data/ /data0/www/shop/data1/
Succeed: Total num: 96236, size: 16,612,839,273. OK num: 96236(download 96236 objects).
average speed 6156000(byte/s)
2698.437024(s) elapsed
🎉 完.....
如果觉得我的文对你有帮助的话 可以关注下我的公众号 一般写文第一时间发布到公众号中
公众号名称 咕咕崽
二维码: