Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the directory-layout-spread parameter of glusterfs

Shulou Source: shulou.com Published: 2022-05-31 14:44:51 10月04日 Update

This article mainly explains "how to use the directory-layout-spread parameter of glusterfs". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the directory-layout-spread parameter of glusterfs.

I recently encountered the directory-layout-spread parameter of dht. What is this? The default is subvolume-count. Literally means the number of layout distribution, then what is the specific effect? I did an experiment:

1) create a distributed service (1 x 4, disk1, disk2,disk3,disk4) test to start the service. Modify the vol configuration file trusted-xxxxx-fuse.vol corresponding to the fuse client, add the "option directory-layout-spread 3" field at dht, and set directory-layout-spread to 3. 0.

Note: at present, this parameter can only be set by manually modifying the configuration file, not dynamically through the gluster command.

2) mount client, create three directories in the mount point. 1. Then copy a large number of small files in directory a, and check the file distribution on the backend brick. It is found that the files are only distributed on disk2,disk3,disk4, but there are no files on disk1. two。 Delete all the files in directory a, and then want to copy a large number of small files in directory b, and check the file distribution on the backend brick. It is found that files are only distributed on disk1,disk2,disk3, but there are no files on disk4.

Through the above experiments and combined with source code analysis: directory-layout-spread is set by the user, the default value is the subvolume-count of the dht module, and the number of subvolumes used in the directory hash layout. That is, users can specify that the files under a certain directory can be distributed to N sub-volumes (which are determined by hash algorithm) instead of all sub-volumes. According to hash algorithm, each directory has different N sub-volumes, so that when there are a large number of directories and files, the distribution of files can reach a balanced state as a whole.

The benefits of introducing this parameter are:

1) since the layout of a directory is not allocated to all subvolumes, the loss of files in all directories will not occur when a subvolume down is dropped.

2) since the layout of a directory is not assigned to all subvolumes, when a subvolume causes layout repair, it will not cause all directories to be repaired by layout.

3) rebalance does not require all subvolumes to participate (this point has not been verified ^-^).

Later:

From the directory-layout-spread parameter of glusterfs, I think of the lables function of moosefs (above moosefs 3.0). Lables is to assign a specified chunkservers (storage server) to a directory. For example, the file access performance requirements stored in the A directory are higher, we can assign the files in this directory to the chunkservers equipped with SSD solid state disk, while the B directory files have lower performance requirements, we can separate the files in this directory to the chunkservers of ordinary HDD. Of course, if there are subsequent changes or business needs, you can migrate SSD--- > HDD or HDD---- > SSD dynamically.

At this point, I believe you have a deeper understanding of "how to use the directory-layout-spread parameters of glusterfs". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: File directory parameter allocation volume situation number content dynamic customer client performance user algorithm learning experiment service configuration different ordinary Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Huawei Linux Docker macOS