Distributed File System
Google File System:It is a distributed file system developed and designed by Google for large-scale data processing.
First, let's briefly describe this distributed architecture. We all know that the data size to be stored is growing, but the storage capability of a computer is limited, although we can solve this problem by improving the storage capability of a computer, this problem cannot be solved at all. Therefore, we use many cheap computers to store the data in a distributed manner. Simply put, the files to be saved are separated into one copy and saved to many computers.
To meet Google's rapidly growing data processing needs, Google designed and implemented a Google file system. It is a storage machine with hundreds or even thousands of ordinary cheap devices. The following are some introductions.
1) We know that there are so many machines, it is very common for some machines in these devices to have faults, therefore, gfs integrates continuous monitoring, error detection, disaster redundancy, and automatic recovery mechanisms.
2) The size of data to be stored is very large. Therefore, it is unreasonable to manage hundreds of millions of small files in KB according to the size of the previous storage file blocks, in this system, they define that the size of a file block is 64 MB.
3) The vast majority of big data is appended to the end of the file, rather than overwriting the data. The random write of large files basically does not exist.
Architecture Design:GFS adopts Master/Slave Mode. a gfs includes one master server R and multiple chunk servers. Of course, a master here refers to a logical one. There can be multiple physical ones (there may be two, one for the case, and the other for the normal data management ). In addition, we can place the client and the chunk server on the same machine.
Let's first explain how data is stored. We have mentioned that big data will be split and the unit is 64 MB. Therefore, in GFS, the stored files are split into blocks of a fixed size. Each time a block is created, the master will assign it a globally fixed identifier. The chunk server stores the block in the form of Linux File storage in the local system. For reliability, each block may be copied to multiple copies and stored on different machine nodes. In addition, the master server stores other metadata information about the location ing between files and blocks.
Master (namenode in hadoop):
Metadata of all files of the master manager, such as namespace and block ing location. The master node uses the heartbeat information to periodically communicate with each chunk server, send commands to each chunk server, and receive the status information of the chunk server. We know that the master node is a single node (logically ). This greatly simplifies the system design. A single master can precisely locate the chunk server where each block is located and make replication decisions through global information. Since there is only one master, we need to reduce the read/write operations on the master to avoid the bottleneck of the Master System. In addition, the metadata of the master node is stored in the memory, which is fast, but also results in limited data storage.
It should be noted that the client does not read or write data on the master, but obtains the chunk location information of the block through the master, and directly performs Data Interaction and read/write with the chunk server. We say that the master has only one node logically, and there may be two physical nodes. Just like HDFS in hadoop, there is a namenode and secondarynamenode. In another normal situation, when the master server goes down, it shows the value. A bit of image, of course, it also has other good features.
Chunk (datanode in hadoop ):This is the machine used to store data. The file size is 64 MB, which is much larger than the block size of the general file system. Copies of each block are stored on the chunk server as common Linux Files. The master server does not store the information of the chunk server that persistently stores copies of the specified block. The master server only polls the chunk server at startup to obtain this information. The master server ensures that the information it holds is always up-to-date, because it controls the allocation of all block locations and monitors the status of the chunk server through periodic heartbeat information.
Process: First, the client converts the file name to the byte offset specified by the program based on the fixed block size into the block reference of the file. It then sends the file name and block index to the master node. The master node sends the corresponding block ID and Copy location information to the client. The client uses the file name and block index as the key to cache the information. Then the client sends the request to one of the copies. Generally, the most recent copy is selected. The request information contains the block identifier and byte range. In subsequent read operations on this block, the client does not have to communicate with the master node any more, unless the cached metadata information expires or the file is reopened. In fact, the client usually queries multiple block information in one request.
Hadoop is implemented by HDFS Based on GFS. Therefore, they work the same way. Now hadoop is everywhere, so we will summarize this for gfs. The specific introduction is provided in HDFS of hadoop.
Reference: http://www.open-open.com/lib/view/open1328763454608.html