Ceph对象存储集群常用操作

一.常用操作

1.1 查看某个bucket详情

# 查看bucket列表
[root@oss001 ~]# radosgw-admin bucket list
[
    "awss3e68c588a90ec4f15a040a82e962814a3",
    "awss389244818a62a422ca9b9c4070ea33f40",
    "awss3cff88e338f5042b49385910eba4e5da2",
    "awss32a2b2d4ea22d448296f2e61db7d74842",
    "awss300cfc5399e004baf8b4f4557b6870228",
    "54d1bb61b26b4be289c48ea2597e793d"
]

# 查看bucket详情
[root@oss001 ~]# radosgw-admin bucket stats --bucket=awss3e68c588a90ec4f15a040a82e962814a3
{
    "bucket": "awss3e68c588a90ec4f15a040a82e962814a3",
    "zonegroup": "caca2a64-df7a-4295-9fc4-650ba8953c27",
    "placement_rule": "default-placement",
    "explicit_placement": {
        "data_pool": "",
        "data_extra_pool": "",
        "index_pool": ""
    },
    "id": "510e166e-4c5d-4757-bfa1-16c19c1838d0.44104.6",
    "marker": "510e166e-4c5d-4757-bfa1-16c19c1838d0.44104.6",
    "index_type": "Normal",
    "owner": "admin",
    "ver": "0#11",
    "master_ver": "0#0",
    "mtime": "2020-06-04 14:20:54.991487",
    "max_marker": "0#",
    "usage": {
        "rgw.main": {
            "size": 9135,
            "size_actual": 40960,
            "size_utilized": 9135,
            "size_kb": 9,
            "size_kb_actual": 40,
            "size_kb_utilized": 9,
            "num_objects": 10
        }
    },
    "bucket_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    }
}
# 查看用户详情
[root@oss001 ~]# radosgw-admin user info --uid=admin
{
    "user_id": "admin",
    "display_name": "admin",
    "email": "",
    "suspended": 0,
    "max_buckets": 100000,
    "auid": 0,
    "subusers": [],
    "keys": [
        {
            "user": "admin",
            "access_key": "LJ60WSWPXRP4GPEAT89C",
            "secret_key": "BCpCRaDX7COQ52Aa9ZXtLhxiOnp6P2u2Jp6UWrUB"
        }
    ],
    "swift_keys": [],
    "caps": [
        {
            "type": "buckets",
            "perm": "*"
        },
        {
            "type": "usage",
            "perm": "*"
        },
        {
            "type": "users",
            "perm": "*"
        }
    ],
    "op_mask": "read, write, delete",
    "default_placement": "",
    "placement_tags": [],
    "bucket_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    "user_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    },
    "temp_url_keys": [],
    "type": "rgw",
    "mfa_ids": []
}

1.2 bucket中object管理

# 查看某个bucket中对象
[root@oss001 ~]# radosgw-admin bucket list --bucket=awss3e68c588a90ec4f15a040a82e962814a3
[
    {
        "name": "zip2_N1/cifar-10_test/bird_3853.jpg",
        "instance": "",
        "ver": {
            "pool": 8,
            "epoch": 37
        },
        "locator": "",
        "exists": "true",
        "meta": {
            "category": 1,
            "size": 998,
            "mtime": "2020-06-04 06:20:55.405806Z",
            "etag": "40335f238116ce29454adacfef125e3a",
            "owner": "admin",
            "owner_display_name": "admin",
            "content_type": "application/octet-stream",
            "accounted_size": 998,
            "user_data": ""
        },
        "tag": "510e166e-4c5d-4757-bfa1-16c19c1838d0.44104.2759",
        "flags": 0,
        "pending_map": [],
.......
# 删除某个bucket中的某个object,注意这里object后面跟上object的name
[root@oss001 ~]# radosgw-admin object rm --bucket=awss3e68c588a90ec4f15a040a82e962814a3 --object=zip2_N1/cifar-10_test/bird_3853.jpg
# 查看某个bucket中某个object的ACL信息
[root@oss001 ~]# radosgw-admin object stat --bucket=awss3e68c588a90ec4f15a040a82e962814a3 --object=zip2_N1/cifar-10_test/bird_3853.jpg
{
    "name": "zip2_N1/cifar-10_test/bird_3853.jpg",
    "size": 998,
    "policy": {
        "acl": {
            "acl_user_map": [
                {
                    "user": "admin",
                    "acl": 15
                }
            ],
            "acl_group_map": [
                {
                    "group": 1,
                    "acl": 1
                }
            ],
            "grant_map": [
                {
                    "id": "",
                    "grant": {
                        "type": {
                            "type": 2
                        },
......
posted @ 2020-06-09 19:20  yuhaohao  阅读(2774)  评论(0编辑  收藏  举报