当前位置:网站首页>Working principle of fastdfs (technical principle)
Working principle of fastdfs (technical principle)
2022-07-28 23:49:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
FastDFS framework :
FastDFS The server has three roles : Tracking server (tracker server)、 Storage server (storage server) And the client (client).
**tracker server:** Tracking server , Mainly do scheduling work , Play the role of load balancing . Record the status information of all storage groups and storage servers in the cluster in memory , It is the hub of interaction between client and data server . comparison GFS Medium master More streamlined , Do not record file index information , The amount of memory used is very small .
**storage server:** Storage server ( also called : Storage nodes or data servers ), File and file properties (meta data) All saved to the storage server .Storage server Direct use of OS File system call management file .
**client:** client , As the originator of the business request , Through proprietary interfaces , Use TCP/IP The protocol interacts with tracker server or storage node .
FastDFS agreement :
FastDFS Roles are based on TCP/IP Protocol to communicate , The format of the agreement package is :header + body. The specific structure is shown in the figure :
FastDFS All nodes are connected by tcp/ip The way to communicate . The package consists of two parts :header and body
Upload mechanism :
Synchronous time management :
When a file is uploaded successfully , The client immediately initiates a request to download the file ( Or delete request ) when ,tracker How to choose a suitable storage server ?
In fact, each storage server needs to regularly report its own information to tracker, This information includes the local synchronization time ( namely , Timestamp of the latest file synchronized to ). and tracker According to the reporting situation of each storage server , You can know the file just uploaded , Whether the synchronization has been completed in this storage group . The synchronization information reporting is shown in the figure below :
Download mechanism :
Delicate FID: When it comes to downloading, you have to mention the file index ( also called :FID) The exquisite design of . The file index structure is shown in the figure below , After the client uploads the file, the storage server returns it to the client , Index information used to access the file later . File index information includes : Group name , Virtual disk path , Two levels of data , file name .
ps:
Group name : The name of the storage group where the file is uploaded , After the file is uploaded successfully, the storage server returns , It needs to be saved by the client . There can be multiple under a group storage, I feel that the group is for management storage Of
Virtual disk path : Virtual path to store server configuration , With disk options store_path* Corresponding .
Two levels of data : Two level directories created by the storage server under each virtual disk path , For storing data files .
file name : It's different from when the file is uploaded . Is generated by the storage server based on specific information , The filename contains : Source storage server IP Address 、 File creation timestamp 、 file size 、 Random numbers and file extensions .
Quick location of files :
know FastDFS FID After the composition of , Let's see FastDFS How to get through this ingenious FID Navigate to the file you want to access .
By group name tracker It can quickly locate the storage server group that the client needs to access , And will choose the appropriate storage server to provide client access ;
Storage server according to “ File storage virtual disk path ” and “ Two level directory of data files ” You can quickly navigate to the directory where the files are located , And according to the file name to find the client needs to access the file .
The main content of this sharing includes :FastDFS The task division of each role / Collaboration , The principle design of document index and document uploading / Download process . Through this study, we are right FastDFS Have a preliminary understanding of , Such as :
FastDFS There are only three characters ; And neither the tracking server nor the storage server has a single point .
The tracking server passively receives reports from the storage server , Group management of storage servers ; And select the applicable storage server for the client . The same storage server can report status information to multiple tracking servers at the same time .
All storage servers in the storage server group are peer-to-peer , The stored data is one-to-one and the same ; All storage servers are online at the same time , Greatly improve the utilization rate of the server , Share the pressure of data access .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/129014.html Link to the original text :https://javaforall.cn
边栏推荐
- 控件 圆角描边 MaterialShapeDrawable
- Worthington核糖核酸酶B历史和化学性质说明
- hutool官网(hutool好用吗)
- Class, leetcode919 -- complete binary tree inserter
- General addition, deletion, modification and query of custom MVC
- [self] - brush questions BFS
- Hyperparametric optimization (grid search and Bayesian Optimization)
- Pagoda phpMyAdmin unauthorized access vulnerability
- Asynchronism and synchronization of visa write and read functions by LabVIEW
- mongodb索引添加、查看、导出、删除
猜你喜欢

Asynchronism and synchronization of visa write and read functions by LabVIEW

Inspur clusterenginev4.0 remote command execution vulnerability cve-2020-21224

什么是驱动程序签名,驱动程序如何获取数字签名?

零视科技 H5S视频平台 GetUserInfo 信息泄漏漏洞 CNVD-2020-67113

【详细超简单】如何使用WebSocket链接

Worthington丨Worthington胰蛋白酶抑制剂说明书

Class, leetcode919 -- complete binary tree inserter

2022g3 boiler water treatment test simulation 100 questions simulation test platform operation

【自】-刷题-逻辑

【自】-刷题-动态规划
随机推荐
金仓数据库 KingbaseES V8.3至V8.6迁移最佳实践(3. KingbaseES移植能力支撑体系)
尿酸酶丨Worthington猪肝尿酸酶的特征:
Arm-A53资料「建议收藏」
AUTOCAD——Excel表格导入CAD、CAD合并两兄弟
2022年G2电站锅炉司炉考试题库模拟考试平台操作
What is utxo?
解决:Direct local .aar file dependencies are not supported when building an AAR.
LabVIEW对VISA Write和Read函数的异步和同步
Hyperparametric optimization (grid search and Bayesian Optimization)
智能垃圾桶(七)——SG90舵机的介绍与使用(树莓派pico实现)
The classic dual stack implementation queue, pay attention to the modification of the judgment conditions of traversing the stack.
Compatibility description between kingbasees and Oracle (2. Data type)
NPDP考试需要携带什么?文具携带说明
编译原理研究性学习专题 2——递归下降语法分析设计原理与实现
Zero view h5s video platform getUserInfo information disclosure vulnerability cnvd-2020-67113
脲酶丨Worthington杰克豆脲酶的特性及测定方案
Deep analysis of integrated learning xgboost
【详细超简单】如何使用WebSocket链接
(22杭电多校二)Two Permutation (dp),Package Delivery (贪心)
2022g3 boiler water treatment test simulation 100 questions simulation test platform operation