ceph

Ceph: How to place a pool on specific OSD?


I have a Ceph cluster of 66 OSD with a data_pool and a metadata_pool.

I would like to place the metadata_pool on 3 specific OSD which are having SSDs, since all other 63 OSD having older disks.

How can I force Ceph to place the metadata_pool on specific OSD?

Thanks by advance.


Solution

  • You need a special crush rule for your pool that will define which type of storage is to be used. There is a nice answer in the proxmox forum.

    It boils down to this:

    Ceph knows which drive is a HDD or SDD. This information in turn can be used to create a crush rule, that will place PGs only on that type of device.

    The default rule coming with ceph is the replicated_rule:

    # rules
    rule replicated_rule {
        id 0
        type replicated
        min_size 1
        max_size 10
        step take default
        step chooseleaf firstn 0 type host
        step emit
    }
    

    So if your ceph cluster contains both types of storage devices you can create the new crush rules with:

    $ ceph osd crush rule create-replicated replicated_hdd default host hdd
    $ ceph osd crush rule create-replicated replicated_ssd default host ssd
    

    The newly created rule will look nearly the same. This is the hdd rule:

    rule replicated_hdd {
        id 1
        type replicated
        min_size 1
        max_size 10
        step take default class hdd
        step chooseleaf firstn 0 type host
        step emit
    }
    

    If your cluster does not contain either hdd or ssd devices, the rule creation will fail.

    After this you will be able to set the new rule to your existing pool:

    $ ceph osd pool set YOUR_POOL crush_rule replicated_ssd
    

    The cluster will enter HEALTH_WARN and move the objects to the right place on the SSDs until the cluster is HEALTHY again.

    This feature was added with ceph 10.x aka Luminous.