zoukankan      html  css  js  c++  java
  • 通过S3接口访问ceph

    1. 找出对应bucket的owner

    # radosgw-admin bucket list
    
    # radosgw-admin metadata  list user
    
    # radosgw-admin bucket stats --bucket=chaoge_73_test
    {
        "bucket": "chaoge_73_test",
        "pool": "default.rgw.buckets.data",
        "index_pool": "default.rgw.buckets.index",
        "id": "5c470d18-0d9e-4a34-8a6c-7a6d64784c3e.38311.41",
        "marker": "5c470d18-0d9e-4a34-8a6c-7a6d64784c3e.38311.41",
        "owner": "FFF65F671D9E48F696C5E57931A1DE85",
        "ver": "0#1",
        "master_ver": "0#0",
        "mtime": "2018-05-03 17:47:31.329045",
        "max_marker": "0#",
        "usage": {},
        "bucket_quota": {
            "enabled": false,
            "max_size_kb": -1,
            "max_objects": -1
        }
    }
    
    # radosgw-admin user info --uid=FFF65F671D9E48F696C5E57931A1DE85
    {
        "user_id": "FFF65F671D9E48F696C5E57931A1DE85",
        "display_name": "user name",
        "email": "",
        "suspended": 0,
        "max_buckets": 1000,
        "auid": 0,
        "subusers": [],
        "keys": [
            {
                "user": "FFF65F671D9E48F696C5E57931A1DE85",
                "access_key": "A5DXX3XCFX7OF4ZM1UY5",
                "secret_key": "r1eeS2Sq5fuQF8JbOxjlauNDkPV7apZ6sArhFlUq"
            }
        ],
        "swift_keys": [],
        "caps": [],
        "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": []
    }
    
    # radosgw-admin user info --uid=admin
    {
        "user_id": "admin",
        "display_name": "admin",
        "email": "",
        "suspended": 0,
        "max_buckets": 1000,
        "auid": 0,
        "subusers": [],
        "keys": [
            {
                "user": "admin",
                "access_key": "HWG19J1AMB2MXU1YD0FW",
                "secret_key": "vDahq8wV7MZPOhbLzQKuQ2cXldH2MmXeA89nIXZN"
            }
        ],
        "swift_keys": [],
        "caps": [
            {
                "type": "buckets",
                "perm": "*"
            },
            {
                "type": "metadata",
                "perm": "*"
            },
            {
                "type": "usage",
                "perm": "*"
            },
            {
                "type": "users",
                "perm": "*"
            },
            {
                "type": "zone",
                "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": []
    }
    

    2. bucket object管理

    • 基本管理
    # radosgw-admin bucket list 
    [
        "testab"
    ]
    
    # radosgw-admin bucket list --bucket=testab
    [
        {
            "name": "testobj.2~s7xdt9V5PGMqRXpd__fCQ06_Z_rTRTB.meta",
            "instance": "",
            "namespace": "multipart",
            "owner": "0B3E5561D9D146B9BA07A73D5B08B61A",
            "owner_display_name": "app_0B3E5561D9D146B9BA07A73D5B08B61A",
            "size": 0,
            "mtime": "2018-05-24 02:44:46.295558Z",
            "etag": "",
            "content_type": "binary/octet-stream",
            "tag": "_vp71VTOQeUYHEmtXF_75Pr6gYBcJHQn",
            "flags": 0,
            "user_data": ""
        },
        {
            "name": "helloworld_1",
            "instance": "",
            "namespace": "",
            "owner": "0B3E5561D9D146B9BA07A73D5B08B61A",
            "owner_display_name": "app_0B3E5561D9D146B9BA07A73D5B08B61A",
            "size": 129,
            "mtime": "2018-05-24 07:36:37.854243Z",
            "etag": "a2922a8dd298d6cc615cbbe25628df6e",
            "content_type": "binary/octet-stream",
            "tag": "78b9bcbb-b328-4e4a-8417-4ed933be88bb.70594.16",
            "flags": 0,
            "user_data": ""
        }
    ]
    
    //删除bucket object
    # radosgw-admin object rm --bucket=testab --object=helloworld_1
    • 查看object的ACL信息
    radosgw-admin object stat --bucket=jyeammolddraw --object=JH014121_v1.0.x_t
    {
        "name": "JH014121_v1.0.x_t",
        "size": 9134263,
        "policy": {
            "acl": {
                "acl_user_map": [
                    {
                        "user": "0A0B72E2B9374E148DA9D8486B975D2C",
                        "acl": 15
                    }
                ],
                "acl_group_map": [],
                "grant_map": [
                    {
                        "id": "0A0B72E2B9374E148DA9D8486B975D2C",
                        "grant": {
                            "type": {
                                "type": 0
                            },
                            "id": "0A0B72E2B9374E148DA9D8486B975D2C",
                            "email": "",
                            "permission": {
                                "flags": 15
                            },
                            "name": "app_0A0B72E2B9374E148DA9D8486B975D2C",
                            "group": 0
                        }
                    }
                ]
            },
            "owner": {
                "id": "0A0B72E2B9374E148DA9D8486B975D2C",
                "display_name": "app_0A0B72E2B9374E148DA9D8486B975D2C"
            }
        },
        "etag": "45fcbd2bb460b40bc5dbcd226c51b749-18u0000",
        "tag": "135882fc-2865-43ab-9f71-7dd4b2095406.20040920.653647u0000",
        "manifest": {
            "objs": [],
            "obj_size": 9134263,
            "explicit_objs": "false",
            "head_obj": {
                "bucket": {
                    "name": "jyeammolddraw",
                    "pool": "nanhai-01.rgw.buckets.data",
                    "data_extra_pool": "nanhai-01.rgw.buckets.non-ec",
                    "index_pool": "nanhai-01.rgw.buckets.index",
                    "marker": "135882fc-2865-43ab-9f71-7dd4b2095406.20035088.1163",
                    "bucket_id": "135882fc-2865-43ab-9f71-7dd4b2095406.20035088.1163",
                    "tenant": ""
                },
                "key": "",
                "ns": "",
                "object": "JH014121_v1.0.x_t",
                "instance": "",
                "orig_obj": "JH014121_v1.0.x_t"
            },
            "head_size": 0,
            "max_head_size": 0,
            "prefix": "JH014121_v1.0.x_t.2~f0A3ei1JrJxM381Q4Rg2YVmraISjSBC",
            "tail_bucket": {
                "name": "jyeammolddraw",
                "pool": "nanhai-01.rgw.buckets.data",
                "data_extra_pool": "nanhai-01.rgw.buckets.non-ec",
                "index_pool": "nanhai-01.rgw.buckets.index",
                "marker": "135882fc-2865-43ab-9f71-7dd4b2095406.20035088.1163",
                "bucket_id": "135882fc-2865-43ab-9f71-7dd4b2095406.20035088.1163",
                "tenant": ""
            },
            "rules": [
                {
                    "key": 0,
                    "val": {
                        "start_part_num": 1,
                        "start_ofs": 0,
                        "part_size": 524288,
                        "stripe_max_size": 4194304,
                        "override_prefix": ""
                    }
                },
                {
                    "key": 8912896,
                    "val": {
                        "start_part_num": 18,
                        "start_ofs": 8912896,
                        "part_size": 221367,
                        "stripe_max_size": 4194304,
                        "override_prefix": ""
                    }
                }
            ],
            "tail_instance": ""
        },
        "attrs": {
            "user.rgw.content_type": "binary/octet-streamu0000",
            "user.rgw.pg_ver": "p>u0000u0000u0000u0000u0000u0000",
            "user.rgw.source_zone": "u000eiu0010
            "user.rgw.x-amz-acl": "privateu0000"
        }
    }

    3. 用户管理

    //1)创建s3用户
    # radosgw-admin user create --uid='testuser' --display-name="testuser" --key-type=s3 
    {
        "user_id": "testuser",
        "display_name": "testuser",
        "email": "",
        "suspended": 0,
        "max_buckets": 1000,
        "auid": 0,
        "subusers": [],
        "keys": [
            {
                "user": "testuser",
                "access_key": "N7S1NKVRU3ZCX1I06QGE",
                "secret_key": "j5Zc1qFISWmWqenwRVeMBQCh8kVB8bAhj9q5PLus"
            }
        ],
        "swift_keys": [],
        "caps": [],
        "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": []
    }
    
    //2) 创建swift用户key
    # radosgw-admin subuser create --subuser=testuser:swift --key-type=swift 
    {
        "user_id": "testuser",
        "display_name": "testuser",
        "email": "",
        "suspended": 0,
        "max_buckets": 1000,
        "auid": 0,
        "subusers": [
            {
                "id": "testuser:swift",
                "permissions": "<none>"
            }
        ],
        "keys": [
            {
                "user": "testuser",
                "access_key": "N7S1NKVRU3ZCX1I06QGE",
                "secret_key": "j5Zc1qFISWmWqenwRVeMBQCh8kVB8bAhj9q5PLus"
            }
        ],
        "swift_keys": [
            {
                "user": "testuser:swift",
                "secret_key": "QosX7LgFtkvPj6eBDeOs0SQdP43MP3gatYA5SdoS"
            }
        ],
        "caps": [],
        "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": []
    }
    
    //3) 删除s3用户
    # radosgw-admin user rm --uid='testuser'  --access-key=N7S1NKVRU3ZCX1I06QGE
    
    
    //4) 列出所有的用户
    # radosgw-admin metadata  list user
    
    //5) 删除用户及其对应的bucket数据
    # radosgw-admin user rm --uid="909A284903754DAD910C68F9AFA2BE81" --purge-data

    4. rgw配额管理

    # radosgw-admin user info --uid=app_a9d2c0a01c46443f_g_715
    {
        "user_id": "app_a9d2c0a01c46443f_g_715",
        "display_name": "app_a9d2c0a01c46443f_g_715",
        "email": "",
        "suspended": 0,
        "max_buckets": 1,
        "auid": 0,
        "subusers": [],
        "keys": [
            {
                "user": "app_a9d2c0a01c46443f_g_715",
                "access_key": "Z5WE64O1FSIX385T2FFU",
                "secret_key": "4Vkl4aQ9Rwj5zDwRTIQTVYb2SfENVssayTezbSpv"
            }
        ],
        "swift_keys": [],
        "caps": [
            {
                "type": "buckets",
                "perm": "read"
            },
            {
                "type": "metadata",
                "perm": "*"
            }
        ],
        "op_mask": "read, write, delete",
        "default_placement": "",
        "placement_tags": [],
        "bucket_quota": {
            "enabled": false,
            "max_size_kb": -1,
            "max_objects": -1
        },
        "user_quota": {
            "enabled": true,
            "max_size_kb": 4294967296,
            "max_objects": -1
        },
        "temp_url_keys": []
    }
    
    # radosgw-admin quota set --max-objects=-1 --max-size=-1 --quota-scope=user --uid=app_a9d2c0a01c46443f_g_715
    # radosgw-admin quota set --max-objects=-1 --max-size=-1 --quota-scope=bucket --bucket=app_a9d2c0a01c46443f_g_715_bucket
    # radosgw-admin quota disable --quota-scope=user --uid=app_a9d2c0a01c46443f_g_71
    # radosgw-admin quota enable --quota-scope=user --uid=app_a9d2c0a01c46443f_g_715
    # radosgw-admin user stats --uid=app_a9d2c0a01c46443f_g_71 --sync-stats     //同步

    5. 查看某一个池的副本数

    # ceph osd pool get .rgw.buckets size
    size: 3
    

    6. 安装boto

    # pip install boto
  • 相关阅读:
    log4j配置文件动态指定日志文件名称
    如何在natTable表格上添加双击事件
    如何让natTable表格支持自定义多个右键菜单
    java1.7集合源码阅读:ArrayList
    关于java1.7集合源码阅读
    多线程之:如何避免死锁
    idea控制台中文乱码“淇℃伅”
    独立的js文件中不能使用EL表达式取值
    不能在jsp页面<c:choose>对标签中使用<!---->进行注释
    Excel导入工具类
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/12745629.html
Copyright © 2011-2022 走看看