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.
- Create a compress-placement placement policy.
1radosgw-admin zonegroup placement add --rgw-zonegroup=default --placement-id=compress-placement

- Enter the compress-placement information, including the storage pools and compression algorithm of the placement policy.
1radosgw-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
- Export user metadata. The following uses the user.json file as an example.
1radosgw-admin metadata get user:admin > user.json
- Open user.json and change the value of default_placement to compress-placement.
1vi user.json
Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Run the following command on ceph1 to import the modified user metadata:
1radosgw-admin metadata put user:admin < user.json
- Run the following command on all server nodes to restart the radosgw process:
1systemctl restart ceph-radosgw.target
- 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.
1radosgw-admin user info --uid="admin"
