What is FastDFS distributed file system?

FastDFS distributed file system

Why do we need it?

​ As we all know, in the microservice architecture, requests coming in from the gateway will Ribbonbe load-balanced, which may cause each request to be processed by a different server, because, in order to improve the throughput of the system, some services are clustered In this case, when a user needs to store a file, if the file is stored in the server that currently processes the request, then next time you want to obtain the file, you may not be able to get it, because you This request may be handled by another server. In order to solve the problem of storing Chinese files in a distributed system, FastDFS came into being

What is FastDFS?

​ This is an open source distributed file system that is responsible for storing files. Its main functions include: file storage, file synchronization, file access, etc., which solves the problem of mass storage and load balancing. Especially suitable for online services that use files as the carrier, such as photo album websites, video websites, and so on.

​ FastDFS is tailor-made for the Internet, taking full consideration of redundant backup, load balancing, linear expansion, etc., and focusing on high availability and high performance. Using FastDFS, you can easily build a high-performance file server cluster to upload and download files Wait for service

The structure of FastDFS :

FastDFS server has two roles**: tracker (tracker) and storage node (storage). In a Storage cluster, each Volume is also called a group**

How does FastDFS store files?

Stored procedure

TrackerMainly responsible for scheduling requests, load balancing play a role similar to the micro registry service (with a heartbeat mechanism, etc.), it has a storage information for each point, receipt of client to store files When the request is made, a load balancing algorithm is used to select one Storageto store the file.

Why are all clusters?

​ As mentioned before, terms such as high availability and load balancing are all guaranteed by the clustering of trackers. When a tracker goes down, other trackers can continue to process storage requests, which ensures high availability. When deciding which storage the file should be stored in, load balancing algorithms such as random or polling are used to ensure that the data stored in each storage is more uniform

​ I mentioned earlier that redundant backup and linear expansion are guaranteed by groups. First of all, think about why the concept of group appears? **Because, when we store files, we don't mean that everything will be fine after storing the files in a certain storage. **What if a machine fails? **The data in there may be lost. This is a very serious situation. In order to solve this situation, FastDFS can use multiple Storages to store the same files. The purpose of this is to backup data. That is, redundant backup, which solves the problem of file loss when a certain Storage fails. These Storages that store the same files belong to the same group. There is another situation, **how to expand when the number of stored files gradually increases? **According to the structure of FastDFS, we can expand the capacity by adding groups

Guess you like

Origin blog.csdn.net/weixin_44829930/article/details/110305771