A data storage method, wherein the method is applied to a distributed storage system; the distributed storage system comprises a NameNode, multiple first storage nodes, and multiple second storage nodes; the multiple first storage nodes store file blocks of a file in a distributed manner; the multiple second storage nodes store, in a distributed manner, check code blocks obtained by coding the file blocks; each of the second storage nodes comprises a data processing apparatus that is communicatively connected to the NameNode; and the method comprises: • receiving, by the data processing apparatus, identifiers of multiple target storage nodes and an identifier of a target file that are sent by the NameNode, wherein the multiple target storage nodes have stored file blocks of the target file (step 201); • determining, by the data processing apparatus, according to a quantity of the target storage nodes and a quantity of second storage nodes specified by the NameNode, a quantity of first parameters in a partial byte coding function and a quantity of same first parameters comprised in partial byte coding functions on two closely adjacent second storage nodes, wherein the partial byte coding functions comprised on the two closely adjacent second storage nodes have a quantity of overlapped first parameters; • coding, by the data processing apparatus, a part of file blocks of the target file according to the identifiers of the target storage nodes and the partial byte coding function, to obtain a first check code, wherein the partial byte coding function obtains a coding result by coding the part of file blocks of the target file (step 202); • coding, by the data processing apparatus, all file blocks of the target file according to the identifiers of the target storage nodes and a full byte coding function, to obtain a second check code, wherein the full byte coding function obtains a coding result by coding all the file blocks of the target file (step 203); and • storing, by the data processing apparatus, the first check code and the second check code in storage space of a second storage node to which the data processing apparatus belongs (step 204). • receiving, by the data processing apparatus, identifiers of multiple target storage nodes and an identifier of a target file that are sent by the NameNode, wherein the multiple target storage nodes have stored file blocks of the target file (step 201); • determining, by the data processing apparatus, according to a quantity of the target storage nodes and a quantity of second storage nodes specified by the NameNode, a quantity of first parameters in a partial byte coding function and a quantity of same first parameters comprised in partial byte coding functions on two closely adjacent second storage nodes, wherein the partial byte coding functions comprised on the two closely adjacent second storage nodes have a quantity of overlapped first parameters; • coding, by the data processing apparatus, a part of file blocks of the target file according to the identifiers of the target storage nodes and the partial byte coding function, to obtain a first check code, wherein the partial byte coding function obtains a coding result by coding the part of file blocks of the target file (step 202); • coding, by the data processing apparatus, all file blocks of the target file according to the identifiers of the target storage nodes and a full byte coding function, to obtain a second check code, wherein the full byte coding function obtains a coding result by coding all the file blocks of the target file (step 203); and • storing, by the data processing apparatus, the first check code and the second check code in storage space of a second storage node to which the data processing apparatus belongs (step 204). <EOS>