In the FASTDFS structure diagram of the previous article, we can see that the FASTDFS server has two roles: Tracker (tracker) and storage node (storage). Trackers (tracker) mainly do
Dispatch, like a bus station inside the dispatcher, is responsible for selecting the optimal storage node (storage) through load balancing. Storage nodes (storage) are, by definition, responsible for storing,
A service for data synchronization and operation of data. Today we will focus on storage server.
Overview
Storage Server (Storage) in group groups, such as the above a group contains multiple Storage machines, the data are backed up, storage space for the group content of the smallest
Storage, it is recommended that multiple storage within the group are configured the same as possible to avoid wasting storage space. Group-based storage allows for easy application isolation and load balancing
, copy number customization (group within storage The number of servers is the number of copies of the group), such as depositing different application data to different group to isolate application data, such as group1 for internal
Network access data, group2 Access data for the extranet. At the same time , the application can be assigned to different group to do load balance by using the access condition of the application. The disadvantage is that the group's capacity is stored by a single machine
capacity limitations such as 3 storage,storage1 in GOURP1 are 100G, Storage2 for the 120G, storage 110G, then for the group1, the storage space size is 100G.
When a machine in the group breaks down, the recovery time can be particularly long, since the data recovery depends on the other machines in the group.
Storage Storage
The storage of each storage in the group relies on the local filesystem, so storage can dynamically increase the size of the storage space, for example, Fastdfs system uses group1 space after a period of time to make
Run out, then we can dynamically mount more disks for all storage hosts under Group1. It is also possible to specify storage directories that are disk storage, such as 5 disks, which are mounted separately
In/data/disk1-/data/disk5, these 5 storage directories can be configured as storage data store directories.
When storage accepts a write file request that is synchronized to the client or other storage, it will select one of the storage directories to store the file according to the configured rules.
To prevent too many files in a single directory, at the first boot of storage, a Level 2 subdirectory is created in each data store directory, 256 per level, 65,536 files in total, and the newly written text
is routed to one of the subdirectories in a hash, and the file data is stored directly in the directory as a local file.
Storage Synchronization Policy :
File synchronization is the responsibility of separate threads, each of which has a synchronization thread to the other storage in the same group, such as a group of three storage, each storage has two threads responsible for the other storage.
Synchronization of two storage. The synchronization thread is started by the tracker communication thread because only tracker knows which storage in a group.
The execution process of the synchronous thread is mainly composed of the source synchronization and the Binlog synchronization, and the specific synchronization process will be described in detail in another article.
Note: Some of this information is referenced in Chinaunix and other websites
Fastdfs Distributed File System Storage Server Introduction