Data storage method and device, electronic equipment and distributed storage system
By selecting the target storage node according to the number of main OSDs of the storage nodes in the distributed storage system, the problem of excessive data forwarding across nodes is solved, the IO processing path and delay are shortened, and the data storage efficiency is improved.
Patent Information
- Application Number
- CN202310521618.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-05-09
AI Technical Summary
The prior art fails to effectively consider the cross-node distribution pressure caused by multi-replica storage in distributed storage systems, resulting in problems such as excessive data forwarding, longer IO processing paths and increased delays.
By obtaining the number of main OSDs of each storage node, determining the node's selected parameter value, selecting the target storage node with higher weights for data forwarding, reducing the amount of data forwarding across nodes.
It effectively reduces the data forwarding amount of the main OSD in the target storage node, shortens the IO processing path and delay, and improves the efficiency of data storage.
Smart Images

Figure CN118939172A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data storage method, device, electronic device and distributed storage system. Background Art
[0002] In a distributed storage system, a storage cluster consisting of multiple independent storage nodes is used to store data. To ensure high data reliability, the data is copied into multiple identical copies, each of which is saved on a different storage node to avoid data loss caused by a single storage node failure.
[0003] In the prior art, the target storage node for AO (active / optimized) path selection is determined based on conventional detection points such as the device's CPU (Central Processing Unit / Processor), memory, network busyness, IO (Input / Output) delay, and the target storage node then copies the data and forwards it to other storage nodes. However, when selecting the target storage node, the cross-node distribution pressure brought by multi-copy storage is not taken into account, which will lead to the problem of excessive cross-node data forwarding, which in turn leads to problems such as longer IO processing paths and increased delays.
[0004] Therefore, how to better back up and store data to reduce the amount of data forwarding across nodes is a technical problem that needs to be urgently solved by technical personnel in related fields. Summary of the invention
[0005] The present invention provides a data storage method, device, electronic device and distributed storage system, which are used to solve the technical problem of how to better back up and store data in the prior art to reduce the amount of data forwarding across nodes.
[0006] The present invention provides a data storage method, comprising:
[0007] Obtain object storage device OSD distribution data corresponding to each storage node in the distributed storage system, wherein the OSD distribution data includes the number of primary OSDs in the storage node;
[0008] For each of the storage nodes, based on the number of primary OSDs in the storage node, determine a node selection parameter value corresponding to the storage node;
[0009] Determine a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node;
[0010] The acquired data to be stored is transmitted to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0011] According to a data storage method provided by the present invention, determining the node selection parameter value corresponding to the storage node based on the number of primary OSDs in the storage node includes:
[0012] Determine the primary OSD weight corresponding to the storage node based on the number of primary OSDs in the storage node;
[0013] Determine a current weight coefficient corresponding to the storage node, where the current weight coefficient is used to adjust the value of the master OSD weight;
[0014] Based on the master OSD weight and the current weight coefficient, a node selection parameter value corresponding to the storage node is determined.
[0015] According to a data storage method provided by the present invention, determining the current weight coefficient corresponding to the storage node includes:
[0016] Determine a current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node;
[0017] Alternatively, based on the idle rate of the front-end service network port corresponding to the storage node, determine the current weight coefficient corresponding to the storage node;
[0018] Alternatively, based on the current number of AO connections corresponding to the storage node and the idle rate of the front-end service network port, the current weight coefficient corresponding to the storage node is determined.
[0019] According to a data storage method provided by the present invention, the main OSD weight is positively correlated with the number of the main OSDs; the current number of AO connections is negatively correlated with the current weight coefficient; and the front-end service network port idle rate is positively correlated with the current weight coefficient.
[0020] According to a data storage method provided by the present invention, the step of determining a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node includes:
[0021] Determine a first maximum selected parameter value among the node selected parameter values corresponding to each of the storage nodes;
[0022] The storage node corresponding to the first maximum selected parameter value is determined as the target storage node.
[0023] According to a data storage method provided by the present invention, the method further includes:
[0024] In the case where it is determined that the target storage node has a connection failure, determining a second maximum selected parameter value among the node selected parameter values corresponding to each remaining storage node;
[0025] The remaining storage nodes corresponding to the second maximum selected parameter value are determined as new target storage nodes.
[0026] The present invention also provides a data storage device, comprising:
[0027] A data acquisition module, used to acquire object storage device OSD distribution data corresponding to each storage node in the distributed storage system, wherein the OSD distribution data includes the number of primary OSDs in the storage node;
[0028] A parameter determination module, configured to determine, for each storage node, a node selection parameter value corresponding to the storage node based on the number of primary OSDs in the storage node;
[0029] A node selection module, configured to determine a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node;
[0030] The data storage module is used to transmit the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0031] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the data storage methods described above is implemented.
[0032] The present invention also provides a distributed storage system, comprising: at least one storage node and a controller, wherein: the controller is connected to a client device and each of the storage nodes respectively;
[0033] The controller is used to receive the data to be stored transmitted by the client device and execute any of the data storage methods described above.
[0034] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the data storage methods described above is implemented.
[0035] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the data storage methods described above.
[0036] The data storage method, device, electronic device and distributed storage system provided by the present invention determine the node selection parameter value corresponding to each storage node based on the number of master OSDs in each storage node, and determine the target storage node based on the node selection parameter value corresponding to each storage node. Since the number of master OSDs in a storage node is related to the amount of data forwarding across nodes, the cross-node distribution pressure is considered when selecting the target storage node, thereby reducing the amount of data forwarding of the master OSD in the target storage node to avoid the problem of excessive data forwarding across nodes, thereby shortening the IO processing path and reducing the delay, solving the technical problem of how to better back up and store data in the prior art to reduce the amount of data forwarding across nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced one by one below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is one of the flow charts of the data storage method provided by an embodiment of the present invention;
[0039] Figure 2 This is a second flow chart of the data storage method provided by an embodiment of the present invention;
[0040] Figure 3 This is a third flow chart of the data storage method provided by an embodiment of the present invention;
[0041] Figure 4 This is a fourth flow chart of the data storage method provided by an embodiment of the present invention;
[0042] Figure 5 This is a fifth flow chart of the data storage method provided by an embodiment of the present invention;
[0043] Figure 6 is a schematic diagram of the structure of a data storage device provided by an embodiment of the present invention;
[0044] Figure 7 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0045] Figure 8 It is a schematic diagram of the connection relationship between the client device and the storage node in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] Combine the following Figure 1-Figure 5 The data storage method provided by the present invention is described. Figure 1 As shown, the present invention provides a data storage method, which is applied to an AO (active / optimized) path selection scenario based on ALUA (Asymmetric Logical Unit Access), and the method includes:
[0048] Step 101, obtaining object storage device OSD distribution data corresponding to each storage node in a distributed storage system, where the OSD distribution data includes the number of primary OSDs in the storage node.
[0049] Among them, each storage node in the distributed storage system can be a storage server or a storage device, and can also be a storage service client. OSD (Object-based Storage Devices) means object storage device, and object storage (Object-based Storage) is also called "object-oriented storage". "The number of master OSDs in a storage node" means the number of OSDs of this storage node in the resource group on the storage node OSD. Specifically, "the number of master OSDs in a storage node" can be understood as: on the OSD of the storage node, the sum of the number of OSDs of the storage node in the resource group, that is, the number of master OSDs already in the storage node.
[0050] Furthermore, objects are mapped to resource groups, and each resource group is mapped to n OSDs, that is, a master OSD and multiple slave OSDs are assigned to each resource group. Based on the number of replicas, data is copied from the master OSD to multiple slave OSDs. Specifically, in the erasure coding mode, the master OSD is responsible for all write operations, encoding K+M blocks, and writing them to other OSDs. In addition, each OSD carries a large number of resource groups.
[0051] Furthermore, ALUA is one of the multipath mechanisms of the front-end controller. For a specific LUN (Logical Unit Number, namespace resource), in its path, the target port of one controller is in the active / optimized (AO) state, and the target port of the other controller is in the active / unoptimized (AN) state. At a certain moment, a certain LUN only belongs to a certain controller. To achieve load balancing on both sides, task A is thrown to controller A and task B is thrown to controller B. For the same task, only one controller is controlling it at any time.
[0052] Step 102: for each storage node, based on the number of primary OSDs in the storage node, determine a node selection parameter value corresponding to the storage node.
[0053] Further, the node selection parameter value may be used to characterize the probability value of the storage node being selected as the target storage node. Optionally, the higher the node selection parameter value corresponding to the storage node is, the higher the probability value of the storage node being selected as the target storage node is.
[0054] Step 103 : determining a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node.
[0055] Furthermore, each storage node includes at least one OSD, and the types of OSDs included in the storage node include a master OSD and a slave OSD.
[0056] Step 104 , transmitting the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0057] Further, the number of master OSDs in the target storage node includes at least one. The master OSD in the target storage node forwards the data to be stored to at least one slave OSD, and the at least one slave OSD may include the slave OSD in the target storage node and the slave OSDs in other storage nodes.
[0058] In the above steps 101 to 104, the node selection parameter value corresponding to each storage node is determined based on the number of master OSDs in each storage node, and the target storage node is determined based on the node selection parameter value corresponding to each storage node. Since the number of master OSDs in a storage node is related to the amount of data forwarding across nodes, the cross-node distribution pressure is considered when selecting the target storage node, thereby reducing the amount of data forwarding of the master OSD in the target storage node to avoid the problem of excessive data forwarding across nodes, thereby shortening the IO processing path and reducing latency, solving the technical problem of how to better back up and store data in the prior art to reduce the amount of data forwarding across nodes.
[0059] In one embodiment, when the storage node is expanded, the OSD resources are expanded, or even the OSD is abnormal, the above steps 101 to 104 are repeatedly executed to re-determine the target storage node in the current scenario, so as to achieve the purpose of adaptively selecting the optimal ALUA AO path.
[0060] In one embodiment, Figure 2 As shown, in the above step 102, based on the number of primary OSDs in the storage node, the step of determining the node selection parameter value corresponding to the storage node specifically includes:
[0061] Step 201, based on the number of primary OSDs in the storage node, determine the primary OSD weight corresponding to the storage node.
[0062] In one embodiment, the master OSD weight is positively correlated with the number of master OSDs. The more the number of master OSDs, the greater the master OSD weight. Optionally, the master OSD weight is the number of master OSDs multiplied by 100%.
[0063] For example, when the number of primary OSDs is 80, the primary OSD weight is 0.8. When the number of primary OSDs is 45, the primary OSD weight is 0.45. When the number of primary OSDs is 69, the primary OSD weight is 0.69. When the number of primary OSDs is 62, the primary OSD weight is 0.62.
[0064] Step 202, determining a current weight coefficient corresponding to the storage node, where the current weight coefficient is used to adjust the value of the primary OSD weight.
[0065] Step 203: Determine the node selection parameter value corresponding to the storage node based on the master OSD weight and the current weight coefficient.
[0066] In one embodiment, the master OSD weight is added to the current weight coefficient to obtain the node selection parameter value corresponding to the storage node. Alternatively, the master OSD weight is subtracted from the current weight coefficient to obtain the node selection parameter value corresponding to the storage node. Alternatively, the master OSD weight is multiplied by the current weight coefficient to obtain the node selection parameter value corresponding to the storage node.
[0067] For example, in the case where the node selection parameter value is the product of the primary OSD weight and the current weight coefficient, if the primary OSD weight is 1 and the current weight coefficient is 1, the node selection parameter value is 1. If the primary OSD weight is 1 and the current weight coefficient is 0.8, the node selection parameter value is 0.8. If the primary OSD weight is 1 and the current weight coefficient is 0.6, the node selection parameter value is 0.6.
[0068] For example, if the node selection parameter value is the sum of the primary OSD weight and the current weight coefficient, if the primary OSD weight is 1 and the current weight coefficient is -0.2, the node selection parameter value is 0.8. If the primary OSD weight is 1 and the current weight coefficient is -0.4, the node selection parameter value is 0.6. If the primary OSD weight is 1 and the current weight coefficient is -0.6, the node selection parameter value is 0.4.
[0069] It should be noted that the more the number of master OSDs in a storage node, the greater the master OSD weight of the storage node, the higher the node selection parameter value corresponding to the storage node will be, and the greater the probability of the storage node being selected as the target storage node. It can be seen that a storage node with more master OSDs is more likely to be selected as a target storage node. Since the more master OSDs in a storage node, the less data the master OSD in the storage node needs to forward outward, therefore, selecting a storage node with more master OSDs as the target storage node can effectively reduce the amount of data forwarding across nodes, thereby effectively shortening the IO processing path and reducing latency.
[0070] For example, the number of backup copies of the data to be stored is 100. If the number of master OSDs in the target storage node is 20, the amount of data that the master OSD in the target storage node needs to forward is 80. If the number of master OSDs in the target storage node is 80, the amount of data that the master OSD in the target storage node needs to forward is only 20. Obviously, the more master OSDs in the target storage node, the less data the master OSD in the target storage node needs to forward outward.
[0071] In the above steps 201 to 203, based on the number of master OSDs in the storage node, the master OSD weight corresponding to the storage node is determined, and the current weight coefficient corresponding to the storage node is determined. The current weight coefficient is used to adjust the numerical value of the master OSD weight. Based on the master OSD weight and the current weight coefficient, the node selection parameter value corresponding to the storage node is determined to increase the number of storage nodes with more master OSDs as target storage nodes, thereby improving the localization rate of the master OSD, effectively reducing the amount of data forwarding across nodes and the network transmission of data, shortening the IO processing path and reducing latency.
[0072] In one embodiment, Figure 3 As shown, the step of determining the current weight coefficient corresponding to the storage node in the above step 202 includes one of steps 301 to 303, wherein:
[0073] Step 301: determine a current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node.
[0074] In one embodiment, the current number of AO connections is negatively correlated with the current weight coefficient. The more the current number of AO connections, the smaller the current weight coefficient, and the smaller the weight of the primary OSD. The current number of AO connections is the number of times the storage node is selected as the target storage node of the AO path.
[0075] The above step 301 determines the current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node, and adjusts the numerical value of the main OSD weight based on the current number of AO connections corresponding to the storage node, so as to prevent the data transmission channel from being congested due to too many AO connections of the target storage node, thereby effectively improving the data transmission efficiency and data storage efficiency.
[0076] Step 302, alternatively, based on the idle rate of the front-end service network port corresponding to the storage node, determine the current weight coefficient corresponding to the storage node.
[0077] In one embodiment, the idle rate of the front-end service network port is positively correlated with the current weight coefficient. The higher the idle rate of the front-end service network port, the greater the current weight coefficient, and the greater the weight of the main OSD.
[0078] The above step 302 determines the current weight coefficient corresponding to the storage node based on the idle rate of the front-end business network port corresponding to the storage node, and adjusts the numerical value of the main OSD weight based on the idle rate of the front-end business network port corresponding to the storage node, thereby preferentially selecting the storage node with a higher front-end business network port idle rate as the target storage node, so as to prevent the data transmission channel from being congested due to the target storage node carrying other files and the object storage business being very busy, thereby effectively improving the data transmission efficiency and data storage efficiency.
[0079] Step 303, alternatively, based on the current number of AO connections corresponding to the storage node and the idle rate of the front-end service network port, determine the current weight coefficient corresponding to the storage node.
[0080] In one embodiment, Figure 4 As shown, the step of determining the target storage node from each storage node in the distributed storage system based on the node selection parameter value corresponding to each storage node in the above step 103 specifically includes:
[0081] Step 401: determine the first maximum selected parameter value among the node selected parameter values corresponding to each storage node.
[0082] Step 402: determine the storage node corresponding to the first maximum selected parameter value as the target storage node.
[0083] In the above steps 401 to 402, by determining the first maximum selected parameter value among the node selected parameter values corresponding to each storage node, the storage node corresponding to the first maximum selected parameter value is determined as the target storage node, so as to minimize the data forwarding amount of the main OSD in the target storage node, so as to avoid the problem of excessive data forwarding amount across nodes, thereby effectively shortening the IO processing path and reducing the delay.
[0084] In one embodiment, Figure 5 As shown, the data storage method provided by the present invention also includes:
[0085] Step 501: When it is determined that a connection failure exists in a target storage node, determine the second largest selected parameter value among the node selected parameter values corresponding to each remaining storage node.
[0086] Among them, the second maximum selected parameter value is the second highest selected parameter value among the node selected parameter values corresponding to the original storage nodes (including the original target storage node), and is also the highest selected parameter value among the node selected parameter values corresponding to the remaining storage nodes after eliminating the target storage node with connection failure.
[0087] Step 502: determine the remaining storage nodes corresponding to the second largest selected parameter value as new target storage nodes.
[0088] Further, the acquired data to be stored is transmitted to the master OSD in the new target storage node, so that the master OSD in the new target storage node forwards the data to be stored to the slave OSD.
[0089] In the above steps 501 to 502, when it is determined that there is a connection failure in the target storage node, the second maximum selected parameter value among the node selected parameter values corresponding to each remaining storage node is determined, and the remaining storage nodes corresponding to the second maximum selected parameter value are determined as new target storage nodes. When there is a connection failure in the target storage node, a storage node with the second highest node selected parameter value is selected to establish a new connection, and then data is stored based on the new target storage node, so as to reduce the data forwarding amount of the main OSD in the target storage node, avoid the problem of excessive data forwarding across nodes, and thus shorten the IO processing path and reduce latency.
[0090] In summary, the data storage method provided by the present invention uses the master OSD localization rate (i.e., the number of master OSDs) as an important condition for ALUA's AO path selection, that is, selects a relatively unbusy storage node with the largest number of master OSDs as the target storage node, so as to reduce redundant data transmission and improve business writing performance, thereby avoiding the problem of excessive data forwarding across nodes, thereby shortening the IO processing path, reducing latency, and reducing performance loss caused by network transmission.
[0091] The data storage device provided by the present invention is described below. The data storage device described below and the data storage method described above can be referenced to each other.
[0092] like Figure 6 As shown, the present invention provides a data storage device, the data storage device 100 comprises:
[0093] The data acquisition module 1001 is used to acquire the object storage device OSD distribution data corresponding to each storage node in the distributed storage system. The OSD distribution data includes the number of primary OSDs in the storage node.
[0094] The parameter determination module 1002 is used to determine, for each storage node, a node selection parameter value corresponding to the storage node based on the number of primary OSDs in the storage node.
[0095] The node selection module 1003 is used to determine a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node.
[0096] The data storage module 1004 is used to transmit the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0097] In one embodiment, the parameter determination module 1002 is also used to determine the master OSD weight corresponding to the storage node based on the number of master OSDs in the storage node; determine the current weight coefficient corresponding to the storage node, and the current weight coefficient is used to adjust the numerical value of the master OSD weight; based on the master OSD weight and the current weight coefficient, determine the node selection parameter value corresponding to the storage node.
[0098] In one embodiment, the parameter determination module 1002 is also used to determine the current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node; or, to determine the current weight coefficient corresponding to the storage node based on the idle rate of the front-end business network port corresponding to the storage node; or, to determine the current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node and the idle rate of the front-end business network port.
[0099] In one embodiment, the main OSD weight is positively correlated with the number of main OSDs; the current number of AO connections is negatively correlated with the current weight coefficient; and the front-end service network port idle rate is positively correlated with the current weight coefficient.
[0100] In one embodiment, the node selection module 1003 is further used to determine a first maximum selected parameter value among the node selected parameter values corresponding to each storage node; and determine the storage node corresponding to the first maximum selected parameter value as the target storage node.
[0101] In one embodiment, the node selection module 1003 is also used to determine the second maximum selected parameter value among the node selected parameter values corresponding to each remaining storage node when it is determined that the target storage node has a connection failure; and determine the remaining storage node corresponding to the second maximum selected parameter value as the new target storage node.
[0102] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the data storage method provided by the above methods, the method comprising: obtaining the object storage device OSD distribution data corresponding to each storage node in the distributed storage system, the OSD distribution data including the number of master OSDs in the storage node; for each storage node, based on the number of master OSDs in the storage node, determining the node selection parameter value corresponding to the storage node; based on the node selection parameter value corresponding to each storage node, determining the target storage node from each storage node in the distributed storage system; transmitting the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0103] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0104] On the other hand, the present invention further provides a distributed storage system, comprising: at least one storage node and a controller, wherein: the controller is connected to a client device and each storage node respectively.
[0105] Furthermore, each storage node is connected to the client device via a SCSI (Small Computer System Interface) device or a SCSI bus, wherein the SCSI device may be a SCSI gateway. Figure 8 The example shows a case where each storage node is connected to a client device via a SCSI bus.
[0106] Furthermore, the storage node can be called a storage server or storage service client, or an ISCSI (Internet Small Computer System Interface) target. The client device can be called a storage client, or an ISCSI initiator (full name in English: ISCSI Initiator).
[0107] Furthermore, SCSI is a complete data transmission protocol. Its main function is to transmit requests, status and block data between the host and the storage device. It is also a specification for the interface transmission between a storage device and a client device. The SCSI data transmission protocol is used to realize the communication between the storage service client and the storage client.
[0108] A controller is used to receive data to be stored transmitted by a client device and execute the data storage method provided by the above methods, wherein the method includes: obtaining object storage device OSD distribution data corresponding to each storage node in the distributed storage system, the OSD distribution data including the number of master OSDs in the storage node; for each storage node, based on the number of master OSDs in the storage node, determining the node selection parameter value corresponding to the storage node; based on the node selection parameter value corresponding to each storage node, determining the target storage node from each storage node in the distributed storage system; transmitting the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0109] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data storage method provided by the above methods, which includes: obtaining object storage device OSD distribution data corresponding to each storage node in the distributed storage system, the OSD distribution data including the number of master OSDs in the storage node; for each storage node, based on the number of master OSDs in the storage node, determining the node selection parameter value corresponding to the storage node; based on the node selection parameter value corresponding to each storage node, determining the target storage node from each storage node in the distributed storage system; transmitting the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0110] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the data storage method provided by the above-mentioned methods, the method comprising: obtaining object storage device OSD distribution data corresponding to each storage node in the distributed storage system, the OSD distribution data including the number of master OSDs in the storage node; for each storage node, based on the number of master OSDs in the storage node, determining a node selection parameter value corresponding to the storage node; based on the node selection parameter value corresponding to each storage node, determining a target storage node from each storage node in the distributed storage system; transmitting the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
[0111] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0112] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data storage method, characterized in that: include: Obtain object storage device OSD distribution data corresponding to each storage node in the distributed storage system, wherein the OSD distribution data includes the number of primary OSDs in the storage node; For each of the storage nodes, based on the number of primary OSDs in the storage node, determine a node selection parameter value corresponding to the storage node; Determine a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node; The acquired data to be stored is transmitted to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
2. The data storage method according to claim 1, characterized in that: The determining, based on the number of primary OSDs in the storage node, a node selection parameter value corresponding to the storage node comprises: Determine the primary OSD weight corresponding to the storage node based on the number of primary OSDs in the storage node; Determine a current weight coefficient corresponding to the storage node, where the current weight coefficient is used to adjust the value of the master OSD weight; Based on the primary OSD weight and the current weight coefficient, a node selection parameter value corresponding to the storage node is determined.
3. The data storage method according to claim 2, characterized in that: The determining the current weight coefficient corresponding to the storage node includes: Determine a current weight coefficient corresponding to the storage node based on the current number of AO connections corresponding to the storage node; Alternatively, based on the idle rate of the front-end service network port corresponding to the storage node, determine the current weight coefficient corresponding to the storage node; Alternatively, based on the current number of AO connections corresponding to the storage node and the idle rate of the front-end service network port, the current weight coefficient corresponding to the storage node is determined.
4. The data storage method according to claim 3, characterized in that: The main OSD weight is positively correlated with the number of the main OSDs; the current number of AO connections is negatively correlated with the current weight coefficient; the front-end service network port idle rate is positively correlated with the current weight coefficient.
5. The data storage method according to any one of claims 1 to 4, characterized in that: The step of determining a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node includes: Determine a first maximum selected parameter value among the node selected parameter values corresponding to each of the storage nodes; The storage node corresponding to the first maximum selected parameter value is determined as the target storage node.
6. The data storage method according to claim 5, characterized in that: The method further comprises: In the case where it is determined that the target storage node has a connection failure, determining a second maximum selected parameter value among the node selected parameter values corresponding to each remaining storage node; The remaining storage nodes corresponding to the second maximum selected parameter value are determined as new target storage nodes.
7. A data storage device, characterized in that: include: A data acquisition module, used to acquire object storage device OSD distribution data corresponding to each storage node in the distributed storage system, wherein the OSD distribution data includes the number of primary OSDs in the storage node; A parameter determination module, configured to determine, for each storage node, a node selection parameter value corresponding to the storage node based on the number of primary OSDs in the storage node; A node selection module, configured to determine a target storage node from each storage node in the distributed storage system based on a node selection parameter value corresponding to each storage node; The data storage module is used to transmit the acquired data to be stored to the master OSD in the target storage node, so that the master OSD in the target storage node forwards the data to be stored to the slave OSD.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the data storage method according to any one of claims 1 to 6 is implemented.
9. A distributed storage system, characterized in that: include: At least one storage node and a controller, wherein: the controller is connected to the client device and each of the storage nodes respectively; The controller is used to receive the data to be stored transmitted by the client device and execute the data storage method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data storage method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data distribution storage method and related device
CN109992206A
Resource allocation method and device, monitor and machine readable storage medium
CN110515724A
