A data storage and reading method, system, device, apparatus, and medium

By considering the coordinates and distances of replica storage nodes in a distributed storage system to determine the target storage node, the inefficiency caused by improper selection of storage nodes in existing technologies is solved, achieving more efficient data storage and retrieval.

CN113849307BActive Publication Date: 2025-11-21HANGZHOU NETEASE ZHIQI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111105659.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-22
Publication Date
2025-11-21
Estimated Expiration
2041-09-22

AI Technical Summary

Technical Problem

In distributed storage systems, existing technologies cannot accurately determine the target storage node, resulting in low data storage and retrieval efficiency and an inability to effectively shorten interaction time.

Method used

By considering the pre-configured first coordinates of the replica storage node and its distance from the client node, M target storage nodes are determined to ensure that the remaining space of the storage nodes meets the data requirements, and the nearest node is selected for storage and retrieval based on distance priority.

Benefits of technology

It improves the efficiency of interaction between storage nodes, shortens the time spent on data storage and reading/writing, and avoids inefficiency caused by improper selection of target storage nodes on the same or different racks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849307B_ABST
    Figure CN113849307B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data storage and reading method, system, device, equipment and medium. Since when determining the target storage node for storing the target data, not only the influence of the pre-configured first coordinate corresponding to each copy storage node is considered, but also the influence of the distance between each copy storage node and the client node, and the influence of the distance between each copy storage node in the rack and the client node are considered, it is beneficial to more accurately determine the distance between each copy storage node and the client node, and it is also convenient and accurate to determine the target storage node for storing the target data. It is also beneficial to effectively shorten the time-consuming of data storage and reading and writing, and improve the efficiency of interaction between storage nodes when the copy storage node closest to the client node is determined as the target storage node.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data processing, and in particular, to a data storage and reading method, system, device, equipment and medium. BACKGROUND

[0002] In one or more clusters contained in the current distributed storage system, usually one cluster has hundreds or even thousands of storage nodes working cooperatively. For example, in a distributed file storage system (Hadoop Distributed FileSystem, HDFS), there can be multiple clusters, and any cluster can contain hundreds or even thousands of storage nodes for storing data, so that there are many storage nodes to choose from when determining a storage node for storing certain data. How to accurately determine a storage node for storing target data is a problem that people have paid more attention to in recent years. SUMMARY

[0003] The present disclosure provides a data storage and reading method, system, device, equipment and medium to solve the problem that the existing target storage node cannot be accurately determined to store target data.

[0004] The present disclosure provides a data storage method, which comprises:

[0005] receiving a data storage request of target data sent by a client node;

[0006] determining M target storage nodes from at least two replica storage nodes based on racks where the at least two replica storage nodes are respectively located and first coordinates corresponding to the at least two replica storage nodes respectively pre-configured; wherein M is a positive integer greater than or equal to 2, and sizes of remaining storage spaces of the M target storage nodes meet a size of a storage space required by the target data;

[0007] sending information of the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0008] The present disclosure provides a data reading method, which is applied to a client node, and the method comprises:

[0009] sending a data reading request of target data;

[0010] receiving information of M target storage nodes storing the target data; wherein the information comprises first coordinates corresponding to the M target storage nodes respectively and racks where the M target storage nodes are respectively located, and M is a positive integer greater than or equal to 2;

[0011] determine distances between the M target storage nodes and the client node according to the first coordinates corresponding to the M target storage nodes respectively, racks where the M target storage nodes are located, a rack where the client node is located, and the second coordinates corresponding to the client node respectively, and determine target storage nodes to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and access the corresponding target storage nodes to obtain the target data stored therein.

[0012] determine distances between the M target storage nodes and the client node according to the first coordinates corresponding to the M target storage nodes respectively, racks where the M target storage nodes are located, a rack where the client node is located, and the second coordinates corresponding to the client node respectively, and determine target storage nodes to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and access the corresponding target storage nodes to obtain the target data stored therein.

[0013] The present disclosure provides a data reading method, which is applied to a data management node, and the method comprises:

[0014] receiving a data reading request for target data sent by a client node;

[0015] determining information of M target storage nodes storing the target data and sending the information to the client node, so that the client node, after receiving the information of the M target storage nodes, determines distances between the M target storage nodes and the client node according to first coordinates corresponding to the M target storage nodes respectively, racks where the M target storage nodes are located, a rack where the client node is located, and second coordinates corresponding to the client node respectively, determines target storage nodes to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and accesses the corresponding target storage nodes to obtain the target data stored therein; wherein the information comprises the first coordinates corresponding to the M target storage nodes respectively, and the M is a positive integer greater than or equal to 2.

[0016] The present disclosure provides a data storage system, which comprises a data management node for executing the above-mentioned data storage method, a client node for sending a data storage request for target data, and at least two replica storage nodes for storing data.

[0017] The present disclosure provides a data reading system, which comprises a client node for executing the above-mentioned data reading method, a data management node for executing the above-mentioned data reading method, and at least two target storage nodes for storing target data.

[0018] The present disclosure provides a data storage device, which comprises:

[0019] a receiving unit configured to receive a data storage request for target data sent by a client node;

[0020] The processing unit is configured to determine M target storage nodes from the at least two copy storage nodes based on racks where the at least two copy storage nodes are respectively located and first coordinates respectively corresponding to the at least two copy storage nodes, wherein M is a positive integer greater than or equal to 2, and sizes of remaining storage spaces of the M target storage nodes satisfy a size of a storage space required by the target data.

[0021] The sending unit is configured to send information of the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0022] The present disclosure provides a data reading device, which is applied to a client node, and the device comprises:

[0023] The first sending module is configured to send a data reading request for reading target data.

[0024] The first receiving module is configured to receive information of M target storage nodes storing the target data, wherein the information comprises first coordinates respectively corresponding to the M target storage nodes and racks where the M target storage nodes are respectively located, and M is a positive integer greater than or equal to 2.

[0025] The first processing module is configured to determine distances between the M target storage nodes and the client node according to the first coordinates respectively corresponding to the M target storage nodes and the racks where the M target storage nodes are respectively located, and a rack where the client node is located and a second coordinate corresponding to the client node, and determine a target storage node to be accessed by the client node and access the corresponding target storage node according to the distances respectively corresponding to the M target storage nodes, so as to obtain the target data stored in the target storage node.

[0026] The present disclosure provides a data reading device, which is applied to a data management node, and the device comprises:

[0027] The second receiving module is configured to receive a data reading request for reading target data sent by a client node.

[0028] The second processing module is configured to determine information of M target storage nodes storing the target data.

[0029] The second sending module is configured to send information of the M target storage nodes to the client node, so that the client node, after receiving the information of the M target storage nodes, determines distances between the M target storage nodes and the client node according to the first coordinates corresponding to the M target storage nodes respectively, racks where the M target storage nodes are located, a rack where the client node is located, a second coordinate corresponding to the client node, and the second coordinate, determines a target storage node to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and accesses the corresponding target storage node to obtain the target data stored in the target storage node, determines a target storage node to be accessed by the client node according to each distance, and accesses the target storage node to obtain the target data stored in the target storage node; wherein the information includes the first coordinates corresponding to the M target storage nodes respectively, and the M is a positive integer greater than or equal to 2.

[0030] The present disclosure provides an electronic device, which comprises at least a processor and a memory, wherein the processor is configured to implement the steps of the data storage method as described above when executing the computer program stored in the memory, or implement the steps of the data reading method as described above, or implement the steps of the data reading method as described above.

[0031] The present disclosure provides a computer readable storage medium, which stores a computer program, wherein the computer program is configured to implement the steps of the data storage method as described above when executed by a processor, or implement the steps of the data reading method as described above, or implement the steps of the data reading method as described above.

[0032] Since when determining the target storage node for storing the target data, not only the influence of the pre-configured first coordinate corresponding to each copy storage node is considered, but also the influence of the distance between each copy storage node and the client node, and the influence of the distance between each copy storage node in the rack and the client node is considered, it is beneficial to more accurately determine the distance between each copy storage node and the client node, and it is also convenient to subsequently accurately determine the target storage node for storing the target data from at least one copy storage node according to the distance between each copy storage node and the client node, and it is also beneficial to effectively shorten the time-consuming of data storage and read-write when the copy storage node closest to the client node is determined as the target storage node, improve the efficiency of interaction between storage nodes, avoid the failure to accurately determine the target storage node from at least one copy storage node on the rack where the client node is located, and also avoid the failure to accurately determine the target storage node from at least one copy storage node on the other rack different from the rack where the client node is located. BRIEF DESCRIPTION OF DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor.

[0034] Figure 1 A data storage process schematic diagram provided by the embodiments of the present disclosure;

[0035] Figure 2 A scene schematic diagram of each copy storage node in the data center provided by the embodiments of the present disclosure;

[0036] Figure 3 A logical view of each rack and each copy storage node on each rack in the data center provided by the embodiments of the present disclosure;

[0037] Figure 4 A bidirectional linked list rack structure schematic diagram provided by the embodiments of the present disclosure;

[0038] Figure 5 A coordinate system diagram of each rack and each copy storage node on each rack in the data center provided by the embodiments of the present disclosure;

[0039] Figure 6 A coordinate system diagram of each rack and each copy storage node on each rack in the data center provided by the embodiments of the present disclosure;

[0040] Figure 7 A data reading process schematic diagram provided for an embodiment of the present disclosure;

[0041] Figure 8 A data reading process schematic diagram provided for an embodiment of the present disclosure;

[0042] Figure 9 A data reading process schematic diagram provided for an embodiment of the present disclosure;

[0043] Figure 10 A data storage system structure schematic diagram provided for an embodiment of the present disclosure;

[0044] Figure 11 A data reading system structure schematic diagram provided for an embodiment of the present disclosure;

[0045] Figure 12 A data storage device structure schematic diagram provided for an embodiment of the present disclosure;

[0046] Figure 13 A data reading device structure schematic diagram provided for an embodiment of the present disclosure;

[0047] Figure 14 A data reading device structure schematic diagram provided for an embodiment of the present disclosure;

[0048] Figure 15 An electronic device structure schematic diagram provided for an embodiment of the present disclosure;

[0049] Figure 16 An electronic device structure schematic diagram provided for an embodiment of the present disclosure;

[0050] Figure 17 An electronic device structure schematic diagram provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0051] The present disclosure will be further described in details by combining with the drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, but not all the embodiments. Based on the embodiments in the present disclosure, all the other embodiments obtained by those skilled in the art without creative work fall into the scope of protection of the present disclosure.

[0052] It is known to those skilled in the art that the embodiments of the present disclosure can be implemented as a system, a device, an apparatus, a method or a computer program product. Therefore, the present disclosure can be embodied as a whole hardware, a whole software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0053] In this document, it should be understood that the number of any elements in the figures are given by way of example and not limitation, and any naming is merely for the purpose of distinguishing between elements and does not have any limiting meaning.

[0054] For the convenience of understanding, the following explains some concepts involved in the embodiments of the present disclosure:

[0055] Two-dimensional coordinate system: a plane rectangular coordinate system composed of two number axes perpendicular to each other and having a common origin in the same plane. The horizontal axis is usually called the X-axis or the horizontal axis, and the vertical axis is called the Y-axis or the vertical axis.

[0056] Three-dimensional coordinate system: based on the two-dimensional coordinate system, a third dimension coordinate (i.e. Z-axis) is added according to the right-hand rule.

[0057] Master node: a master node for managing storage nodes. The master node manages which storage node to allocate data to.

[0058] Square root calculation (Sqrt): a mathematical formula that takes the square root of a given value.

[0059] Currently, when a target data of a client node needs to be stored in a replica storage node in a data center, if the client node is a node in the data center, at least one replica storage node is randomly selected from each replica storage node located on the rack where the client node is located as a target storage node for storing data. In order to avoid the problem that all target storage nodes on the rack where the client node is located are problematic, causing the client node to be unable to read the stored target data, at least one replica storage node can also be randomly selected from each replica storage node located on the rack other than the rack where the client node is located as a target storage node for storing data. If the client node is not a node in the data center, at least one replica storage node is randomly selected from each replica storage node on any rack of the data center as a target storage node for storing data, and then at least one replica storage node is randomly selected from each replica storage node on the rack other than the rack in the data center as a target storage node for storing data.

[0060] Through the above method of determining the target storage node, since the distance between the target storage node and the client node is not considered, the efficiency of subsequent interaction between the client node and the target storage node cannot be guaranteed. Therefore, how to accurately determine the target storage node to ensure the efficiency of interaction between the client node and the target storage node is a technical problem to be solved.

[0061] To solve the problem that the target storage node cannot be accurately determined to store the target data, the present disclosure provides a data storage and reading method, system, device, equipment and medium. Since when determining the target storage node for storing the target data, not only the influence of the pre-configured first coordinate corresponding to each copy storage node on the distance between each copy storage node and the client node is considered, but also the influence of the rack where each copy storage node is located on the distance between each copy storage node and the client node, it is beneficial to more accurately determine the distance between each copy storage node and the client node, and it is also convenient to subsequently accurately determine the target storage node for storing the target data from at least one copy storage node according to the distance between each copy storage node and the client node. It is also beneficial to effectively shorten the time-consuming of data storage and reading and writing when the copy storage node closest to the client node is determined as the target storage node, improve the efficiency of interaction between storage nodes, avoid the problem that the target storage node cannot be accurately determined from at least one copy storage node on the rack where the client node is located, and also avoid the problem that the target storage node cannot be accurately determined from at least one copy storage node on the other rack different from the rack where the client node is located.

[0062] Secondly, when reading the stored target data, the client node generally accesses the target storage node closer to the client node to effectively shorten the time consumed in the data read / write process and improve the efficiency of interaction between the client node and the target storage node storing the target data. In the related technology, in order to determine the distance between the target storage node and the client node, the distance values corresponding to different position relationships are configured in advance according to the position relationship between the target storage node and the client node. For example, if the position relationship is that the target storage node and the client node are the same node, the distance value corresponding to the position relationship is 0, for example, the target storage node and the client node are / d1 / r1 / n1, and the distance between the target storage node and the client node is distance( / d1 / r1 / n1, / d1 / r1 / n1) = 0; if the position relationship is that the target storage node and the client node are different nodes on the same rack, the distance value corresponding to the position relationship is 2, for example, the target storage node is / d1 / r1 / n1 and the client storage node is / d1 / r1 / n2, and the distance between the target storage node and the client node is distance( / d1 / r1 / n1, / d1 / r1 / n2) = 2; if the position relationship is that the target storage node and the client node are located on different racks in the same data center, the distance value corresponding to the position relationship is 4, for example, the target storage node is / d1 / r1 / n1 and the client storage node is / d1 / r2 / n5, and the distance between the target storage node and the client node is distance( / d1 / r1 / n1, / d1 / r2 / n5) = 4; if the position relationship is that the target storage node and the client node are located on racks in different data centers, the distance value corresponding to the position relationship is 6, for example, the target storage node is / d1 / r1 / n1 and the client storage node is / d2 / r3 / n7, and the distance between the target storage node and the client node is distance( / d1 / r1 / n1, / d2 / r3 / n7) = 6. When the client node receives the information of the target storage node, the target position relationship between each target storage node and the client node is determined according to the information of each target storage node. According to the correspondence between the pre-configured position relationship and the distance value, the target distance value corresponding to each target position relationship is determined. The client directly accesses the target storage node corresponding to the smallest target distance value to obtain the target data stored therein. For this method, the distance between the nodes is only configured in advance according to the possible position relationship between different target storage nodes and the client node, and the distance values corresponding to different position relationships are relatively rough, without considering the difference in distance between different target storage nodes and the client node under the same position relationship, so that the distance between different target storage nodes and the client node on the same rack cannot be distinguished.

[0063] To solve the above problems, in the present disclosure, after the client node receives the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located, the rack where the client node is located and the pre-configured second coordinates corresponding to the client node are determined, and the distances between the M target storage nodes and the client node are determined, so that the distance between each target storage node and the client node can be more accurately determined, and then the target storage node to be accessed by the client node is more accurately determined according to the distance corresponding to each target storage node, the distances between different target storage nodes on the same rack and the client node are distinguished, and the problem that the distance between the target storage node on the same rack and the client node is the same in the related art, which causes the target storage node to be accessed by the client node cannot be accurately determined, is solved.

[0064] Figure 1 A data storage process schematic diagram provided by an embodiment of the present disclosure is provided, and the process includes:

[0065] S101: receiving a data storage request of target data sent by a client node.

[0066] The data storage method provided by the present disclosure can be applied to a data management node, which can be an electronic device, and the electronic device can be a server or a smart device, such as a mobile phone, a computer, a monitoring device, etc. In the specific implementation process, it can be flexibly set according to actual needs, which is not specifically limited here.

[0067] In a possible application scenario, when a client node obtains target data and needs to store the target data to a data center, a data storage request can be generated and sent to a data management node according to the target data and the data center. After the data management node receives the data storage request of the target data, the data storage request can be responded to to determine the target storage node in the data center for storing the target data.

[0068] S102: determining M target storage nodes from the at least two replica storage nodes based on the racks where the at least two replica storage nodes are located and the pre-configured first coordinates corresponding to the at least two replica storage nodes respectively; wherein the M is a positive integer greater than or equal to 2, and the size of the remaining storage space of the M target storage nodes meets the size of the storage space required by the target data.

[0069] In order to conveniently and accurately determine the target storage node for storing the target data, in the present disclosure, the first coordinates corresponding to the plurality of replica storage nodes contained in the data center are pre-configured (for the convenience of description, denoted as first coordinates). When receiving the target data storage request, the first coordinates pre-configured corresponding to the at least two replica storage nodes in the data center can be used for corresponding processing, and the M target storage nodes can be determined from the at least two replica storage nodes. Wherein, M is a positive integer greater than or equal to 2. Since the target storage node is used for storing the target data, the size of the remaining storage space of the M target storage nodes determined should meet the size of the storage space required by the target data.

[0070] In a possible implementation, the first coordinate corresponding to any replica storage node is determined according to the first rack sequence number of the rack where the replica storage node is located in the data center, the second rack sequence number of the rack where the replica storage node is located in the preset coordinate system, and the machine sequence number corresponding to the position of the replica storage node on the rack.

[0071] In a possible implementation, the first coordinate corresponding to any replica storage node can be a three-dimensional coordinate. Through the three-dimensional first coordinates corresponding to each replica storage node, not only can the positions of the replica storage nodes in different racks in the three-dimensional space be more accurately distinguished, but also the positions of the replica storage nodes on the same rack in the three-dimensional space can be more accurately distinguished.

[0072] Since in the related art, the distance between the replica storage node and the client node is determined only according to whether the rack where the replica storage node is located is consistent with the rack where the client node is located, and whether the replica storage node and the client are in the same data center, the distance between the replica storage nodes at different positions on the same rack and the client node is a fixed value. Therefore, the distance determined by the method in the related art cannot accurately determine the target storage node from the replica storage nodes at different positions on the same rack, and further cannot guarantee the efficiency of the subsequent interaction between the client node and the target storage node. The method adopted in the present disclosure can determine the first coordinates corresponding to each replica storage node, and when determining the distance between the replica storage node and the client node according to the first coordinates corresponding to each replica storage node, the distance will change with the rack where the replica storage node is located and the position of the replica storage node on the rack, thereby more accurately determining the distance between the replica storage nodes at different positions and the client node, and further facilitating the determination of the target storage node according to the distance between the replica storage node and the client node.

[0073] It should be noted that the first rack sequence number and the second rack sequence number can be the same or different. In a specific implementation process, if the positions of each rack in the preset coordinate system are determined in the order of the first rack sequence number of each rack from small to large, starting from the origin O of the preset coordinate system, that is, the second rack sequence number of each rack in the preset coordinate system is determined, then the second rack sequence number of each rack in the preset coordinate system will be the same as the corresponding first rack sequence number. If the positions of each rack in the preset coordinate system are not determined in the order of the first rack sequence number of each rack from small to large, starting from the origin O of the preset coordinate system, that is, the second rack sequence number of each rack in the preset coordinate system is determined, then the second rack sequence number of each rack in the preset coordinate system will be different from the corresponding first rack sequence number.

[0074] In a possible implementation, the first dimension coordinate value in the first coordinate corresponding to any copy storage node is determined according to the machine sequence number, the second dimension coordinate value is determined according to the second rack sequence number, and the third dimension coordinate value is determined according to the first rack sequence number.

[0075] Figure 2 A scene schematic diagram of each copy storage node in a data center is provided for the embodiments of the present disclosure. As shown in Figure 2 , d1, d2, r1-r4 in the figure are switches, and n1-n12 at the bottom layer are copy storage nodes that can store data. According to Figure 2 , it can be known that, taking part of the copy storage nodes as an example, the position of n1 in the rack is rackid= / d1 / r1 / n1, the rack position of n1 is / d1 / r1, the position of n2 in the rack is rackid= / d1 / r1 / n2, the rack position of n2 is / d1 / r1, the position of n4 in the rack is rackid= / d1 / r2 / n4, and the rack position of n4 is / d1 / r2.

[0076] According to the position information of each copy storage node in Figure 2 , a logical view of each rack and each copy storage node on each rack in the data center is determined as shown in Figure 3 . The rack of / d1 / r2 includes n4-n6, the rack of / d1 / r1 includes n1-n3, the rack of / d2 / r3 includes n7-n9, and the rack of / d2 / r4 includes n10-n12.

[0077] The data storage node stores a persistent file, which is used to store the positions of all copy storage nodes in the data center in a three-dimensional coordinate system. Referring to the rack structure in Figure 2 , the storage format of the positions of each storage node in the data center is as follows:

[0078] n1: [ / d1 / r1 / l1, (X1, Y1, Z1)]

[0079] n2: [ / d1 / r1 / l2, (X2, Y2, Z2)]

[0080] n3: [ / d1 / r1 / l2, (X3, Y3, Z3)]

[0081] n4: [ / d1 / r2 / l1, (X4, Y4, Z4)]

[0082] n5: [ / d1 / r2 / l2, (X5, Y5, Z5)]

[0083]

[0084] n12 [ / d2 / r4 / l1, (X12, Y12, Z12)].

[0085] Wherein, d represents a switch, r represents a switch, l represents a rack under r, n represents a replica storage node, (X, Y, Z) represents a first coordinate corresponding to the replica storage node, X is an X-axis coordinate in the first coordinate, the value of which is determined according to the machine serial number corresponding to the position of the replica storage node on the rack, Y is a Y-axis coordinate in the first coordinate, the value of which is determined according to the second rack serial number of the rack where the replica storage node is located in the preset coordinate system, and Z is a Z-axis coordinate in the first coordinate, the value of which is determined according to the first rack serial number of the rack where the replica storage node is located in the data center. The Y-axis coordinates in the first coordinates corresponding to each storage node located on the same rack are the same, and the Z-axis coordinates in the first coordinates corresponding to each storage node located on the same rack are also the same. For example, the first coordinate corresponding to the replica storage node n2 is (2, 4, 4), the first coordinate corresponding to the replica storage node n1 is (3, 4, 4), the replica storage node n2 and the replica storage node n1 are located on the same rack, the Y-axis coordinate 4 in the first coordinate corresponding to the replica storage node n2 is the same as the Y-axis coordinate 4 in the first coordinate corresponding to the replica storage node n1, and the Z-axis coordinate 4 in the first coordinate corresponding to the replica storage node n2 is the same as the Z-axis coordinate 4 in the first coordinate corresponding to the replica storage node n1.

[0086] When the data management node starts the service, it will parse the data contained in the file above. In the memory, a double-linked list rack structure diagram as shown in Figure 4 will be formed. According to the double-linked list rack structure diagram, the data management node can clearly determine the adjacent relationship between each rack.

[0087] Based on Figure 4The shown bidirectional linked list rack structure schematic diagram determines the coordinate system diagram of each rack and each replica storage node on each rack in the data center as shown in FIG. 5. As shown in FIG. 5, the X-axis coordinate of the replica storage node is determined according to the machine number, the Y-axis coordinate value is determined according to the second rack number, and the Z-axis coordinate value is determined according to the first rack number. The second rack number is the same as the first rack number. Figure 5 The first coordinate of n12 is (1, 1, 1), and the first coordinate of n5 is (2, 3, 3). Figure 5

[0088] In a possible implementation, the distances between the replica storage nodes on different racks and the client nodes can be different. Therefore, in the present disclosure, according to the racks where the at least two replica storage nodes are located respectively and the preconfigured first coordinates corresponding to the at least two replica storage nodes respectively, corresponding processing is performed to determine M target storage nodes from the at least two replica storage nodes.

[0089] Since the client node can be located in the same data center as the at least two replica storage nodes, and the at least two replica storage nodes are deployed on different racks, the client node can also not be located in the same data center as the at least two replica storage nodes, and the at least two replica storage nodes are deployed on different racks. The following describes the method of determining M target storage nodes from the at least two replica storage nodes according to the racks where the at least two replica storage nodes are located respectively and the preconfigured first coordinates corresponding to the at least two replica storage nodes respectively in the following two cases:

[0090] Case 1: If the client node and the at least two replica storage nodes are located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the method of determining M target storage nodes from the at least two replica storage nodes according to the racks where the at least two replica storage nodes are located respectively and the preconfigured first coordinates corresponding to the at least two replica storage nodes respectively includes:

[0091] Obtaining the order of the at least two racks;

[0092] According to the order of the at least two racks, it is determined whether the number of determined target storage nodes reaches M for the at least two racks; if not, a target storage node is determined according to the first coordinates corresponding to the at least one replica storage node on the rack; if so, the determination of the target storage node is stopped.

[0093] In a possible implementation, the order of the at least two racks can be pre-set or determined according to the rack where the client node is located.​

[0094] When the order of the at least two racks is determined according to the rack in which the client node is located, the rack distances between the at least two racks and the rack in which the client node is located are obtained. Then, the order of the at least two racks is determined according to the rack distances corresponding to the at least two racks respectively; the smaller the rack distance corresponding to a rack is, the earlier the order of the rack is.

[0095] Since the replica storage nodes on the rack closer to the rack in which the client node is located are closer to the client node, and the replica storage nodes on the rack farther from the rack in which the client node is located are farther from the client node, the order of each rack is determined according to the rack distance between each rack and the rack in which the client node is located, and then the target storage node is determined by the above method according to the order of each rack, so that the target storage node is determined from the replica storage nodes on the rack closer to the rack in which the client node is located, thereby ensuring that the distance between the determined target storage node and the client node is as close as possible, effectively shortening the time consumption of data storage and read-write, and improving the efficiency of interaction between storage nodes.

[0096] Figure 6 A coordinate system diagram of each rack in a data center and each replica storage node on each rack is provided for the embodiments of the present disclosure. As shown in Figure 6 , n8 is a client node, and starting from the rack in which n8 is located, the target storage node is determined in the replica storage nodes on the rack in which n8 is located, and then the target storage node is continuously determined in the replica storage nodes on the second target rack adjacent to the rack in which n8 is located. As shown in Figure 6 , the rack in which n8 is located is / d2 / r3, and the second target racks adjacent to the rack in which n8 is located are / d1 / r2 and / d2 / r4, that is Figure 6 , the two racks pointed to by the arrows are the second target racks, and the target storage node is continuously determined in the replica storage nodes on the two second target racks.

[0097] When the order of the at least two racks is determined according to the rack in which the client node is located, the rack distances between the at least two racks and the rack in which the client node is located are obtained. Then, the order of the at least two racks is determined according to the rack distances corresponding to the at least two racks respectively; the smaller the rack distance corresponding to a rack is, the earlier the order of the rack is.

[0098] In a possible implementation, when the target storage node is determined according to the first coordinates corresponding to the at least one replica storage node on the rack respectively, the target storage node can be determined according to the remaining storage spaces corresponding to the at least one replica storage node on the rack respectively and the first coordinates.

[0099] Since the target storage node is used to store the target data, in the present disclosure, the remaining storage spaces corresponding to the at least one replica storage node respectively can be compared with the storage space required by the target data. According to the comparison result, at least one candidate storage node is determined from the at least one replica storage node. It can be understood that at least one candidate storage node is determined from the at least one replica storage node according to the remaining storage spaces corresponding to the at least one replica storage node respectively and the storage space required by the target data. Then the target storage node is determined from the at least one candidate storage node according to the first coordinates corresponding to the at least one candidate storage node respectively.

[0100] As a possible implementation, when at least one candidate storage node is determined from the at least one replica storage node according to the remaining storage spaces corresponding to the at least one replica storage node respectively and the storage space required by the target data, for the at least one replica storage node on the rack, it is determined whether the remaining storage space of the replica storage node is greater than the storage space required by the target data. If the remaining storage space of the replica storage node is greater than the storage space required by the target data, it indicates that the replica storage node can store the target data, and the replica storage node is determined as a candidate storage node. If the remaining storage space of the replica storage node is not greater than the storage space required by the target data, it indicates that the storage space of the replica storage node cannot continue to store the target data, and the replica storage node is determined not to be a candidate storage node.

[0101] In a possible implementation, the first ranked rack is the closest to the rack where the client node is located. If there is at least one replica storage node on the rack where the client node is located, the first ranked rack is the rack where the client node is located, i.e., the first ranked rack is the same as the rack where the client node is located. When the rack is the same as the rack where the client node is located, the number of candidate storage nodes determined from the rack can be greater than or less than M target storage nodes. If the number of candidate storage nodes determined from the rack is greater than M target storage nodes, to avoid a problem that all target storage nodes on the rack where the client node is located are problematic and the client node cannot read stored target data, a part of the number of target storage nodes can be determined from at least one candidate storage node on the rack. The part of the number is less than M. For another part of the number of target storage nodes, the target storage nodes can be determined from replica storage nodes on racks other than the rack in the data center. Based on this, in the present disclosure, a number threshold N is preset. N is an integer greater than or equal to 1 and less than M. When it is determined that the rack is the same as the rack where the client node is located, the number of candidate storage nodes (for convenience, denoted as a first number), the first coordinates corresponding to the at least one candidate storage node, and the preset number threshold N are determined to determine target storage nodes from the at least one candidate storage node.

[0102] In a possible implementation, if the first number of candidate storage nodes on the rack is greater than the preset number threshold N, the first coordinates corresponding to the at least one candidate storage node and the coordinates of the client node in the data center (for convenience, denoted as second coordinates) are determined to determine distances (for convenience, denoted as first distances) between the at least one candidate storage node and the client node. Then, N target storage nodes are determined from the at least one candidate storage node according to the first distances between the at least one candidate storage node and the client node. It can be understood that a part of the number of target storage nodes is determined from the at least one candidate storage node according to the distances between the at least one candidate storage node and the client node.

[0103] In a possible implementation, when the first distance between a candidate storage node and the client node is determined based on the first coordinates corresponding to the candidate storage node and the second coordinates of the client node in the data center, the first coordinates corresponding to the candidate storage node and the second coordinates can be used to determine a basic distance between the first coordinates and the second coordinates. The basic distance can be an Euclidean distance, a Manhattan distance, a Chebyshev distance, or the like. The determined basic distance is determined as the first distance between the candidate storage node and the client node.

[0104] For example, based on the first coordinate (x1, y1, z1) corresponding to the candidate storage node and the second coordinate (x2, y2, z2) of the client node in the data center, the base distance d1 between the first coordinate (x1, y1, z1) corresponding to the candidate storage node and the second coordinate (x2, y2, z2) can be determined by the following formula:

[0105] D1 = sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 ).

[0106] In a possible implementation, when the N target storage nodes are determined from the at least one candidate storage node according to the first distance respectively corresponding to the at least one candidate storage node, the N candidate storage nodes in the front of the order can be determined as the target storage nodes in the order of each first distance from small to large.

[0107] As another possible implementation, if the first number of the candidate storage nodes on the rack is not greater than the preset number threshold N, the at least one candidate storage node is directly determined as the target storage node.

[0108] Through the above method, the target storage node for storing the target data can be determined from the rack different from the rack where the client node is located, so that the problem that the target storage node on the rack where the client node is located is all out of order, which causes the client node to be unable to read the stored target data, is avoided, and it is ensured that the target data can be read as much as possible subsequently.

[0109] When the target storage node is determined from the at least one replica storage node on the rack in the front of the order based on the above embodiment, at least one replica storage node on the next rack is obtained in the order of the at least one rack, and whether the number of the determined target storage nodes reaches M is determined. If the number of the determined target storage nodes reaches M, the determination of the target storage node from the at least one replica storage node on the rack after the rack in the order is stopped. If the number of the determined target storage nodes does not reach M, the target storage node can be determined according to the first coordinate respectively corresponding to the at least one replica storage node on the rack.

[0110] In a possible implementation, when the target storage node is determined according to the first coordinate respectively corresponding to the at least one replica storage node on the rack, the target storage node can be determined according to the first coordinate and the remaining storage space respectively corresponding to the at least one replica storage node on the rack.

[0111] Since the target storage node is used to store the target data, therefore, in the present disclosure, the remaining storage space corresponding to each of the at least one replica storage node can be compared with the storage space required by the target data. According to the comparison result, at least one candidate storage node is determined from the at least one replica storage node. It can be understood that, according to the remaining storage space corresponding to each of the at least one replica storage node and the storage space required by the target data, at least one candidate storage node is determined from the at least one replica storage node. Then, according to the first coordinates corresponding to each of the at least one candidate storage node, the target storage node is determined from the at least one candidate storage node.

[0112] As a possible implementation, when determining at least one candidate storage node from the at least one replica storage node according to the remaining storage space corresponding to each of the at least one replica storage node and the storage space required by the target data, for each replica storage node on the rack, it is determined whether the remaining storage space of the replica storage node is greater than the storage space required by the target data. If the remaining storage space of the replica storage node is greater than the storage space required by the target data, it means that the replica storage node can store the target data, and then the replica storage node is determined as a candidate storage node. If the remaining storage space of the replica storage node is not greater than the storage space required by the target data, it means that the storage space of the replica storage node cannot continue to store the target data, and then the replica storage node is determined not to be a candidate storage node.

[0113] In a possible implementation, since the rack is not the first ranked rack, i.e., the rack is not the rack closest to the rack where the client node is located, the rack and the rack where the client node is located are not the same rack where the client node is located. When the rack and the rack where the client node is located are not the same, if the replica storage node on the rack interacts with the client node, the access path between the replica storage node on the rack and the client node will pass through at least one layer of switches. The number of layers of switches passed by the access path will affect the distance between the replica storage node on the rack and the client node. Based on this, in the present disclosure, when it is determined that the rack and the rack where the client node is located are not the same, a reference storage node can be determined from the client node or the target storage node that has been determined. Then, according to the coordinates of the reference storage node in the data center, the first coordinates corresponding to each of the at least one candidate storage node, and the access paths between the reference storage node and each of the at least one candidate storage node, the distances (for convenience, denoted as second distances) between each of the at least one candidate storage node and the reference storage node are determined. Then, according to the second distances corresponding to each of the at least one candidate storage node, the target storage node is determined from the at least one candidate storage node.

[0114] In determining the reference storage node, if it is desired that the target storage node and the client node be closer, the client node can be determined as the reference storage node; if it is desired that the target storage nodes be closer, any determined target storage node can be determined as the reference storage node.

[0115] In one possible implementation, when determining the second distance between the candidate storage node and the reference storage node for the at least one candidate storage node, the following steps are performed:

[0116] A base distance can be determined between the first coordinates of the candidate storage node and the coordinates of the reference storage node in the data center. This base distance can be Euclidean distance, Manhattan distance, Chebyshev distance, etc. Then, based on this base distance and the number of switch layers traversed in the access path between the reference storage node and the candidate storage node, a second distance between the candidate storage node and the reference storage node can be determined.

[0117] For example, assuming the first coordinates of the candidate storage node are (x1, y1, z1) and the coordinates of the reference storage node in the data center are (x2, y2, z2), the second distance d2 between the candidate storage node and the reference storage node can be determined by the following formula:

[0118] d2 = sqrt((x1-x2)) 2 +(y1-y2) 2 +(z1-z2) 2 )+a*m

[0119] Where 'a' is the preset reference distance value corresponding to each layer of switches, and 'm' is the number of layers of switches traversed in the access path between the reference storage node and the candidate storage node.

[0120] by Figure 6 Taking the coordinate system shown as an example, the preset reference distance value a corresponding to each layer of switches is 1, the reference storage node is client node n8, the first coordinate of candidate storage node n10 is determined to be (3, 3, 3), the second coordinate of client node n8 in the data center is (2, 2, 2), the number of layers m of switches traversed in the access path between candidate storage node n10 and client node n8 is 1, and according to the above formula, the second distance between candidate storage node n10 and client node n8 is determined to be d2 = sqrt((3-2)). 2 +(3-2) 2 +(3-2) 2)+1*1=2.732.

[0121] Since the number of layers of switches passed in the access path between the reference storage node and the candidate storage node affects the distance of interaction between the reference storage node and the candidate storage node, generally, the more the number of layers of switches passed in the access path between the reference storage node and the candidate storage node, the farther the distance of interaction between the reference storage node and the candidate storage node, and the less the number of layers of switches passed in the access path between the reference storage node and the candidate storage node, the shorter the distance of interaction between the reference storage node and the candidate storage node. Based on this, by the above method, the distance between each replica storage node on the rack different from the rack where the client node is located and the reference storage node can consider the influence of the number of layers of switches passed in the access path between the reference storage node and the candidate storage node on the distance of interaction between the reference storage node and the candidate storage node, thereby facilitating accurate determination of the distance of interaction between the reference storage node and the candidate storage node, and further facilitating accurate determination of the target storage node from each candidate storage node according to the distance corresponding to each candidate storage node.

[0122] In a possible implementation, it is determined whether the total number of candidate storage nodes on the rack is greater than the node number of the target storage node that has not been determined. The node number is determined according to the difference between M and the number of target storage nodes that have been determined. If it is determined that the total number of candidate storage nodes on the rack is greater than the node number, the node number of candidate storage nodes in front of the order are determined as target storage nodes in the order of the second distance from small to large, and the process of determining the target storage node from at least one replica storage node on the rack subsequent to the rack is stopped. If it is determined that the total number of candidate storage nodes on the rack is not greater than the node number, each candidate storage node on the rack is directly determined as a target storage node, and the process of determining the target storage node from at least one replica storage node on the rack subsequent to the rack is continued.

[0123] It should be noted that the process of determining the target storage node from at least one replica storage node on the rack subsequent to the rack can refer to the process of determining the target storage node from at least one replica storage node on the rack subsequent to the second rack, and the repeated parts will not be described herein.

[0124] In case two, if the client node and the at least two replica storage nodes are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the M target storage nodes are determined from the at least two replica storage nodes based on the racks on which the at least two replica storage nodes are located and the preconfigured first coordinates corresponding to the at least two replica storage nodes, comprising:

[0125] At least two candidate storage nodes are determined according to the remaining storage spaces of the at least two replica storage nodes and the storage space required by the target data.

[0126] The second number of candidate storage nodes deployed on each rack is counted for the racks on which the at least two candidate storage nodes are located.

[0127] The target storage nodes belonging to the first set are determined from the at least two candidate storage nodes according to one or more of the second numbers and a preset number threshold Z, wherein the Z is a positive integer less than the M and greater than or equal to 1.

[0128] The third distance between each of the at least one other candidate storage node and the determined target storage node is determined according to the first coordinate corresponding to the determined target storage node, the first coordinates corresponding to the at least one other candidate storage node, and the access paths between the determined target storage node and the at least one other candidate storage node.

[0129] The target storage nodes belonging to the second set are determined from the at least one other storage node based on the third distances corresponding to the at least one other storage node, wherein the total number of target storage nodes included in the first set and the second set is the M.

[0130] Since the target storage node is used to store the target data, the remaining storage space of the target storage node should meet the storage space required by the target data. Therefore, in the present disclosure, if the client node and the at least two replica storage nodes are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the remaining storage spaces of the at least two replica storage nodes can be obtained. Then, for the at least two replica storage nodes, the remaining storage space of the replica storage node is compared with the storage space required by the target data. According to the comparison result, it is determined whether the replica storage node is a candidate storage node.

[0131] In a possible implementation, it is determined whether the size of the remaining storage space of the replica storage node is greater than the size of the required storage space of the target data. If it is determined that the size of the remaining storage space of the replica storage node is greater than the size of the required storage space of the target data, it indicates that the remaining storage space of the replica storage node meets the required storage space of the target data, and the replica storage node can be determined as a candidate storage node. If it is determined that the size of the remaining storage space of the replica storage node is not greater than the size of the required storage space of the target data, it indicates that the remaining storage space of the replica storage node does not meet the required storage space of the target data, and the replica storage node is not determined as a candidate storage node.

[0132] After the above-mentioned embodiment is determined as a candidate storage node, the number (for convenience, denoted as a second number) of candidate storage nodes deployed on each rack is counted. According to the obtained one or more second numbers and the preset number threshold Z, the target storage node belonging to the first set is determined.

[0133] In order to avoid the problem that all target storage nodes on the rack where the client node is located are problematic, causing the client node to be unable to read the stored target data, Z is a positive integer less than M and greater than or equal to 1.

[0134] In a possible implementation, according to the one or more second numbers and the preset number threshold Z, the target storage node belonging to the first set is determined from at least two candidate storage nodes, including the following four cases.

[0135] Case 1, if there is only one second number, and the second number is less than the number threshold Z, the rack corresponding to the second number is determined; and at least one candidate storage node on the rack is determined as the target storage node belonging to the first set.

[0136] Case 2, if there is only one second number, and the second number is not less than the number threshold Z, the rack corresponding to the second number is determined; and Z candidate storage nodes on the rack are determined as the target storage node belonging to the first set.

[0137] Case 3, if there are multiple second numbers, and the maximum value in the multiple second numbers is less than the number threshold Z, the rack corresponding to the maximum value is determined; and at least one candidate storage node on the rack is determined as the target storage node belonging to the first set.

[0138] Case 4, if there are multiple second numbers, and the maximum value in the multiple second numbers is not less than the number threshold Z, the rack corresponding to the maximum value is determined; and Z candidate storage nodes on the rack are determined as the target storage node belonging to the first set.

[0139] After the target storage nodes in the first set are determined based on the above embodiments, from the at least two candidate storage nodes, the candidate storage nodes that are not determined as the target storage nodes are determined as other candidate storage nodes. Then, according to the first coordinates corresponding to any determined target storage node, the first coordinates corresponding to the at least one other candidate storage node respectively, and the access paths between the target storage node and the at least one other candidate storage node respectively, distances (for the convenience of description, denoted as third distances) between the at least one other candidate storage node and the determined target storage node respectively are determined. Then, based on the third distances corresponding to the at least one other storage node respectively, target storage nodes belonging to the second set are determined from the at least one other storage node.

[0140] For the at least one other storage node, if the other storage node and the determined target storage node are located on the same rack, the method for determining the third distance between the other candidate storage node and the determined target storage node can refer to the method for determining the first distance in the above embodiments, and the repeated parts will not be described herein. If the other storage node and the determined target storage node are not located on the same rack, the method for determining the third distance between the other candidate storage node and the determined target storage node can refer to the method for determining the second distance in the above embodiments, and the repeated parts will not be described herein.

[0141] Through the above method, M target storage nodes can be determined from multiple racks as much as possible, so that the target storage nodes on the rack where the client node is located do not all have problems, and the client node cannot read the stored target data, and subsequent reading of the target data can be ensured as much as possible. In addition, when the target storage nodes belonging to the second set are determined from the at least one other storage node based on the third distances corresponding to the at least one other storage node respectively, if the other storage node corresponding to the smaller third distance is determined as the target storage node belonging to the second set, the distance between the determined M target storage nodes for interaction can be as short as possible, and the efficiency of interaction between the M target storage nodes is improved.

[0142] S103: The information of the M target storage nodes is sent to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0143] After the M target storage nodes are obtained based on the above embodiments, the data management node obtains the information of the M target storage nodes, and then sends the information of the M target storage nodes to the client node.

[0144] After receiving information about M target storage nodes from the data management node, the client node can send the target data to the M target storage nodes for storage based on the information of the M target storage nodes.

[0145] Once any target storage node has finished storing the target data, it will generate a notification message indicating that the target data storage is complete, based on the storage path of the target data within that target storage node, and send it to the data management node. Upon receiving the notification message, the data management node will parse it, obtain the storage path carried in the notification message, and save it.

[0146] Because the determination of the target storage node for storing the target data takes into account not only the impact of the pre-configured first coordinates corresponding to each replica storage node on the distance between each replica storage node and the client node, but also the impact of the rack where each replica storage node is located on the distance between each replica storage node and the client node, it is beneficial to more accurately determine the distance between each replica storage node and the client node. It also facilitates the subsequent accurate determination of the target storage node for storing the target data from at least one replica storage node based on the distance between each replica storage node and the client node. Furthermore, it helps to effectively shorten the data storage and read / write time and improve the efficiency of interaction between storage nodes when using the replica storage node closest to the client node as the target storage node. It also avoids the inability to accurately determine the target storage node from at least one replica storage node on the rack where the client node is located, and also avoids the inability to accurately determine the target storage node from at least one replica storage node on a different rack than the rack where the client node is located.

[0147] This disclosure also provides a data reading method. Figure 7 This is a schematic diagram of a data reading process provided in an embodiment of the present disclosure. The process includes:

[0148] S701: Send a data read request for the target data.

[0149] S702: Receive information about M target storage nodes storing the target data; wherein, the information includes the first coordinates and racks corresponding to the M target storage nodes respectively, and M is a positive integer greater than or equal to 2.

[0150] S703: Determine the distances between the M target storage nodes and the client node based on the first coordinates and racks corresponding to the M target storage nodes, the rack where the client node is located, and the pre-configured second coordinates corresponding to the client node.

[0151] S704: determining the target storage nodes to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and accessing the corresponding target storage nodes to obtain the target data stored therein.

[0152] The data reading method provided by the present disclosure can be applied to a client node, which can be an electronic device, which can be a server or a smart device, such as a mobile phone, a computer, a monitoring device, etc. In the implementation process, it can be flexibly set according to actual needs, and here is not specifically limited.

[0153] In a possible application scenario, when a client node needs to read the target data stored in the data center, a data reading request of the target data can be generated and sent to the data management node. After receiving the data reading request of the target data, the data management node can respond to the data reading request to determine the information of M target storage nodes for storing the target data in the data center and send the information to the client node.

[0154] The information includes the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located. The M is an integer greater than or equal to 2.

[0155] It should be noted that the process of determining the target storage nodes for storing the target data has been described in the above embodiments, and the repeated parts will not be described here.

[0156] In the related art, in order to determine the distance between the target storage node and the client node, the distance values corresponding to different location relationships need to be configured in advance according to the location relationship between the target storage node and the client node. For example, if the location relationship is that the target storage node and the client node are the same node, the distance value corresponding to the location relationship is 0; if the location relationship is that the target storage node and the client node are different nodes on the same rack, the distance value corresponding to the location relationship is 2; if the location relationship is that the target storage node and the client node are located on different racks in the same data center, the distance value corresponding to the location relationship is 4; and if the location relationship is that the target storage node and the client node are located on racks in different data centers, the distance value corresponding to the location relationship is 6. When the client node receives the information of the target storage node, the target location relationship between each target storage node and the client node is determined according to the information of each target storage node. According to the corresponding relationship between the pre-configured location relationship and the distance value, the target distance value corresponding to each target location relationship is determined. The client directly accesses the target storage node corresponding to the smallest target distance value to obtain the target data stored therein. For this method, since the distance between the nodes is only configured in advance according to the possible location relationship between different target storage nodes and the client node, the distance values corresponding to different location relationships are relatively rough, and the difference between the distances between different target storage nodes and the client node under the same location relationship is not considered, so that the distance between different target storage nodes and the client node on the same rack cannot be distinguished.

[0157] In order to solve the above problems, in the present disclosure, after the client node receives the first coordinates corresponding to M target storage nodes and the racks where the target storage nodes are located, the rack where the client node is located and the pre-configured second coordinates corresponding to the client node are determined, and the distances between the M target storage nodes and the client node are determined, so that the distance between each target storage node and the client node can be more accurately determined, and then the target storage node to be accessed by the client node is more accurately determined according to the distance corresponding to each target storage node, and the distance between different target storage nodes and the client node on the same rack is distinguished.

[0158] For each target storage node, when determining the distance between the target storage node and the client node, the following cases are included:

[0159] Case A, the rack where the client node is located is the same as the rack where the target storage node is located. Since the rack where the client node is located is the same as the rack where the target storage node is located, the access path between the client node and the target storage node does not need to pass through a switch. Therefore, if it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate where the client node is located is determined; and the distance between the target storage node and the client node is determined according to the basic distance.

[0160] In a possible implementation, when the distance between a target storage node and a client node is determined based on the first coordinate corresponding to the target storage node and the second coordinate where the client node is located in a data center, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate where the client node is located in the data center can be determined based on the first coordinate corresponding to the target storage node and the second coordinate where the client node is located in the data center. The basic distance can be an Euclidean distance, a Manhattan distance, a Chebyshev distance, etc. The determined basic distance can be determined as the distance between the target storage node and the client node.

[0161] For example, based on the first coordinate corresponding to the target storage node being (x1, y1, z1) and the second coordinate where the client node is located in the data center being (x2, y2, z2), the basic distance d between the first coordinate (x1, y1, z1) corresponding to the target storage node and the second coordinate (x2, y2, z2) can be determined by the following formula:

[0162] d = sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 ).

[0163] Case B, the rack where the client node is located is the same as the rack where the target storage node is located. Since the rack where the client node is located is the same as the rack where the target storage node is located, the access path between the client node and the target storage node does not need to pass through a switch. Therefore, in the present disclosure, if it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate where the client node is located is determined; according to the number of layers of switches passed through in the access path between the target storage node and the client node and the basic distance, the distance between the target storage node and the client node is determined.

[0164] In a possible implementation, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate corresponding to the client node can be determined based on the first coordinate corresponding to the target storage node and the second coordinate corresponding to the client node. The basic distance can be an Euclidean distance, a Manhattan distance, a Chebyshev distance, or the like. Then, a second distance between the target storage node and the client node can be determined according to the basic distance and a number of layers of switches through which an access path between the client node and the target storage node passes.

[0165] For example, assuming that the first coordinate corresponding to the target storage node is (x1, y1, z1) and the second coordinate corresponding to the client node is (x2, y2, z2), when determining the distance d between the target storage node and the client node, the distance d can be determined according to the following formula:

[0166] d = sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 )+a*m

[0167] wherein a is a preset reference distance value corresponding to each layer of switches, and m is a number of layers of switches through which an access path between the reference storage node and the candidate storage node passes.

[0168] In case C, the rack where the client node is located and the rack where the target storage node is located are not located in the same data center, the distance between the client node and the target storage node should be greater than the distance between any two replica storage nodes in the data center. Therefore, in this disclosure, if it is determined that the rack where the client node is located and the rack where the target storage node are located in different data centers, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate is determined; and a distance between the target storage node and the client node is determined according to the basic distance and a preset value; the distance is greater than the distance between any two replica storage nodes in the data center.

[0169] In a possible implementation, the rack where the client node is located and the rack where the target storage node are not located in the same data center, the second coordinate corresponding to the client node can be determined as a preconfigured coordinate. The preconfigured coordinate is different from the first coordinate corresponding to any replica storage node in the data center. For example, the preconfigured coordinate can be (0, 0, 0).

[0170] In a possible implementation, when determining the distance between the target storage node and the client node based on the first coordinate corresponding to the target storage node and the second coordinate of the client node in the data center, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate can be determined based on the first coordinate corresponding to the target storage node and the second coordinate of the client node in the data center. The basic distance can be an Euclidean distance, a Manhattan distance, a Chebyshev distance, or the like. A sum of the determined basic distance and a preset value is determined as the distance between the target storage node and the client node.

[0171] For example, when the first coordinate corresponding to the target storage node is (x1, y1, z1) and the second coordinate of the client node in the data center is (x2, y2, z2), the distance d between the target storage node and the client node can be determined by the following formula:

[0172] d=sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 )+Q

[0173] wherein Q is a preset value.

[0174] Taking the coordinate system shown in FIG. 1 as an example, assuming that the client node is not in the data center, the second coordinate of the client node in the data center is (0, 0, 0), the preset value Q is 3, and the first coordinate corresponding to the target storage node n8 is (2, 2, 2). According to the above formula, the distance d between the target storage node n8 and the client node is determined as follows: 2 d=sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 )+Q=sqrt((2-0) 2 +(2-0) 2 +(2-0) 2 )+3=3.464+3=6.464.

[0175] For another example, assuming that Figure 6 the client node n8 (2, 2, 2) in FIG. 1 needs to select one target storage node from the target storage nodes n10 (3, 1, 1) and n2 (2, 4, 4) to access, and the preset reference distance value a corresponding to each layer of switch is 1. According to the distance determination method provided in the above embodiment and in combination with Figure 2 , it is determined that the n8 and the n10 cross one layer of switch, that is, the number m of layers of switches through in the access path between the n8 and the n10 is 1, and the distance d between the n8 and the n10 is d=sqrt((x1-x2)2 +(y1-y2) 2 +(z1-z2) 2 )+a*m=sqrt((3-2) 2 +(1-2) 2 +(1-2) 2 )+1*1=2.237, which determines that there are two layers of switches between n8 and n2. That is, the number of layers m of switches in the access path between n8 and n2 is 2. Therefore, the distance between n8 and n2 is d=sqrt((x1-x2) 2 +(y1-y2) 2 +(z1-z2) 2 )+a*m=sqrt((2-2) 2 +(4-2) 2 +(4-2) 2 ) + 1 * 2 = 4.828. Since the distance between n8 and n10 is less than the distance between n8 and n2, n8 can interact with n10 first.

[0176] Existing methods determine the distance between a target storage node and a client node solely based on whether the target storage node resides in the same rack as the client node and whether they are in the same data center. This results in fixed distances between target storage nodes and client nodes at different locations within the same rack. Consequently, this method cannot accurately determine the target storage node the client node needs to interact with from among target storage nodes at different locations on the same rack, thus compromising the efficiency of subsequent interactions between the client and target storage nodes. This disclosure, however, employs the three methods described in cases A to C above. When determining the distance between a target storage node and a client node, this distance changes according to the rack where the target storage node resides and its position within the rack. This allows for a more accurate determination of the distance between target storage nodes at different locations and the client node, thereby facilitating the accurate identification of the target storage node the client node needs to interact with based on the distance between the target storage node and the client node.

[0177] Once the distances to the M target storage nodes are determined based on the above embodiments, the target storage node to be accessed by the client node can be determined and accessed according to the distances to the M target storage nodes in order to obtain the target data stored therein.

[0178] Generally, the client node accesses the target storage node close to the client node to effectively shorten the time consumed in the data read-write process and improve the efficiency of interaction between the client node and the target storage node storing the target data. Therefore, in the present disclosure, after determining the distances corresponding to the M target storage nodes based on the above-mentioned embodiments, the minimum distance can be determined according to the distances corresponding to the M target storage nodes. The target storage node corresponding to the minimum distance is determined as the target storage node to be accessed by the client node, and the corresponding target storage node is accessed to obtain the target data stored therein.

[0179] In a possible implementation, after determining the target storage node to be accessed by the client node based on the above-mentioned embodiments, the target storage node to be accessed can have a failure to read the target data. In order to ensure that the client node can obtain the target data in time, if it is determined that the target storage node to be accessed has a failure to read the target data, M-1 target storage nodes other than the target storage node are obtained; the target storage node to be accessed is re-determined and accessed according to the distances corresponding to the M-1 target storage nodes.

[0180] The present disclosure also provides a data reading method, Figure 8 A data reading process provided by an embodiment of the present disclosure is shown in the figure, and the process includes:

[0181] S801: receiving a data reading request for target data sent by a client node.

[0182] S802: determining information of M target storage nodes storing the target data and sending the information to the client node, so that after the client node receives the information of the M target storage nodes, the distances between the M target storage nodes and the client node are determined according to the first coordinates corresponding to the M target storage nodes, the racks where the M target storage nodes are located, the rack where the client node is located, and the second coordinates corresponding to the client node, which are pre-configured, and the target storage node to be accessed by the client node is determined according to the distances corresponding to the M target storage nodes and the corresponding target storage node is accessed to obtain the target data stored therein; wherein the information includes the first coordinates corresponding to the M target storage nodes, and the M is a positive integer greater than or equal to 2.

[0183] The data reading method provided by the present disclosure can be applied to a data management node, which can be an electronic device. The electronic device can be a server or a smart device, such as a mobile phone, a computer, a monitoring device, etc. In the specific implementation process, it can be flexibly set according to actual needs, which is not limited here.

[0184] It should be noted that the principle of solving the problem of the data reading method provided by the embodiments of the present disclosure has been described in the above embodiments, and the repeated parts will not be described here.

[0185] The data reading method provided by the present disclosure will be described below through specific embodiments, Figure 9 A scene schematic diagram of a data reading process provided by the embodiments of the present disclosure is shown in the figure, and the process includes:

[0186] Firstly, when the data management node (such as the master shown in the figure) determines the M target storage nodes for storing the target data in the client node (such as the client shown in the figure) based on the data storage method provided by the above embodiments, the information of the determined M target storage nodes can be sent to the client node. After the client node receives the information of the M target storage nodes, the target data can be sent to the M target storage nodes for storage. As shown in the figure, M is 3, and the three target storage nodes are node1, node2, and node3. Figure 9 Figure 9 Figure 9

[0187] When any target storage node finishes storing the target data, it will send a notification message to the data management node, that is, report the storage path of the target data in the target storage node to the data management node. After the data management node receives the notification message, it will save the storage path carried in the notification message.

[0188] Subsequently, the client node can send a data reading request of the target data to the data management node to inquire the access address of the target storage node for storing the target data from the data management node, that is, to inquire the information of the target storage node from the data management node.

[0189] The data management node receives the data reading request of the target data sent by the client node, determines the information of the M target storage nodes for storing the target data, and sends it to the client node.

[0190] Among them, the information includes the first coordinates corresponding to the M target storage nodes respectively and the racks where they are located, and M is a positive integer greater than or equal to 2.

[0191] Then, the client node receives the information of the M target storage nodes for storing the target data, and determines the distances between the M target storage nodes and the client node respectively according to the first coordinates corresponding to the M target storage nodes respectively and the racks where they are located, the rack where the client node is located, and the second coordinates corresponding to the client node pre-configured.

[0192] ​​​The distance between the target storage node and the client node is determined according to the first coordinate corresponding to the target storage node, the rack where the target storage node is located, the rack where the client node is located, and the second coordinate corresponding to the client node.

[0193] If it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, the base distance between the first coordinate corresponding to the target storage node and the second coordinate is determined, and the distance between the target storage node and the client node is determined according to the base distance.

[0194] If it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, the base distance between the first coordinate corresponding to the target storage node and the second coordinate is determined, and the distance between the target storage node and the client node is determined according to the base distance.

[0195] If it is determined that the rack where the client node is located is different from the rack where the target storage node is located, the base distance between the first coordinate corresponding to the target storage node and the second coordinate is determined, and the distance between the target storage node and the client node is determined according to the base distance and a preset value. The distance is greater than the distance between any two replica storage nodes in the data center.

[0196] Secondly, the target storage node to be accessed by the client node is determined according to the distances corresponding to the M target storage nodes respectively, and the corresponding target storage node is accessed to obtain the target data stored therein. The present disclosure provides a data storage system, Figure 10 The present disclosure provides a structural schematic diagram of a data storage system, which includes a data management node 1001 for executing the data storage method described in any of the above embodiments, a client node 1002 for sending a data storage request of target data, and at least two replica storage nodes 1003 for storing data.

[0197] It should be noted that the principle of solving the problem of the data storage system provided by the present disclosure has been described in the above embodiments. For details, please refer to the above embodiments of the data storage method, and the repeated parts will not be described herein.

[0198] The present disclosure provides a data reading system, Figure 11A structural schematic diagram of a data reading system provided by an embodiment of the present disclosure is shown in FIG. 1. The system includes a client node 1101 configured to execute any of the data reading methods described above, a data management node 1102 configured to execute the data reading method described above, and at least two target storage nodes 1103 configured to store target data.

[0199] It should be noted that the principle of solving the problem by the data reading system provided by the present disclosure has been described in the above embodiments. For details, please refer to the above embodiments of the data reading method. Repetitive descriptions are omitted.

[0200] The foregoing describes the data storage method of the embodiment of the present disclosure. In the following, the data storage device in the embodiment of the present disclosure will be introduced. The method and the device are based on the same technical concept. Since the principles of solving the problems by the method and the device are similar, the implementation of the device and the method can be referred to each other, and repetitive descriptions are omitted.

[0201] The embodiment of the present disclosure provides a data storage device, Figure 12 A structural schematic diagram of a data storage device provided by an embodiment of the present disclosure is shown in FIG. 2. The device includes:

[0202] The receiving unit 1201 is configured to receive a data storage request of target data sent by a client node.

[0203] The processing unit 1202 is configured to determine M target storage nodes from the at least two copy storage nodes based on the racks where the at least two copy storage nodes are located and the pre-configured first coordinates corresponding to the at least two copy storage nodes, respectively. The M is a positive integer greater than or equal to 2, and the sizes of the remaining storage spaces of the M target storage nodes satisfy the size of the storage space required by the target data.

[0204] The sending unit 1203 is configured to send information of the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0205] In some possible implementation manners, the processing unit 1202 is specifically configured to, if the client node and the at least two copy storage nodes are located in the same data center, and the at least two copy storage nodes are deployed on at least two racks, acquire the order of the at least two racks; determine whether the number of the determined target storage nodes reaches M for the at least two racks according to the order of the at least two racks; if not, determine a target storage node according to the first coordinates corresponding to the at least one copy storage node on the rack; and if so, stop determining the target storage node.

[0206] In some possible implementation, the processing unit 1202 is specifically configured to acquire rack distances between the at least two racks and the rack where the client node is located respectively; and determine the order of the at least two racks according to the rack distances corresponding to the at least two racks respectively, wherein the smaller the rack distance corresponding to a rack is, the earlier the order of the rack is.

[0207] In some possible implementation, the processing unit 1202 is specifically configured to determine the target storage node according to the residual storage space corresponding to each of the at least one replica storage node on the rack and the first coordinate.

[0208] In some possible implementation, the processing unit 1202 is specifically configured to determine at least one candidate storage node from the at least one replica storage node according to the residual storage space corresponding to each of the at least one replica storage node and the storage space required by the target data; and determine the target storage node from the at least one candidate storage node according to the first coordinate corresponding to each of the at least one candidate storage node.

[0209] In some possible implementation, the processing unit 1202 is specifically configured to, if the rack is the same as the rack where the client node is located, determine the target storage node from the at least one candidate storage node based on the first number of the at least one candidate storage node, the first coordinate corresponding to each of the at least one candidate storage node and a preset number threshold N, wherein the N is an integer greater than or equal to 1 and less than the M.

[0210] In some possible implementation, the processing unit 1202 is specifically configured to, if the first number is greater than the N, determine a first distance between each of the at least one candidate storage node and the client node based on the first coordinate corresponding to each of the at least one candidate storage node and a second coordinate of the client node in the data center; and determine N target storage nodes from the at least one candidate storage node according to the first distance corresponding to each of the at least one candidate storage node.

[0211] In some possible implementation, the processing unit 1202 is further configured to, if the first number is not greater than the N, directly determine the at least one candidate storage node as the target storage node.

[0212] In some possible implementation, the processing unit 1202 is specifically configured to, if the rack is different from the rack where the client node is located, determine a second distance between each of the at least one candidate storage node and the reference storage node according to the coordinates of the reference storage node in the data center, the first coordinates corresponding to each of the at least one candidate storage node, and an access path between the reference storage node and each of the at least one candidate storage node, wherein the reference storage node is the client node or any determined target storage node; and determine the target storage node from the at least one candidate storage node according to the second distances corresponding to each of the at least one candidate storage node.

[0213] In some possible implementation, the processing unit 1202 is specifically configured to, for each of the at least one candidate storage node, when determining the second distance between the candidate storage node and the reference storage node, perform the following steps:

[0214] determine a base distance between the coordinates and the first coordinates corresponding to the candidate storage node;

[0215] determine the second distance between the candidate storage node and the reference storage node according to the base distance and a number of switches passed in the access path between the reference storage node and the candidate storage node.

[0216] In some possible implementation, if the client node is not located in the same data center as the at least two replica storage nodes, and the at least two replica storage nodes are deployed on at least two racks, the processing unit 1202 is specifically configured to: determine at least two candidate storage nodes according to the remaining storage space of the at least two replica storage nodes and the required storage space of the target data; count a second quantity of candidate storage nodes deployed on each rack; determine target storage nodes belonging to a first set from the at least two candidate storage nodes according to a plurality of the second quantities and a preset quantity threshold Z, wherein the Z is a positive integer less than the M and greater than or equal to 1; determine a third distance between each of at least one other candidate storage node and the determined target storage node according to the first coordinate corresponding to any determined target storage node, the first coordinate corresponding to each of the at least one other candidate storage node, and an access path between the target storage node and each of the at least one other candidate storage node; wherein the other candidate storage node is a candidate storage node in the at least two candidate storage nodes that is not determined as the target storage node; determine target storage nodes belonging to a second set from the at least one other storage node according to the third distance corresponding to each of the at least one other storage node, wherein the total quantity of target storage nodes included in the first set and the second set is the M.

[0217] In some possible implementation, the processing unit 1202 is specifically configured to: if there is only one second quantity and the second quantity is less than the Z, determine a rack corresponding to the second quantity; and determine at least one candidate storage node on the rack as a target storage node belonging to the first set; if there is only one second quantity and the second quantity is not less than the Z, determine a rack corresponding to the second quantity; and determine Z candidate storage nodes on the rack as target storage nodes belonging to the first set; if there are a plurality of second quantities and a maximum value in the plurality of second quantities is less than the Z, determine a rack corresponding to the maximum value; and determine at least one candidate storage node on the rack as a target storage node belonging to the first set; if there are a plurality of second quantities and a maximum value in the plurality of second quantities is not less than the Z, determine a rack corresponding to the maximum value; and determine Z candidate storage nodes on the rack as target storage nodes belonging to the first set.

[0218] In some possible implementation, the receiving unit 1201 is further configured to receive notification information sent by the target storage node; the notification information is sent by the target storage node after the target storage node stores the target data completely, and carries a storage path of the target data in the target storage node.

[0219] The processing unit 1202 is further configured to save the storage path.

[0220] The foregoing introduces the data reading method of the embodiments of the present disclosure, and the following introduces the data reading device in the embodiments of the present disclosure. The method and the device are based on the same technical concept, and the implementation of the device and the method can be referred to each other because the principles of the method and the device for solving problems are similar, and the repeated parts will not be described here.

[0221] The embodiments of the present disclosure provide a data reading device, Figure 13 The embodiments of the present disclosure provide a data reading device,

[0222] The first sending module 1301 is configured to send a data reading request for reading target data.

[0223] The first receiving module 1302 is configured to receive information of M target storage nodes storing the target data; the information includes first coordinates corresponding to the M target storage nodes respectively and racks where the M target storage nodes are located, and M is a positive integer greater than or equal to 2.

[0224] The first processing module 1303 is configured to determine distances between the M target storage nodes and the client node respectively according to the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located, and a rack where the client node is located and a second coordinate corresponding to the client node preconfigured, and determine a target storage node to be accessed by the client node and access the corresponding target storage node according to the distances between the M target storage nodes respectively, to obtain the target data stored in the target storage node.

[0225] In some possible implementation, the first processing module 1303 is specifically configured to perform the following steps when determining the distance between any target storage node and the client node:

[0226] If it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate is determined, and the distance between the target storage node and the client node is determined according to the basic distance.

[0227] If it is determined that the rack where the client node is located and the rack where the target storage node is located are in the same data center, and the rack where the client node is located and the rack where the target storage node is located are not the same, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate is determined; and a distance between the target storage node and the client node is determined according to the number of layers of switches passed in an access path between the target storage node and the client node and the basic distance.

[0228] If it is determined that the rack where the client node is located and the rack where the target storage node is located are in different data centers, a basic distance between the first coordinate corresponding to the target storage node and the second coordinate is determined; and a distance between the target storage node and the client node is determined according to the basic distance and a preset distance value, the distance being greater than the maximum value of the distances between any two replica storage nodes in the data center.

[0229] In some possible implementation manners, the first processing module 1303 is further configured to, if it is determined that the target storage node to be accessed has a fault that cannot read the target data, acquire M-1 target storage nodes other than the target storage node; and re-determine the target storage node to be accessed and perform access according to distances corresponding to the M-1 target storage nodes.

[0230] The foregoing describes the data reading method of the embodiments of the present disclosure, and the following describes a data reading apparatus in the embodiments of the present disclosure. The method and the apparatus are based on the same technical concept, and the implementation of the apparatus and the method can be referred to each other, and the repeated parts will not be described herein.

[0231] The embodiments of the present disclosure provide a data reading apparatus, Figure 14 A structural schematic diagram of a data reading apparatus provided by the embodiments of the present disclosure is shown in the figure, and the apparatus comprises:

[0232] The second receiving module 1401 is configured to receive a data reading request for reading target data sent by a client node.

[0233] The second processing module 1402 is configured to determine information of M target storage nodes storing the target data.

[0234] The second sending module 1403 is configured to send information of the M target storage nodes to the client node, so that after the client node receives the information of the M target storage nodes, the client node determines distances between the M target storage nodes and the client node according to the first coordinates respectively corresponding to the M target storage nodes, racks where the M target storage nodes are located, a rack where the client node is located, and the second coordinates respectively corresponding to the client node and preconfigured, and determines a target storage node to be accessed by the client node according to the distances respectively corresponding to the M target storage nodes, and accesses the corresponding target storage node to obtain the target data stored in the target storage node. The distances are used to determine the target storage node to be accessed by the client node and access the target storage node to obtain the target data stored in the target storage node. The information includes the first coordinates respectively corresponding to the M target storage nodes, and the M is a positive integer greater than or equal to 2.

[0235] As shown in Figure 15 An electronic device structure schematic diagram is provided in the embodiment of the present disclosure. Based on the above embodiments, the embodiment of the present disclosure further provides an electronic device, as shown in Figure 15 The processor 1501, the communication interface 1502, and the memory 1503 can communicate with each other through the communication bus 1504.

[0236] The memory 1503 stores a computer program. When the program is executed by the processor 1501, the processor 1501 performs the following steps:

[0237] Receiving a data storage request of target data sent by a client node;

[0238] Determining M target storage nodes from at least two replica storage nodes based on racks where the at least two replica storage nodes are located and first coordinates respectively corresponding to the at least two replica storage nodes. The M is a positive integer greater than or equal to 2, and sizes of remaining storage spaces of the M target storage nodes meet a size of a storage space required by the target data.

[0239] Sending information of the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0240] As shown in Figure 16 An electronic device structure schematic diagram is provided in the embodiment of the present disclosure. Based on the above embodiments, the embodiment of the present disclosure further provides an electronic device, as shown inFigure 16 As shown in FIG. 16, the electronic device includes a processor 1601, a communication interface 1602, a memory 1603, and a communication bus 1604, wherein the processor 1601, the communication interface 1602, and the memory 1603 communicate with each other through the communication bus 1604.

[0241] The memory 1603 stores a computer program, and when the program is executed by the processor 1601, the processor 1601 performs the following steps:

[0242] sending a data read request of target data;

[0243] receiving information of M target storage nodes storing the target data; wherein the information includes first coordinates corresponding to the M target storage nodes respectively and racks where the M target storage nodes are located, and the M is a positive integer greater than or equal to 2;

[0244] determining distances between the M target storage nodes and the client node respectively according to the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located, a rack where the client node is located, and a second coordinate corresponding to the client node and pre-configured;

[0245] determining a target storage node to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively, and accessing the corresponding target storage node to obtain the target data stored in the target storage node.

[0246] As Figure 17 An electronic device structure schematic diagram is provided for the embodiments of the present disclosure, and on the basis of the above embodiments, the present disclosure further provides an electronic device, as shown in FIG. 17, which includes a processor 1701, a communication interface 1702, a memory 1703, and a communication bus 1704, wherein the processor 1701, the communication interface 1702, and the memory 1703 communicate with each other through the communication bus 1704. Figure 17

[0247] The memory 1703 stores a computer program, and when the program is executed by the processor 1701, the processor 1701 performs the following steps:

[0248] receiving a data read request of target data sent by a client node;

[0249] ​The information of the M target storage nodes storing the target data is determined and sent to the client node, so that after the client node receives the information of the M target storage nodes, the distances between the M target storage nodes and the client node are determined according to the first coordinates corresponding to the M target storage nodes respectively, the racks where the M target storage nodes are located, the rack where the client node is located, and the second coordinates corresponding to the client node respectively, the target storage node to be accessed by the client node is determined according to the distances corresponding to the M target storage nodes respectively, and the corresponding target storage node is accessed to obtain the target data stored therein; wherein the information includes the first coordinates corresponding to the M target storage nodes respectively, and the M is a positive integer greater than or equal to 2.

[0250] Since the principle of solving the problem of the above electronic device is similar to the data storage method, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be described.

[0251] The communication bus mentioned in the above electronic device can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0252] The communication interface 1702 is used for communication between the above electronic device and other devices.

[0253] The memory can include a random access memory (RAM), and can also include a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0254] The above processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processing (DSP) processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0255] On the basis of the above embodiments, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program executable by a processor, when the program runs on the processor, the processor executes to realize the following steps:

[0256] receiving a data storage request of target data sent by a client node;

[0257] determining M target storage nodes from at least two copy storage nodes based on racks where the at least two copy storage nodes are respectively located and preconfigured first coordinates corresponding to the at least two copy storage nodes respectively; wherein the M is a positive integer greater than or equal to 2, and sizes of remaining storage spaces of the M target storage nodes satisfy a size of a storage space required by the target data;

[0258] sending information of the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage.

[0259] Since the principle of solving the problem by the computer readable storage medium is similar to the above data storage method, the specific implementation can be referred to the implementation of the data processing method, and the repeated parts will not be described.

[0260] On the basis of the above embodiments, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program executable by a processor, when the program runs on the processor, the processor executes to realize the following steps:

[0261] sending a data read request of target data;

[0262] receiving information of M target storage nodes storing the target data; wherein the information includes first coordinates corresponding to the M target storage nodes respectively and racks where the M target storage nodes are located, and the M is a positive integer greater than or equal to 2;

[0263] determining distances between the M target storage nodes and the client node respectively according to the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located, a rack where the client node is located, and a preconfigured second coordinate corresponding to the client node;

[0264] determining target storage nodes to be accessed by the client node and accessing the corresponding target storage nodes according to the distances corresponding to the M target storage nodes respectively, to obtain the target data stored by the target storage nodes.

[0265] Since the principle of solving the problem by the computer readable storage medium is similar to the above-mentioned data reading method, the specific implementation can refer to the implementation of the data processing method, and the repeated parts will not be described.

[0266] On the basis of the above-mentioned embodiments, the embodiments of the present disclosure further provide a computer readable storage medium, which stores a computer program executable by a processor, and when the program runs on the processor, the processor executes the following steps:

[0267] sending a data reading request of target data;

[0268] receiving information of M target storage nodes storing the target data; wherein the information includes first coordinates corresponding to the M target storage nodes respectively and racks where the M target storage nodes are located, and the M is a positive integer greater than or equal to 2;

[0269] determining distances between the M target storage nodes and the client node respectively according to the first coordinates corresponding to the M target storage nodes respectively and the racks where the M target storage nodes are located, a rack where the client node is located, and a second coordinate corresponding to the client node pre-configured;

[0270] determining a target storage node to be accessed by the client node according to the distances corresponding to the M target storage nodes respectively and accessing the corresponding target storage node to obtain the target data stored by the target storage node.

[0271] Since the principle of solving the problem by the computer readable storage medium is similar to the above-mentioned data reading method, the specific implementation can refer to the implementation of the data processing method, and the repeated parts will not be described.

[0272] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.

[0273] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0274] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0275] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks. Figure 1 one or more flow or blocks.

[0276] Obviously, numerous modifications and variations of the present application are possible in light of the above teachings. It is therefore to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.

Claims

1. A data storage method, characterized in that, The method includes: Receive data storage requests for target data sent by client nodes; Based on the racks where at least two replica storage nodes are located and the pre-configured first coordinates corresponding to the at least two replica storage nodes, M target storage nodes are determined from the at least two replica storage nodes; wherein, M is a positive integer greater than or equal to 2, and the remaining storage space of the M target storage nodes is sufficient to meet the storage space required by the target data; The information of the M target storage nodes is sent to the client node, so that the client node sends the target data to the M target storage nodes for storage; Wherein, if the client node and the at least two replica storage nodes are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the step of determining M target storage nodes from the at least two replica storage nodes based on the racks where the at least two replica storage nodes are located and the pre-configured first coordinates corresponding to the at least two replica storage nodes includes: Based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data, at least two candidate storage nodes are determined; The second number of candidate storage nodes deployed on each rack is counted; Based on the plurality of the second quantities and the preset quantity threshold Z, a target storage node belonging to the first set is determined from the at least two candidate storage nodes; wherein, Z is a positive integer less than M and greater than or equal to 1; Based on the first coordinates corresponding to any determined target storage node, the first coordinates corresponding to at least one other candidate storage node, and the access paths between the target storage node and the at least one other candidate storage node, a third distance is determined between the at least one other candidate storage node and the determined target storage node; wherein, the other candidate storage node is the candidate storage node among the at least two candidate storage nodes that has not been determined as the target storage node; Based on the third distance corresponding to the at least one other storage node, a target storage node belonging to the second set is determined from the at least one other storage node; wherein the total number of target storage nodes contained in the first set and the second set is M.

2. The method according to claim 1, characterized in that, If the client node and the at least two replica storage nodes are located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the process of determining M target storage nodes from the at least two replica storage nodes based on the racks where the at least two replica storage nodes are located and the pre-configured first coordinates corresponding to the at least two replica storage nodes includes: Obtain the order of the at least two racks; In accordance with the order of the at least two racks, for the at least two racks, determine whether the number of identified target storage nodes has reached M; if not, determine the target storage nodes according to the first coordinates corresponding to at least one replica storage node on the rack; if so, stop determining the target storage nodes.

3. The method according to claim 2, characterized in that, The order in which the at least two racks are acquired includes: Obtain the rack distances between the at least two racks and the rack where the client node is located; The order of the at least two racks is determined based on the rack distances between them; wherein, the smaller the rack distance between the racks, the earlier the rack is in the order.

4. The method according to claim 2, characterized in that, The step of determining the target storage node based on the first coordinates corresponding to at least one replica storage node on the rack includes: The target storage node is determined based on the remaining storage space corresponding to at least one replica storage node on the rack and the first coordinate.

5. The method according to claim 4, characterized in that, The step of determining the target storage node based on the remaining storage space corresponding to at least one replica storage node on the rack and the first coordinates includes: Based on the remaining storage space corresponding to the at least one replica storage node and the storage space required by the target data, at least one candidate storage node is determined from the at least one replica storage node; The target storage node is determined from the at least one candidate storage node based on the first coordinates corresponding to each of the at least one candidate storage node.

6. The method according to claim 5, characterized in that, The step of determining the target storage node from the at least one candidate storage node based on the first coordinates corresponding to the at least one candidate storage node includes: If the rack is the same as the rack where the client node is located, then the target storage node is determined from the at least one candidate storage node based on the first number of the at least one candidate storage node, the first coordinates corresponding to the at least one candidate storage node, and the preset number threshold N; where N is an integer greater than or equal to 1 and less than M.

7. The method according to claim 6, characterized in that, The step of determining the target storage node from the at least one candidate storage node based on a first number of candidate storage nodes, first coordinates corresponding to the at least one candidate storage node, and a preset number threshold N includes: If the first number is greater than N, then based on the first coordinates corresponding to the at least one candidate storage node and the second coordinates of the client node in the data center, the first distance between the at least one candidate storage node and the client node is determined. Based on the first distance corresponding to each of the at least one candidate storage node, N target storage nodes are determined from the at least one candidate storage node.

8. The method according to claim 7, characterized in that, The method further includes: If the first number is not greater than N, then all at least one candidate storage node will be directly determined as the target storage node.

9. The method according to claim 5, characterized in that, The step of determining the target storage node from the at least one candidate storage node based on the first coordinates corresponding to the at least one candidate storage node includes: If the rack is different from the rack where the client node is located, then the second distance between the at least one candidate storage node and the reference storage node is determined based on the coordinates of the reference storage node in the data center, the first coordinates corresponding to the at least one candidate storage node, and the access paths between the reference storage node and the at least one candidate storage node; wherein, the reference storage node is the client node or any determined target storage node; The target storage node is determined from the at least one candidate storage node based on the second distance corresponding to each of the at least one candidate storage node.

10. The method according to claim 9, characterized in that, The step of determining the second distance between the at least one candidate storage node and the reference storage node based on the coordinates of the reference storage node in the data center, the first coordinates corresponding to the at least one candidate storage node, and the access paths between the reference storage node and the at least one candidate storage node includes: For the at least one candidate storage node, when determining the second distance between the candidate storage node and the reference storage node, the following steps are performed: Determine the basic distance between the coordinates and the first coordinates corresponding to the candidate storage node; The second distance between the candidate storage node and the reference storage node is determined based on the base distance and the number of switch layers traversed in the access path between the reference storage node and the candidate storage node.

11. The method according to claim 1, characterized in that, The step of determining the target storage node belonging to the first set from the at least two candidate storage nodes based on one or more of the second quantity and a preset quantity threshold Z includes: If there exists only one of the second quantities, and the second quantity is less than Z, then determine the rack corresponding to the second quantity; and determine at least one candidate storage node on that rack as a target storage node belonging to the first set. If there exists only one of the second quantities, and the second quantity is not less than Z, then determine the rack corresponding to the second quantity; and determine the Z candidate storage nodes on that rack as target storage nodes belonging to the first set. If there are multiple second quantities, and the maximum value among the multiple second quantities is less than Z, then determine a rack corresponding to the maximum value; and determine at least one candidate storage node on that rack as a target storage node belonging to the first set. If there are multiple second quantities, and the maximum value among the multiple second quantities is not less than Z, then determine a rack corresponding to the maximum value; and determine the Z candidate storage nodes on that rack as target storage nodes belonging to the first set.

12. The method according to claim 1, characterized in that, The method further includes: Receive notification information sent by the target storage node; wherein, the notification message is sent by the target storage node after it has finished storing the target data, and the notification information carries the storage path of the target data in the target storage node; Save the storage path.

13. The method according to claim 1, characterized in that, The first coordinates corresponding to any replica storage node are determined based on the first rack number of the rack where the replica storage node is located in the data center, the second rack number of the rack where the replica storage node is located in the preset coordinate system, and the machine number corresponding to the position of the replica storage node on its rack.

14. The method according to claim 13, characterized in that, The first rack number is the same as the second rack number.

15. The method according to claim 13, characterized in that, The first dimension coordinate value of each replica storage node is determined according to the machine serial number, the second dimension coordinate value is determined according to the second rack serial number, and the third dimension coordinate value is determined according to the first rack serial number.

16. A data reading method, characterized in that, The method is applied to a client node, and the method includes: Send a data read request for the target data; Receive information about M target storage nodes storing the target data; wherein, the information includes the first coordinates and racks corresponding to the M target storage nodes respectively, and M is a positive integer greater than or equal to 2; Based on the first coordinates and racks corresponding to the M target storage nodes, the rack where the client node is located, and the pre-configured second coordinates corresponding to the client node, the distances between the M target storage nodes and the client node are determined. Based on the distances corresponding to the M target storage nodes, the target storage node to be accessed by the client node is determined and the corresponding target storage node is accessed to obtain the target data stored therein; If the client node and at least two replica storage nodes used for storing data are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the process by which the data management node determines the M target storage nodes includes: Based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data, at least two candidate storage nodes are determined; The second number of candidate storage nodes deployed on each rack is counted; Based on the plurality of the second quantities and the preset quantity threshold Z, a target storage node belonging to the first set is determined from the at least two candidate storage nodes; wherein, Z is a positive integer less than M and greater than or equal to 1; Based on the first coordinates corresponding to any determined target storage node, the first coordinates corresponding to at least one other candidate storage node, and the access paths between the target storage node and the at least one other candidate storage node, a third distance is determined between the at least one other candidate storage node and the determined target storage node; wherein, the other candidate storage node is the candidate storage node among the at least two candidate storage nodes that has not been determined as the target storage node; Based on the third distance corresponding to the at least one other storage node, a target storage node belonging to the second set is determined from the at least one other storage node; wherein the total number of target storage nodes contained in the first set and the second set is M.

17. The method according to claim 16, characterized in that, The step of determining the distance between the M target storage nodes and the client node based on the first coordinates and racks corresponding to the M target storage nodes, the rack where the client node is located, and the pre-configured second coordinates corresponding to the client node includes: When determining the distance between any target storage node and the client node, the following steps are performed: If it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; and based on the basic distance, the distance between the target storage node and the client node is determined. If it is determined that the rack where the client node is located and the rack where the target storage node is located are in the same data center, and the rack where the client node is located and the rack where the target storage node is located are different, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; the distance between the target storage node and the client node is determined based on the number of switch layers traversed in the access path between the target storage node and the client node, and the basic distance. If it is determined that the rack where the client node is located and the rack where the target storage node is located are in different data centers, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; based on the basic distance and a preset value, the distance between the target storage node and the client node is determined; the distance is greater than the distance between any two replica storage nodes in the data center.

18. The method according to claim 16, characterized in that, The information of any target storage node also includes the storage path of the target data in the target storage node.

19. The method according to claim 16, characterized in that, The method further includes: If it is determined that the target storage node to be accessed has a fault that prevents the reading of the target data, then obtain M-1 other target storage nodes besides the target storage node; based on the distances corresponding to the M-1 target storage nodes, redetermine the target storage node to be accessed and access it.

20. A data reading method, characterized in that, The method is applied to a data management node, and the method includes: Receive data read requests for target data sent by client nodes; The system determines information about M target storage nodes storing the target data and sends it to the client node. Upon receiving this information, the client node determines the distances between each of the M target storage nodes and the client node based on the first coordinates and rack locations of the M target storage nodes, the rack location of the client node, and pre-configured second coordinates. Based on these distances, the client node then determines the target storage node it needs to access and accesses the corresponding target storage node to retrieve the stored target data. The information includes the first coordinates of each of the M target storage nodes, where M is a positive integer greater than or equal to 2. Wherein, if the client node and at least two replica storage nodes used to store the data are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, determining the M target storage nodes for storing the target data includes: Based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data, at least two candidate storage nodes are determined; The second number of candidate storage nodes deployed on each rack is counted; Based on the plurality of the second quantities and the preset quantity threshold Z, a target storage node belonging to the first set is determined from the at least two candidate storage nodes; wherein, Z is a positive integer less than M and greater than or equal to 1; Based on the first coordinates corresponding to any determined target storage node, the first coordinates corresponding to at least one other candidate storage node, and the access paths between the target storage node and the at least one other candidate storage node, a third distance is determined between the at least one other candidate storage node and the determined target storage node; wherein, the other candidate storage node is the candidate storage node among the at least two candidate storage nodes that has not been determined as the target storage node; Based on the third distance corresponding to the at least one other storage node, a target storage node belonging to the second set is determined from the at least one other storage node; wherein the total number of target storage nodes contained in the first set and the second set is M.

21. A data storage system, characterized in that, The system includes a data management node for performing the method of any one of claims 1-15, a client node for sending a data storage request for the target data, and at least two replica storage nodes for storing the data.

22. A data reading system, characterized in that, The system includes a client node for performing the method of any one of claims 16-19, a data management node for performing the method of claim 20, and at least two target storage nodes for storing target data.

23. A data storage device, characterized in that, The device includes: The receiving unit is used to receive data storage requests for target data sent by client nodes; The processing unit is configured to determine M target storage nodes from the at least two replica storage nodes based on the racks where the at least two replica storage nodes are located and the pre-configured first coordinates corresponding to the at least two replica storage nodes; wherein M is a positive integer greater than or equal to 2, and the remaining storage space of the M target storage nodes is sufficient to meet the storage space required by the target data; A sending unit is configured to send information from the M target storage nodes to the client node, so that the client node sends the target data to the M target storage nodes for storage; If the client node and the at least two replica storage nodes are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the processing unit is specifically configured to: determine at least two candidate storage nodes based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data; count the second number of candidate storage nodes deployed on each rack; and determine the target storage node belonging to the first set from the at least two candidate storage nodes based on a plurality of the second numbers and a preset number threshold Z; wherein, Z is a positive integer less than M and greater than or equal to 1; and determine the target storage node corresponding to any determined target storage node. A first coordinate, a first coordinate corresponding to at least one other candidate storage node, and an access path between the target storage node and the at least one other candidate storage node are used to determine a third distance between the at least one other candidate storage node and the determined target storage node; wherein, the other candidate storage node is a candidate storage node among the at least two candidate storage nodes that has not been determined as the target storage node; based on the third distance corresponding to the at least one other storage node, a target storage node belonging to a second set is determined from the at least one other storage node; wherein, the total number of target storage nodes contained in the first set and the second set is M.

24. The apparatus according to claim 23, characterized in that, The processing unit is specifically configured to obtain the order of the at least two racks if the client node and the at least two replica storage nodes are located in the same data center and the at least two replica storage nodes are deployed on at least two racks; In accordance with the order of the at least two racks, for the at least two racks, determine whether the number of identified target storage nodes reaches M; if not, determine the target storage node according to the first coordinates corresponding to at least one replica storage node on the rack. If the target is reached, then stop determining the target storage node.

25. The apparatus according to claim 24, characterized in that, The processing unit is specifically used to obtain the rack distances between the at least two racks and the rack where the client node is located; and to determine the order of the at least two racks based on the rack distances corresponding to the at least two racks; wherein, the smaller the rack distance between the racks, the earlier the rack is in the order.

26. The apparatus according to claim 24, characterized in that, The processing unit is specifically used to determine the target storage node based on the remaining storage space corresponding to at least one replica storage node on the rack and the first coordinate.

27. The apparatus according to claim 26, characterized in that, The processing unit is specifically used to determine at least one candidate storage node from the at least one replica storage node based on the remaining storage space corresponding to the at least one replica storage node and the storage space required by the target data. The target storage node is determined from the at least one candidate storage node based on the first coordinates corresponding to each of the at least one candidate storage node.

28. The apparatus according to claim 27, characterized in that, The processing unit is specifically configured to, if the rack is the same as the rack where the client node is located, determine the target storage node from the at least one candidate storage node based on the first number of the at least one candidate storage node, the first coordinates corresponding to the at least one candidate storage node, and a preset number threshold N; where N is an integer greater than or equal to 1 and less than M.

29. The apparatus according to claim 28, characterized in that, The processing unit is specifically configured to, if the first quantity is greater than N, determine the first distance between the at least one candidate storage node and the client node based on the first coordinates corresponding to the at least one candidate storage node and the second coordinates of the client node in the data center; Based on the first distance corresponding to each of the at least one candidate storage node, N target storage nodes are determined from the at least one candidate storage node.

30. The apparatus according to claim 29, characterized in that, The processing unit is further configured to, if the first number is not greater than N, directly determine all at least one candidate storage node as the target storage node.

31. The apparatus according to claim 27, characterized in that, The processing unit is specifically configured to, if the rack is different from the rack where the client node is located, determine a second distance between the at least one candidate storage node and the reference storage node based on the coordinates of the reference storage node in the data center, the first coordinates corresponding to the at least one candidate storage node, and the access paths between the reference storage node and the at least one candidate storage node; wherein the reference storage node is the client node or any determined target storage node; and determine the target storage node from the at least one candidate storage node based on the second distances corresponding to the at least one candidate storage node.

32. The apparatus according to claim 31, characterized in that, The processing unit is specifically configured to perform the following steps when determining the second distance between the candidate storage node and the reference storage node for the at least one candidate storage node: Determine the basic distance between the coordinates and the first coordinates corresponding to the candidate storage node; The second distance between the candidate storage node and the reference storage node is determined based on the base distance and the number of switch layers traversed in the access path between the reference storage node and the candidate storage node.

33. The apparatus according to claim 23, characterized in that, The processing unit is specifically configured to determine the rack corresponding to the second quantity if there is only one second quantity and the second quantity is less than Z; and determine at least one candidate storage node on the rack as a target storage node belonging to the first set. If there exists only one of the second quantities, and the second quantity is not less than Z, then the rack corresponding to the second quantity is determined; The Z candidate storage nodes on the rack are determined as target storage nodes belonging to the first set; if there are multiple second quantities, and the maximum value among the multiple second quantities is less than Z, then the rack corresponding to the maximum value is determined; at least one candidate storage node on the rack is determined as a target storage node belonging to the first set; if there are multiple second quantities, and the maximum value among the multiple second quantities is not less than Z, then the rack corresponding to the maximum value is determined; the Z candidate storage nodes on the rack are determined as target storage nodes belonging to the first set.

34. The apparatus according to claim 23, characterized in that, The receiving unit is further configured to receive notification information sent by the target storage node; wherein the notification message is sent by the target storage node after it has finished storing the target data, and the notification information carries the storage path of the target data in the target storage node; The processing unit is also used to save the storage path.

35. A data reading device, characterized in that, The device is applied to a client node, and the device includes: The first sending module is used to send a data read request to read the target data; The first receiving module is used to receive information from M target storage nodes storing the target data; wherein, the information includes the first coordinates corresponding to the M target storage nodes and the racks in which they are located, and M is a positive integer greater than or equal to 2; The first processing module is configured to determine the distances between the M target storage nodes and the client node based on the first coordinates and racks corresponding to the M target storage nodes, the rack where the client node is located, and the pre-configured second coordinates corresponding to the client node; and to determine the target storage node to be accessed by the client node based on the distances corresponding to the M target storage nodes and access the corresponding target storage node to obtain the target data stored therein. If the client node and at least two replica storage nodes used for storing data are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the process by which the data management node determines the M target storage nodes includes: Based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data, at least two candidate storage nodes are determined; The second number of candidate storage nodes deployed on each rack is counted; Based on the plurality of the second quantities and the preset quantity threshold Z, a target storage node belonging to the first set is determined from the at least two candidate storage nodes; wherein, Z is a positive integer less than M and greater than or equal to 1; Based on the first coordinates corresponding to any determined target storage node, the first coordinates corresponding to at least one other candidate storage node, and the access paths between the target storage node and the at least one other candidate storage node, a third distance is determined between the at least one other candidate storage node and the determined target storage node; wherein, the other candidate storage node is the candidate storage node among the at least two candidate storage nodes that has not been determined as the target storage node; Based on the third distance corresponding to the at least one other storage node, a target storage node belonging to the second set is determined from the at least one other storage node; wherein the total number of target storage nodes contained in the first set and the second set is M.

36. The apparatus according to claim 35, characterized in that, The first processing module is specifically used to perform the following steps when determining the distance between any target storage node and the client node: If it is determined that the rack where the client node is located is the same as the rack where the target storage node is located, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; and based on the basic distance, the distance between the target storage node and the client node is determined. If it is determined that the rack where the client node is located and the rack where the target storage node is located are in the same data center, and the rack where the client node is located and the rack where the target storage node is located are different, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; the distance between the target storage node and the client node is determined based on the number of switch layers traversed in the access path between the target storage node and the client node, and the basic distance. If it is determined that the rack where the client node is located is not in the same data center as the rack where the target storage node is located, then the basic distance between the first coordinate and the second coordinate corresponding to the target storage node is determined; based on the basic distance and the preset distance value, the distance between the target storage node and the client node is determined; the distance is greater than the distance between any two replica storage nodes in the data center.

37. The apparatus according to claim 35, characterized in that, The first processing module is further configured to, if it is determined that the target storage node to be accessed has a fault that prevents the reading of the target data, obtain M-1 other target storage nodes besides the target storage node; and re-determine the target storage node to be accessed based on the distances corresponding to the M-1 target storage nodes and access it.

38. A data reading device, characterized in that, The device is used in a data management node, and the device includes: The second receiving module is used to receive data reading requests sent by the client node to read target data; The second processing module is used to determine the information of the M target storage nodes storing the target data; The second sending module is used to send the information of the M target storage nodes to the client node, so that after receiving the information of the M target storage nodes, the client node determines the distance between the M target storage nodes and the client node based on the first coordinates and racks corresponding to the M target storage nodes, the rack where the client node is located, the pre-configured second coordinates corresponding to the client node, and the pre-configured second coordinates. Based on the distances corresponding to the M target storage nodes, the client node determines the target storage node to be accessed and accesses the corresponding target storage node to obtain the target data stored therein. The information includes the first coordinates corresponding to the M target storage nodes, where M is a positive integer greater than or equal to 2. If the client node and at least two replica storage nodes used for storing data are not located in the same data center, and the at least two replica storage nodes are deployed on at least two racks, the second processing module is specifically used to determine at least two candidate storage nodes based on the remaining storage space of the at least two replica storage nodes and the storage space required by the target data; count the second number of candidate storage nodes deployed on each rack; and determine the target storage node belonging to the first set from the at least two candidate storage nodes based on multiple second numbers and a preset number threshold Z; wherein Z is a positive integer less than M and greater than or equal to 1; and determine the target storage node belonging to the first set based on any determined target storage node. The target storage node is determined by taking the first coordinates of the target storage node, the first coordinates of at least one other candidate storage node, and the access paths between the target storage node and the at least one other candidate storage node. The third distances between the at least one other candidate storage node and the determined target storage node are then determined. The other candidate storage nodes are those among the at least two candidate storage nodes that have not been identified as the target storage node. Based on the third distances corresponding to the at least one other storage node, a target storage node belonging to a second set is determined from the at least one other storage node. The total number of target storage nodes included in the first set and the second set is M.

39. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the steps of the data storage method as described in any one of claims 1-15, or to implement the steps of the data reading method as described in any one of claims 16-19, or to implement the steps of the data reading method as described in claim 20.

40. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the data storage method as described in any one of claims 1-15, or the steps of the data reading method as described in any one of claims 16-19, or the steps of the data reading method as described in claim 20.

Citation Information

Patent Citations

  • Information processing devices, distributed file system, client device, information processing method and computer program

    US20140012887A1

  • Virtualization-Aware Data Locality in Distributed Data Processing

    US20140059310A1