Rate This Document
Findability
Accuracy
Completeness
Readability

Enabling RGW Data Compression

Perform operations in this section only on ceph1.

Creating Storage Pools for Data Compression

Run the following commands to create storage pools for data compression:

1
2
3
4
5
6
ceph osd pool create default.rgw.buckets.data-compress 4096 4096
ceph osd pool create default.rgw.buckets.index-compress 256 256
ceph osd pool create default.rgw.buckets.non-ec-compress 64 64
ceph osd pool application enable default.rgw.buckets.data-compress rgw
ceph osd pool application enable default.rgw.buckets.index-compress rgw
ceph osd pool application enable default.rgw.buckets.non-ec-compress rgw

The storage pools are created for enabling RGW data compression. The created storage pools correspond to data_pool, index_pool, and data_extra_pool in the placement policy to be created in the following operations.

The default.rgw.buckets.data-compress command can also be used to create storage pools for data compression in EC mode. For details, see Creating a Storage Pool in EC Mode.

Adding a Placement Policy

The Ceph object storage cluster has a default placement policy default-placement. You need to create the placement policy compress-placement for RGW data compression.

  1. Create a compress-placement placement policy.
    1
    radosgw-admin zonegroup placement add --rgw-zonegroup=default --placement-id=compress-placement
    

  2. Enter the compress-placement information, including the storage pools and compression algorithm of the placement policy.
    1
    radosgw-admin zone placement add --rgw-zone=default --placement-id=compress-placement --index_pool=default.rgw.buckets.index-compress --data_pool=default.rgw.buckets.data-compress --data_extra_pool=default.rgw.buckets.non-ec-compress --compression=zlib
    

    --compression=zlib indicates that the zlib compression algorithm is used. You can also use Snappy or LZ4.

Enabling the Placement Policy

  1. Export user metadata. The following uses the user.json file as an example.
    1
    radosgw-admin metadata get user:admin > user.json
    
  2. Open user.json and change the value of default_placement to compress-placement.
    1
    vi user.json
    

    Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.

  3. Run the following command on ceph1 to import the modified user metadata:
    1
    radosgw-admin metadata put user:admin < user.json
    
  4. Run the following command on all server nodes to restart the radosgw process:
    1
    systemctl restart ceph-radosgw.target
    
  5. Run the following command on ceph1 to check whether the new placement policy takes effect. If the value of default_placement is compress-placement, the placement policy takes effect.
    1
    radosgw-admin user info --uid="admin"
    

For more information about Ceph object storage, see the description in the Ceph open source community.