This topic describes how to enable the transparent compression feature in LindormDFS
provided by ApsaraDB for Lindorm (Lindorm).
Prerequisites
When you purchase an instance, you must select
Capacity for the Storage Type parameter.
Note Only the files created after the transparent compression feature is enabled are compressed.
The files created before the feature is enabled are not compressed.
Enable the transparent compression feature
- Use open source HDFS clients to access LindormDFS.
- Run the following command to enable the transparent compression feature for a data
directory:
hdfs dfs -setfattr -n user.lhdfs_compress_enabled /<Data directory path>
If you want to disable the transparent compression feature of a data directory, you
can run the following command:
hdfs dfs -setfattr -x user.lhdfs_compress_enabled /<Data directory path>
- Run the following command to check whether the transparent compression feature is
enabled for a data directory:
hdfs dfs -getfattr -d /<Data directory path>
If the following query result is returned, the transparent compression feature is
enabled.
$ hdfs dfs -getfattr -d hdfs://ld-xxxx/tmp
# file: hdfs://ld-xxxx/tmp
user.lhdfs_compress_enabled
View the result of transparent compression
- Log on to the Lindorm console.
- On the Instance List page, find the ID of the instance for which the transparent compression feature is
enabled, and click the instance ID.
- In the left-side navigation pane, choose .
- On the UI Access page, click ClusterManager.

Note If you are accessing the cluster management system for the first time, you must reset
the password used to access the system UI.
- In the menu bar of the cluster management system, choose .
- On the Browse Directory page, use the following methods to view the sizes of a data directory or a file before
and after compression:
- View the sizes of a data directory before and after compression.
In the
Directory Usage section, enter the path of the data directory in the search box and click
GO!.Then, you can check the result. The following figure shows an example of the query
result. In the example, the size of the
/tmp path before the data in the directory is compressed is 960.89 GB. The size after
the data in the directory is compressed is 857.37 GB.

- View the size of a file before and after compression.
In the
Directory Usage section, enter the path of the file in the search box and click
GO!.Then, you can check the result. The following figure shows an example of the query
result. In the example, the size of the file in the
/tmp/terasort/data/1000g_1/part-r-01216 path before the file is compressed is 476.84 MB. The size after the file is compressed
is 175.77 MB.
