• 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
  • 相关阅读:
    redis集群
    nodejs使用nginx负载均衡策略有哪些?
    python API自动化(Pytest+Excel+Allure完整框架集成+yaml入门+大量响应报文处理及加解密、签名处理)
    ansible常见避坑指南
    Java进阶07 嵌套类
    多媒体内容理解在美图社区的应用实践
    FX110网:香港交易所宣布开发Orion衍生品平台,预计于 2028 年推出
    【行为型模式】解释器模式
    数据可视化之百变柱状图
    MyEclipse报错javax/persistence/EntityManagerFactory
  • 原文地址:https://blog.csdn.net/wan212000/article/details/128015650