With the development of the business, the server will store more and more files, in the initial stage, we will directly through the expansion to solve this problem. But the hard disk can not be stored in the future all incremental files, and the hard disk can not be unlimited capacity expansion, when the hard disk is allocated, or add hard disk, or add server.

Add hard disk may be a faster way, as long as in the program to judge in a certain time node of the file, write and read are in the specified disk character can be, but each machine interface is limited, and the rack can be stored hard disk location is limited, when the interface or location are occupied, insufficient space to do? So you can have many, many servers to store and manage these files.

Is inevitable due to server problems, such as our software bug, the bug of the operating system, hard disk failure, suddenly without electricity, and even natural disasters, etc., so in order to guarantee the security of data, you need to use redundant way to store, a file that is stored in multiple servers, such as deposit below 2 servers, In case of a problem with server 1, we can also read files from server 2. The more redundant copies there are, the more secure the data is and, of course, the more expensive the server is to store it.

When stored for a period of time, the situation of the server is as follows. The size of the file is out of our control, so every time when uploading a file, we need to know whether the file is larger than the available space of the server to be uploaded. Files of different sizes are also difficult to manage.

So the common practice is to break files into fixed size blocks, such as 64MB or 128MB, and then upload them to the server. For example, in the following image, the file is divided into four blocks and stored on four servers, with three copies of each block.

If server 1 is unavailable, files 1, 2, and 4 still have copies on other servers, and the files are still safe.