如何配置RadosGW支持多个placement target / data pools

I want to use different pools to hold user's buckets. Two pools are created,
one is '.bj-dz.rgw.buckets', the other is '.bj-dz.rgw.buckets.hot'.

1. Two placement targets are added to region map. Targets tags are 'hdd' and 'ssd'.

                    "placement_targets": [
                        {
                            "name": "default-placement",
                            "tags": [
                                "hdd"
                            ]
                        },
                        {
                            "name": "fast-placement",
                            "tags": [
                                "ssd"
                            ]
                        }
                    ],
                    "default_placement": "default-placement"
                }


2. Map the placement targets to the ceph backend pools.


   
       "placement_pools": [
            {
                "key": "default-placement",
                "val": {
                    "index_pool": ".bj-dz.rgw.buckets.index",
                    "data_pool": ".bj-dz.rgw.buckets",
                    "data_extra_pool": ""
                }
            },
            {
                "key": "fast-placement",
                "val": {
                    "index_pool": ".bj-dz.rgw.buckets.index",
                    "data_pool": ".bj-dz.rgw.buckets.hot",
                    "data_extra_pool": ""
                }
            }
        ]
   


   

3. In order to enable the user create buckets in these two

   placement_target/ceph pools, I add two placement_tags for my user.


   
          "keys": [
                {
                    "user": "testuser",
                    "access_key": "6R2MJWR863EREUDD0KTZ",
                    "secret_key": "74eHNNQa1oLBlvZfO2CC2hIU8cobSYxTgeRDtXtH"
                }
            ],
            "swift_keys": [],
            "caps": [],
            "op_mask": "read, write, delete",
            "default_placement": "default-placement",
            "placement_tags": [
                "ssd",                "hdd"
            ]


   

4. Test if it works.


- Test if we can create a bucket 'y-ssd' in 'fast-placement target'/'pool .bj-dz.rgw.buckets.hot'.

  
bucket = conn.create_bucket('y-ssd', location=':fast-placement')



- Test if we can create a bucket 'y-normal' in 'default-placement'/'pool .bj-dz.rgw.buckets'.

   
 bucket = conn.create_bucket('y-normal', location=':default-placement')





5. Complete Region map/zone map/ user info


///// Region map //////////////
# radosgw-admin regionmap get --name client.radosgw.bj-dz-1 --cluster gang2
{
    "regions": [
        {
            "key": "bj",
            "val": {
                "name": "bj",
                "api_name": "bj",
                "is_master": "true",
                "endpoints": [
                    "http:\/\/s3.mydomain.com:80\/"
                ],
                "hostnames": [],
                "master_zone": "bj-dz",
                "zones": [
                    {
                        "name": "bj-dz",
                        "endpoints": [
                            "http:\/\/s3.mydomain.com:80\/"
                        ],
                        "log_meta": "true",
                        "log_data": "true",
                        "bucket_index_max_shards": 0
                    },
                    {
                        "name": "bj-xz",
                        "endpoints": [
                            "http:\/\/yhg-new:80\/"
                        ],
                        "log_meta": "true",
                        "log_data": "true",
                        "bucket_index_max_shards": 0
                    }
                ],
                "placement_targets": [
                    {
                        "name": "default-placement",
                        "tags": [
                            "hdd"
                        ]
                    },
                    {
                        "name": "fast-placement",
                        "tags": [
                            "ssd"
                        ]
                    }
                ],
                "default_placement": "default-placement"
            }
        }
    ],
    "master_region": "bj",
    "bucket_quota": {
        "enabled": false,
        "max_size_kb": -1,
        "max_objects": -1
    },
    "user_quota": {
        "enabled": false,
        "max_size_kb": -1,
        "max_objects": -1
    }
}

///// zone map ///////////////
[root@yhg-1]# radosgw-admin zone get --cluster gang2 -c /etc/ceph/gang2.conf --name client.radosgw.bj-dz-1
{
    "domain_root": ".bj-dz.domain.rgw",
    "control_pool": ".bj-dz.rgw.control",
    "gc_pool": ".bj-dz.rgw.gc",
    "log_pool": ".bj-dz.log",
    "intent_log_pool": ".bj-dz.intent-log",
    "usage_log_pool": ".bj-dz.usage",
    "user_keys_pool": ".bj-dz.users",
    "user_email_pool": ".bj-dz.users.email",
    "user_swift_pool": ".bj-dz.users.swift",
    "user_uid_pool": ".bj-dz.users.uid",
    "system_key": {
        "access_key": "CZB6EQFR7X36BUW1FYOM",
        "secret_key": "Gr934Fpaue3FaS2SQn5qE8DCjcntUqisMafUxVbw"
    },
    "placement_pools": [
        {
            "key": "default-placement",
            "val": {
                "index_pool": ".bj-dz.rgw.buckets.index",
                "data_pool": ".bj-dz.rgw.buckets",
                "data_extra_pool": ""
            }
        },
        {
            "key": "fast-placement",
            "val": {
                "index_pool": ".bj-dz.rgw.buckets.index",
                "data_pool": ".bj-dz.rgw.buckets.hot",
                "data_extra_pool": ""
            }
        }
    ]
}

//////// user info ///////////

{
    "key": "user:testuser",
    "ver": {
        "tag": "_nDultgTsPPMGNB3B2Sk2fc8",
        "ver": 1
    },
    "mtime": 1451306407,
    "data": {
        "user_id": "testuser",
        "display_name": "First User",
        "email": "",
        "suspended": 0,
        "max_buckets": 1000,
        "auid": 0,
        "subusers": [],
        "keys": [
            {
                "user": "testuser",
                "access_key": "6R2MJWR863EREUDD0KTZ",
                "secret_key": "74eHNNQa1oLBlvZfO2CC2hIU8cobSYxTgeRDtXtH"
            }
        ],
        "swift_keys": [],
        "caps": [],
        "op_mask": "read, write, delete",
        "default_placement": "fast-placement",
        "placement_tags": [
            "ssd",
            "hdd"
        ],
        "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": []
    }
}

你可能感兴趣的:(multi,Data,target,placement,rgw,pools,多pool)