Article Directory
What is FastDFS
FastDFS is a lightweight open source distributed file system, its file management features include: file storage, file synchronization, file access (file upload, file download), etc., to solve the high-capacity storage and load balancing issues. Particularly suitable for the carrier to file online services, such as photo album sites, video sites , and so on.
FastDFS tailor-made for the Internet, full account of redundancy, load balancing, and other mechanisms linear expansion, and focus on high availability, high performance and other indicators, it is easy to use FastDFS to build a high-performance file server clusters to provide file upload and download and other services.
FastDFS role
FastDFS server has two roles: tracker (tracker) and the storage node (storage).
- Tracker main job scheduling work, starting on the access load balancing role.
- Storage node to store files, complete file management functions of all: is such a store, sync, and provide access interface , FastDFS the same time to manage the metadata file .
Related meta data is called file attribute of the file to the key-value pair (key value) represented manner, such as: width = 1024, which is the key width, value 1024. Property list file metadata file can contain multiple pairs.
Tracking and storage nodes may be constituted by one or more servers. Tracker server and storage node can be increased at any time without affecting the online or offline service. Wherein the tracker servers are all equal, the pressure may be increased or decreased according to the server at any time.
In order to support a large capacity, the storage node (server) using the sub-volume (or packet, Group) is organized. Storage system consists of one or more volumes that, between the volume with the volume file are independent, the file capacity of all volumes is the file accumulation capacity of the overall storage system. A volume may be formed from one or more storage servers, the storage server under a file volume is the same, the volume of the multiple storage servers played redundancy and load balancing effect .
Increase in the volume server, the existing file synchronization is completed automatically by the system, after synchronization is complete, the system automatically switches to the new server online service .
When memory is low or about to run out, you can dynamically add volume. Only need to add one or more servers, and configure them for a new roll, so that the expansion of the capacity of the storage system.
FastDFS document identification divided into two parts: a volume and file names, both are indispensable.
Upload and download process
Tracker:
before the text says, tracker in fact, a scheduler load balancing, user-initiated request will first go through tracker. You can have multiple tracker, analogous to nginx.
Storage node:
said before, a plurality FastDFS group, each group comprising a plurality of nodes, to make a redundant role.
User initiates a request to the tracker, the tracker then receives a request that he would go to look at look at which storage is available, get the corresponding node address after, will be returned to the user. The user then initiates a request to do an upload or download operation again. As shown below:
As for uploading and downloading timing diagram below, not repeat them: