FastDFS lightweight distributed file system

1. Introduction to FastDFS

FastDFS : It is an open source lightweight distributed file system . It manages files. Its functions include: file storage, file synchronization, file access (file upload, file download), etc., which solves the problems of large-capacity storage and load balancing. . It is especially suitable for online services with files as the carrier, such as photo album websites, video websites and so on.

FastDFS is tailor-made for the Internet, fully considers redundant backup, load balancing, linear expansion and other mechanisms, and pays attention to high availability, high performance and other indicators. Using FastDFS is easy to build a high-performance file server cluster to provide file upload and download. and other services.

insert image description here

FastDFS architecture : including Client, Tracker serverand Storage server.

Client requests Tracker to upload and download files, and Tracker then schedules Storage to complete file upload and download. Client: The client, the initiator of the business request, uses the TCP/IP protocol to exchange data with the Tracker or Storage through a proprietary interface. FastDFS provides upload, download, delete and other interfaces for clients to use.

Tracker server : Tracking server, mainly for scheduling and load balancing. Record the state information of all storage groups and storage servers in the cluster in memory, which is the hub of interaction between the client and the data server.

Storage server : storage server (storage node or data server), files and file attributes are saved to the storage server. The Storage server directly uses the file system of the OS to call and manage files. The storage group can be expanded horizontally and backed up vertically.

2. FastDFS upload and download process

  • The client asks the storage uploaded by the tracker, no additional parameters are required;
  • Tracker returns an available storage;
  • The client directly communicates with the storage to complete the file upload.

insert image description here

  • The client asks the storage of the file downloaded by the tracker, and the parameter is the file identifier (volume name and file name);
  • Tracker returns an available storage;
  • The client directly communicates with the storage to complete the file download.

insert image description here

3. FastDFS file index

group1/M00/00/00/wKgVjV_jUFqAYzZbAAFNF-5NQK4351.png

File index file_id : It is a string returned by Storage to the client after the client uploads the file, and it is the index information for accessing the file in the future.

The file index (file_id) information includes: group name, virtual disk path, data two-level directory, file name and other information.
Group Name : The name of the Storage group where the file is uploaded.
Virtual disk path : the virtual path configured by Storage, which corresponds to the disk option store_path*.
If store_path0 is configured, it is M00, if store_path1 is configured, it is M01, and so on.
Two-level directory for data : a two-level directory created by the Storage server under each virtual disk path
for storing data files.
File name : Generated by the storage server based on specific information, the file name includes: source storage server IP address, file creation timestamp, file size, random number, file extension and other information.

insert image description here

Guess you like

Origin blog.csdn.net/m0_68744965/article/details/129147086