rgw bucket index max shards设置

1. # radosgw-admin zonegroup --rgw_zonegroup=default get > /root/zonegroup.json

{
    "id": "3c5cc9c6-7e31-46cd-ac6d-652ce466c879",
    "name": "default",
    "api_name": "",
    "is_master": "true",
    "endpoints": [],
    "hostnames": [],
    "hostnames_s3website": [],
    "master_zone": "b70f0b56-08a0-472a-880f-6114f593c972",
    "zones": [
        {
            "id": "b70f0b56-08a0-472a-880f-6114f593c972",
            "name": "default",
            "endpoints": [],
            "log_meta": "false",
            "log_data": "false",
            "bucket_index_max_shards": 0,
            "read_only": "false",
            "tier_type": "",
            "sync_from_all": "true",
            "sync_from": []
        }
    ],
    "placement_targets": [
        {
            "name": "default-placement",
            "tags": []
        }
    ],
    "default_placement": "default-placement",
    "realm_id": "f43494f8-bfb6-4723-b169-6ba929cdca1c"
}

2.# adosgw-admin zonegroup --rgw_zonegroup=default set < /root/zonegroup.json

{
    "id": "3c5cc9c6-7e31-46cd-ac6d-652ce466c879",
    "name": "default",
    "api_name": "",
    "is_master": "true",
    "endpoints": [],
    "hostnames": [],
    "hostnames_s3website": [],
    "master_zone": "b70f0b56-08a0-472a-880f-6114f593c972",
    "zones": [
        {
            "id": "b70f0b56-08a0-472a-880f-6114f593c972",
            "name": "default",
            "endpoints": [],
            "log_meta": "false",
            "log_data": "false",
            "bucket_index_max_shards": 4,
            "read_only": "false",
            "tier_type": "",
            "sync_from_all": "true",
            "sync_from": []
        }
    ],
    "placement_targets": [
        {
            "name": "default-placement",
            "tags": []
        }
    ],
    "default_placement": "default-placement",
    "realm_id": "f43494f8-bfb6-4723-b169-6ba929cdca1c"
}

3. # radosgw-admin regionmap update

4. 重启rgw服务,即可生效

5. 创建一个bucket

# swift -V 1.0 -A http://127.0.0.1:8000/auth -U test:tester -K testing post test2

.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.0
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.1
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.2
.dir.b70f0b56-08a0-472a-880f-6114f593c972.4144.3.3


6. 为什么设置rgw bucket index max shards

Sharding is the process of breaking down data onto multiple locations so as to increase parallelism, as well as distribute load. This is a common feature used in databases. Read more on this at Wikipedia.


The concept of sharding is used in Ceph, for splitting the bucket index in a RADOS Gateway.


RGW or RADOS Gateway keeps an index for all the objects in its buckets for faster and easier lookup. For each RGW bucket created in a pool, the corresponding index is created in the XX.index pool.


For example, for each of the buckets created in .rgw pool, the bucket index is created in .rgw.buckets.index pool. For each bucket, the index is stored in a single RADOS object.


When the number of objects increases, the size of the RADOS object increases as well. Two problems arise due to the increased index size.


RADOS does not work good with large objects since it’s not designed as such. Operations such as recovery, scrubbing etc.. work on a single object. If the object size increases, OSDs may start hitting timeouts because reading a large object may take a long time. This is one of the reason that all RADOS client interfaces such as RBD, RGW, CephFS use a standard 4MB object size.
Since the index is stored in a single RADOS object, only a single operation can be done on it at any given time. When the number of objects increases, the index stored in the RADOS object grows. Since a single index is handling a large number of objects, and there is a chance the number of operations also increase, parallelism is not possible which can end up being a bottleneck. Multiple operations will need to wait in a queue since a single operation is possible at a time.
In order to work around these problems, the bucket index is sharded into multiple parts. Each shard is kept on a separate RADOS object within the index pool.


Sharding is configured with the tunable bucket_index_max_shards . By default, this tunable is set to 0 which means that there are no sha


7. 注意和rgw_override_bucket_index_max_shards 的区别

用户可能会在一个bucket中存放过多的object,这会严重影响系统性能;通过定义 rgw_override_bucket_index_max_shards 可以限制最大多少个shards在一个bucket中,默认这个值是0,也就是“无数个”。
rgw_override_bucket_index_max_shards = 1000



猜你喜欢

转载自blog.csdn.net/dengxiafubi/article/details/77167589
max
今日推荐