Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does FastDFS achieve no file index?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how FastDFS does not have a document index, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

FastDFS does not need to save file index information because of its ingenious file ID design.

When uploading a file, the file ID is generated by storage server and returned to the caller (client). The returned file ID contains the group name and file name, and the caller saves the file ID to the database as credentials to access the file. The schematic diagram of the file upload process is as follows:

When client accesses the file with the file ID, it first asks tracker server,tracker server to return the available storage server according to the group name, and then the client sends the request to the storage server directly with the file ID, and the storage server can locate the file directly according to the file ID. The schematic diagram of the file download process is as follows:

An example of a file ID generated by FastDFS:

The two digits after the disk part M represent the disk sequence number based on 0.

The file name (excluding the suffix) is encoded by Base64 and contains the following 5 fields (each field is a 4-byte integer):

* Source storage server ID or IP address

* File creation timestamp

* File size

* CRC32 check code of file content

* Random number

Random numbers are introduced to prevent the generation of files with duplicate names.

If merge storage is used, the resulting file ID will be longer, with an extra 16 bytes after the file name.

This section is also encoded in Base64 and contains the following three fields (each of which is a 4-byte integer):

* trunk file ID to which it is stored

* File offset (offset)

* amount of space occupied

According to the first two fields, you can know the trunk file and offset location of the file.

FastDFS does not need file index, which eliminates the traditional name server role and makes FastDFS more concise and efficient.

The above is how FastDFS does not have a file index, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report