Configuring BlueStore compression for a specific pool
Use these commands to configure compression settings for a specific pool. These settings override global defaults.
Procedure
-
Set the compression algorithm for the pool.
ceph osd pool set POOL_NAME compression_algorithm ALGORITHMFor example,[ceph: root@host01 /]# ceph osd pool set test_pool compression_algorithm snappy set pool 2 compression_algorithm to snappy
-
Set the compression mode for the pool.
ceph osd pool set POOL_NAME compression_mode MODEFor example,[ceph: root@host01 /]# ceph osd pool set test_pool compression_mode force set pool 2 compression_mode to force
-
Set the required compression ratio for the pool.
ceph osd pool set POOL_NAME compression_required_ratio RATIONote: Compression occurs only when compressed data size is less than or equal to 70% of the original size.For example,[ceph: root@host01 /]# ceph osd pool set test_pool compression_required_ratio 0.7
-
Set minimum and maximum blob sizes for the pool.
ceph osd pool set POOL_NAME compression_min_blob_size SIZE ceph osd pool set POOL_NAME compression_max_blob_size SIZE -
Verify the per-pool compression settings.
ceph osd pool get POOL_NAME OPTION_NAMEFor example,[ceph: root@host01 /]# ceph osd pool get test_pool compression_algorithm compression_algorithm: snappy
Configuring global BlueStore compression
Use the ceph config set commands to configure compression across all OSDs in the cluster.
Procedure
-
Set the global compression algorithm.
ceph config set osd bluestore_compression_algorithm ALGORITHMThe default value is snappy. This parameter is optional. -
Set the global compression mode.
The supported MODE inputs are:ceph config set osd bluestore_compression_mode MODE- none (default)
- passive
- aggressive
- force
-
Set the global compression ratio.
ceph config set osd bluestore_compression_required_ratio RATIOThe default value is
0.875. A value of0.7means that compression is applied only if the compressed data is 70% or smaller than the original. -
Set the minimum and maximum blob sizes.
ceph config set osd bluestore_compression_min_blob_size SIZE ceph config set osd bluestore_compression_max_blob_size SIZEThe following are the default blob sizes:- SSD
- 65536 bytes (minimum and maximum)
- HDD
- 8192 bytes (minimum) and 65536 bytes (maximum)
Removing global BlueStore compression
Remove global BlueStore compression settings when you want all OSDs to revert to their default values. Removing these options stops applying the overridden compression behavior for future writes; existing data is not modified.
Procedure
-
Remove the global compression algorithm.
This command overrides any set algorithms so that OSDs stop forcing a specific compression algorithm.
ceph config rm osd bluestore_compression_algorithm -
Remove the global compression mode.
This command clears the compression mode (
none,passive,aggressive, orforce) and returns OSDs to the default mode.ceph config rm osd bluestore_compression_mode -
Remove the global required ratio.
This command removes the threshold used to decide whether compressed data should be kept.
ceph config rm osd bluestore_compression_required_ratio -
Remove the minimum blob size.
This command removes the configured minimum blob size so that OSDs use the default value based on the device type.
ceph config rm osd bluestore_compression_min_blob_size -
Remove the maximum blob size.
This command removes the configured maximum blob size so that OSDs use the default value based on the device type.
ceph config rm osd bluestore_compression_max_blob_size