FastDFS Distributed File System Architecture

FastDFS Distributed File System Architecture

1. Distributed file system

           FastDFS is an open source distributed file system. It manages files. Its functions include: file storage, file synchronization, file access (file upload, file download), etc., which solves the problem of mass 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.



 

 

2. FastDFS system architecture


 
 



 

Role 1: tracker

The tracker is the hub for the interaction between the client and the storage, mainly for scheduling and load balancing;

① Record the grouping information;

② Record the information of storage server storage;

③ Load balancing;

④ scheduling;

 

Role 2: storage

① Store file data such as pictures;

② Data synchronization will be performed between storages in the same group;

③ The storage server will regularly report status information to the tracker; (local synchronization time, all group information)

 

 

3. FastDFS - upload files


File file = new File("/Users/hyy044101331/Downloads/001.png");
String fileId = fileStorageService.uploadFile(file);
log.info("----------, fileId = {}" ,fileId);

  

 http://192.168.1.42/group1/M00/00/00/wKgBKlbUZYqAWrIYAADJGnU9rhU540.png

 

 

Fourth, FastDFS - download files

 

 

String outPath = "/Users/hyy044101331/Downloads/077.png";
byte[] bytes = fileStorageService.downloadFile(fileId);
File outFile = FileUtil.getFileFromBytes(bytes,outPath);

 

 

 

Five, file access path

http://192.168.1.42/group1/M00/00/00/wKgBKlbUZYqAWrIYAADJGnU9rhU540.png

 

"192.168.1.42":  storage服务器ip;

"group1":   组名;

"M00":  虚拟磁盘路径;

"00/00":  数据2级目录;

              虚拟磁盘路径下的数据文件存储目录;

"xxx.png":  文件名,

                 影响文件名生成的因素:

                           ① client的ip;

                           ② 文件创建时间;

                           ③ 文件大小;

                           ④ 文件扩展名;

                           ⑤ 随机数;

        

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327040214&siteId=291194637