前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >radowsgw 配置 s3cmd

radowsgw 配置 s3cmd

作者头像
py3study
发布2020-01-07 10:56:35
发布2020-01-07 10:56:35
62000
代码可运行
举报
文章被收录于专栏:python3python3
运行总次数:0
代码可运行

安装s3cmd

代码语言:javascript
代码运行次数:0
运行
复制
virtualenv ven_s3
source ven_s3/bin/activate
pip install pip --upgrade
pip install s3cmd

查看user key

代码语言:javascript
代码运行次数:0
运行
复制
radosgw-admin user info --uid=testuser
{
    "user_id": "testuser",
    "display_name": "First User",
    "email": "",
    "suspended": 0,
    "max_buckets": 1000,
    "auid": 0,
    "subusers": [
        {
            "id": "testuser:swift",
            "permissions": "full-control"
        }
    ],
    "keys": [
        {
            "user": "testuser",
            "access_key": "UNQA07763EJDVFE1U82F",
            "secret_key": "yERsPubsAxUjlIxsO9HOQ03EbEE2HrP88dikyObM"
        }
    ],
    "swift_keys": [
        {
            "user": "testuser:swift",
            "secret_key": "joNclsgsrr2VJjezfTwlfZiuEz1b9OcUiTnRXBxp"
        }
    ],
    "caps": [
        {
            "type": "buckets",
            "perm": "read"
        },
        {
            "type": "metadata",
            "perm": "*"
        },
        {
            "type": "usage",
            "perm": "*"
        },
        {
            "type": "users",
            "perm": "*"
        }
    ],
    "op_mask": "read, write, delete",
    "default_placement": "",
    "placement_tags": [],
    "bucket_quota": {
        "enabled": false,
        "max_size_kb": -1,
        "max_objects": -1
    },
    "user_quota": {
        "enabled": false,
        "max_size_kb": -1,
        "max_objects": -1
    },
    "temp_url_keys": []
}

配置s3cmd

代码语言:javascript
代码运行次数:0
运行
复制
s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key: XA256MGT6DOJWG0WHUBM
Secret Key: CP7uaDpOK7rxHJmTjGrVfO5hd5oRUukzGSkBfL5E
Default Region [US]: 
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: 
Path to GPG program [/bin/gpg]: 
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [Yes]: no
On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name: 
New settings:
  Access Key: XA256MGT6DOJWG0WHUBM
  Secret Key: CP7uaDpOK7rxHJmTjGrVfO5hd5oRUukzGSkBfL5E
  Default Region: US
  Encryption password: 
  Path to GPG program: /bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name: 
  HTTP Proxy server port: 0
Test access with supplied credentials? [Y/n] y
Please wait, attempting to list all buckets...
ERROR: Test failed: [Errno -2] Name or service not known
Retry configuration? [Y/n] n
Save settings? [y/N] y
Configuration saved to '/home/b/.s3cfg'

由于是自建的radosgw,还需要配置如下三项:

  • cloudfont_host
  • host_base
  • host_bucket

其对应的配置如下:

代码语言:javascript
代码运行次数:0
运行
复制
cat .s3cfg
...
cloudfront_host = 192.168.1.200:8080
...
host_base = 192.168.1.200:8080
host_bucket = 192.168.1.200:8080/%(bucket)
代码语言:javascript
代码运行次数:0
运行
复制
s3cmd操作
s3cmd ls # 查看bucket
s3cmd mb s3://test # 创建bucket
s3cmd put .s3cfg s3://test # 上传文件
s3cmd la # 查看object
s3cmd get s3://test/.s3cfg # 下载文件
s3cmd rm  s3://test/.s3cfg # 删除文件
s3cmd rb s3://test # 删除bucket

参考链接

http://www.lai18.com/content/6968965.html

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/09/14 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档