• UCloud 对象存储使用


    1. UCloud 对象存储使用

    一、获取 API 密钥

    登录 UCloud 控制台 -> 点击 产品与服务 -> 点击 API密钥 UAPI -> 显示 (会向手机发送验证码)

    按照上面的步骤就可以看到了,图示:

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PUZcRYLf-1669262327353)(http://p7tng301o.bkt.clouddn.com/Cloud-ucloud-find-api-key.png)]

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-A5FzZ7bn-1669262327354)(http://p7tng301o.bkt.clouddn.com/Cloud-ucloud-view-api-key-1.png)]

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qgOCopMZ-1669262327354)(http://p7tng301o.bkt.clouddn.com/Cloud-ucloud-view-api-key-2.png)]

    1.1 如何禁用 UCloud 的 API 密钥

    一旦发现您的 API 密钥可能被泄露,并由此可能会产生信息安全问题,我们强烈建议您禁用此 API 密钥。您只需登录 UCloud 控制台,在 API 密钥中,将其重置即可。

    二、填写 config.cfg

    在下载的工具里面,有一个 config.cfg 文件,在里面填写各种 key,里面的 api_host 不用改,其它的全要改。

    config.cfg

    {
       "public_key" : "paste your public key here",
       "private_key" : "paste your private key here",
       "proxy_host" : "www.cn-bj.ufileos.com",
       "api_host" : "api.spark.ucloud.cn"
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    三、上传文件

    想要将大文件传往 UCloud 的对象存储 (https://console.ucloud.cn/ufile/ufile/manage/normal) 得使用其官方工具,从这里下载: https://console.ucloud.cn/ufile/tools

    下载 文件管理 工具 filemgr (http://tools.ufile.ucloud.com.cn/filemgr-win64.zip) ,而不是 空间管理 工具。

    工具使用官方文档: https://docs.ucloud.cn/storage_cdn/ufile/tools

    3.1 单文件上传

    3.1.1 先尝试秒传

    如果是大文件并且自觉别人也可能拥有的文件,可以尝试先秒传:

    filemgr-win64.exe --action upload-hit --bucket hello --key ubuntu-18.04-live-server-amd64.iso --file ubuntu-18.04-live-server-amd64.iso

    参数说明:

    • –bucket: 需要上传至的 bucket 名称,比如假设空间名为 hello.hk.ufileos.com,那么 bucket 就是 hello
    • –key: 上传至 bucket 中的文件名称
    • –file: 需要上传的本地文件路径
    • –speedlimit: 上传限速,单位 bytes/s

    3.1.2 若不能秒传,则选择分片上传

    filemgr-win64.exe --action mput --bucket hello --key ubuntu-18.04-live-server-amd64.iso --file ubuntu-18.04-live-server-amd64.iso --retrycount 20

    参数说明:

    • –bucket: 需要上传至的 bucket 名称
    • –key: 上传至 bucket 中的文件名称
    • –file: 需要上传的本地文件路径
    • –threads: 分片上传并发数,默认为 5
    • –retrycount: 分片上传失败重试次数,默认 10,大文件上传建议配置大些
    • –speedlimit: 上传限速,单位 bytes/s

    四、下载文件

    4.1 单文件下载

    sudo ./filemgr-linux64 --action mdownload --bucket hello --key data.hexo_blog.tar.gz --file ~/data.hexo_blog.tar.gz --threads 50
    sudo ./filemgr-linux64 --action mdownload --bucket hello --key user.ubuntu.tar.gz --file ~/user.ubuntu.tar.gz --threads 50
    
    • 1
    • 2
  • 相关阅读:
    SQL命令及MariaDB(一)
    Java_Validation分组校验
    【设计模式】三、概述分类+单例模式
    Linux-用户管理
    电脑连不上网
    戴姆勒——从豪华私家车到无人驾驶飞机
    UE4 设计模式:单例模式(Singleton Pattern)
    XML 中的延时等待控制函数Wait
    Tomcat工作原理 + Tomcat生命周期实现剖析(下期)
    【移远QuecPython】EC800M物联网开发板调用网络API(使用SIM卡联网并调用高德地图API的定位坐标转换)
  • 原文地址:https://blog.csdn.net/wan212000/article/details/128015650