The application provides a node setting method, a data storage method, an electronic device and a storage medium. Each storage node is respectively provided with a corresponding
sparse file, each
virtual storage address in the
sparse file corresponds to each physical storage address in the corresponding storage node in one-to-one correspondence, and the method comprises the following steps: acquiring a data storage instruction, the data storage instruction comprising a data storage address and to-be-stored data; writing the to-be-stored data into each
sparse file according to the data storage instruction, the
virtual storage address indicated by the data storage address; and writing the to-be-stored data written in the
virtual storage address indicated by the data storage address in each sparse file into the corresponding storage node respectively, the physical storage address corresponding to the virtual storage address. Therefore, compared with the
backup mode of the primary node and the standby node in the prior art, the data is not easy to be lost due to the absence of the
time difference between the primary node and the standby node.