Creating a sample erasure-coded pool

Create an erasure-coded pool and specify the placement groups.

About this task

The ceph osd pool create command creates an erasure-coded pool with the default profile, unless another profile is specified. Profiles define the redundancy of data by setting two parameters, k, and k. These parameters define the number of chunks a piece of data is split and the number of coding chunks are created.

The simplest erasure-coded pool is equivalent to RAID5 and requires at least four hosts. You can create an erasure-coded pool with 2+2 profile.

Procedure

  1. Set the following configuration for an erasure-coded pool on four nodes with 2+2 configuration.
    ceph config set mon mon_osd_down_out_subtree_limit host
    Important: This is not needed for an erasure-coded pool in general.
    Note: For an EC cluster with four nodes the value of K+M is 2+2. If a node fails completely, it does not recover as four chunks and only three nodes are available. When you set the value of mon_osd_down_out_subtree_limit to host, during a host down scenario, it prevents the OSDs from marked out, so as to prevent the data from re balancing and the waits until the node is up again.
  2. For an erasure-coded pool with a 2+2 configuration, set the profile.
    ceph osd erasure-code-profile set ec22 k=2 m=2 crush-failure-domain=host 
    [ceph: root@host01 /]# ceph osd erasure-code-profile set ec22 k=2 m=2 crush-failure-domain=host 
    
    Pool : ceph osd pool create test-ec-22 erasure ec22 
  3. Create an erasure-coded pool.
    ceph osd pool create ecpool 32 32 erasure
    pool 'ecpool' created
    $ echo ABCDEFGHI | rados --pool ecpool put NYAN -
    $ rados --pool ecpool get NYAN -
    ABCDEFGHI

    32 is the number of placement groups.