Data storage and reading method, device, client, management server and system
By independently determining the target disk for data storage and reading, the client solves the problem of data storage interruption caused by metadata node failure and improves the reliability and efficiency of the system.
Patent Information
- Application Number
- CN201910943958.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-30
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2039-09-30
AI Technical Summary
In the existing distributed storage system, data storage and reading cannot be performed when the metadata node fails, causing the system to crash.
The client independently determines and stores data based on its own saved storage system topology information and target disk selection rules, avoiding reliance on random selection of metadata nodes.
It solves the problem of data storage and reading interruption caused by metadata node failure, improves the reliability and efficiency of the system, and ensures that data can be transferred smoothly when a node fails.
Smart Images

Figure CN112579551B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed data storage, and in particular to a data storage and reading method, device, client, management server and system. Background Art
[0002] In distributed storage, when storing files to be stored, the files to be stored are first divided into multiple data to be stored, where each data to be stored has corresponding identification information; then the storage location corresponding to each data to be stored is determined; and each data to be stored is stored in the corresponding storage location according to the determined storage location to complete the storage of the file.
[0003] See also Figure 1 Based on the topological structure of the existing data storage system, the existing data storage method is usually: the client 101 sends a write request to the metadata node 102; when the metadata node 102 receives the write request, it randomly selects a storage node 103 from the recorded storage nodes 103 as the target storage node, returns the address of the target storage node to the client 101, and records the mapping relationship between the data to be stored and the target storage node; the client 101 sends the data to be stored to the target storage node according to the received address of the target storage node; after the target storage node receives the data to be stored, it selects a disk from the disks it contains as the target disk, and stores the data to be stored in the target disk.
[0004] Correspondingly, based on the network structure of the existing data storage system, the existing data reading method is usually: the client 101 sends a read request to the metadata node 102; when the metadata node 102 receives the read request, it determines the target storage node of the data to be read according to the mapping relationship between the recorded stored data and the target storage node; and returns the address of the target storage node to the client 101; the client 101 sends a request to the target storage node to obtain the data to be read according to the received address of the target storage node; and receives the data to be read returned by the target storage node.
[0005] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems: when storing and reading data, the determination of the target storage node depends on the metadata node. If the metadata node fails, data storage and reading cannot be performed. Summary of the invention
[0006] The purpose of the embodiments of the present invention is to provide a data storage and reading method, device, client, management server and system to solve the problem that metadata nodes fail and data cannot be stored.
[0007] The specific technical solutions are as follows:
[0008] In order to achieve the above-mentioned object, in a first aspect, an embodiment of the present invention provides a data storage method, which is applied to a client in a storage system, wherein the storage system further includes: a management server; the method includes:
[0009] Obtaining data to be stored;
[0010] Determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule saved by itself;
[0011] The data to be stored is stored in the target disk.
[0012] Optionally, the storage system further includes a management server, and the topology information and target disk selection rule of the storage system are pre-acquired and saved from the management server.
[0013] Optionally, before the step of determining the target disk corresponding to the data to be stored according to the topological information of the storage system and the target disk selection rule stored in the storage system, the method further includes:
[0014] Determine whether the topology information of the storage system and the target disk selection rule are stored in the storage system;
[0015] If the topology mapping table of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule stored in the system is performed;
[0016] If the topology information of the storage system and the target disk selection rules are not saved, a request for obtaining the topology information of the storage system and the target disk selection rules is sent to the management server; and the topology information of the storage system and the target disk selection rules returned by the management server are received and saved.
[0017] Optionally, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; and each storage level includes one or more storage entities of the storage level;
[0018] The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain;
[0019] The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises:
[0020] Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level;
[0021] According to the rules for selecting disks from fault domains, a disk is selected from each fault domain as the target disk.
[0022] Optionally, in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity corresponding to the storage level and selection weight information of the storage entity;
[0023] The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises:
[0024] According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities;
[0025] Obtaining an identifier of the data to be stored;
[0026] According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated;
[0027] Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively;
[0028] The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises:
[0029] If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk;
[0030] According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated;
[0031] Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk;
[0032] If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
[0033] Optionally, the multi-layer tree structure includes three layers of nodes; wherein the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node includes: an identifier of a storage node and selection weight information of the storage node; each leaf node includes: an identifier of a disk and selection weight information corresponding to the disk;
[0034] The storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node;
[0035] The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises:
[0036] Determine each storage node as a candidate storage node;
[0037] According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage node, a selection value of each candidate storage node is calculated;
[0038] Obtain candidate storage nodes with the highest selection values for the preset number of storage copies, and use them as fault domain storage nodes respectively;
[0039] The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises:
[0040] Based on the multi-layer tree structure, a disk corresponding to each fault domain storage node is used as a candidate disk;
[0041] According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated;
[0042] The candidate disk with the highest selection value is obtained in each fault domain storage node and used as the target disk.
[0043] In a second aspect, an embodiment of the present invention provides a data storage method, which is applied to a management server in a storage system, wherein the storage system further includes a client; the method includes:
[0044] Receiving a request sent by a client to obtain topology information of a storage system and a target disk selection rule; the request includes identification information of the client;
[0045] The topology information of the storage system and the target disk selection rule are sent to the client according to the client identification information in the request; so that the client can save the topology information of the storage system and the target disk selection rule, and after obtaining the data to be stored, determine the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule saved by itself; and store the data to be stored in the target disk.
[0046] In a third aspect, an embodiment of the present invention provides a data reading method, which is applied to a client in a storage system, and the method includes:
[0047] Obtaining identification information of data to be read;
[0048] Determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule saved by itself;
[0049] The data to be read is obtained from the target disk according to the identification information of the data to be read.
[0050] Optionally, the storage system further includes a management server, and the topology information and target disk selection rule of the storage system are pre-acquired and saved from the management server.
[0051] Optionally, before the step of determining the target disk corresponding to the to-be-read data according to the topological structure information of the storage system and the target disk selection rule stored in the storage system, the method further includes:
[0052] Determine whether the topology information of the storage system and the target disk selection rule are stored in the storage system;
[0053] If the topology information of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be read according to the topology information of the storage system and the target disk selection rule stored in the system is performed;
[0054] If the topology information of the storage system and the target disk selection rules are not saved, a request for obtaining the topology information of the storage system and the target disk selection rules is sent to the management server; and the topology information of the storage system and the target disk selection rules returned by the management server are received and saved.
[0055] Optionally, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; and each storage level includes one or more storage entities of the storage level;
[0056] The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain;
[0057] The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system includes:
[0058] Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level;
[0059] According to the rules for selecting disks from fault domains, a disk is selected from each fault domain as the target disk.
[0060] Optionally, in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity corresponding to the storage level and selection weight information of the storage entity;
[0061] The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises:
[0062] According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities;
[0063] According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated;
[0064] Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively;
[0065] The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises:
[0066] If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk;
[0067] According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated;
[0068] Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk;
[0069] If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
[0070] Optionally, the multi-layer tree structure includes three layers of nodes; wherein the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node includes: an identifier of a storage node and selection weight information of the storage node; each leaf node includes: an identifier of a disk and selection weight information corresponding to the disk;
[0071] The storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node;
[0072] The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises:
[0073] Determine each storage node as a candidate storage node;
[0074] According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage node, a selection value of each candidate storage node is calculated;
[0075] Obtain candidate storage nodes with the highest selection values for the preset number of storage copies, and use them as fault domain storage nodes respectively;
[0076] The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises:
[0077] Based on the multi-layer tree structure, a disk corresponding to each fault domain storage node is used as a candidate disk;
[0078] According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated;
[0079] The candidate disk with the highest selection value is obtained in each fault domain storage node and used as the target disk.
[0080] In a fourth aspect, an embodiment of the present invention provides a data reading method, which is applied to a management server in a storage system, wherein the storage system further includes a client; the method includes:
[0081] Receiving a request sent by a client to obtain a topology structure mapping table and a target disk selection rule of a storage system; the request includes identification information of the client;
[0082] The topological structure information and the target disk selection rule of the storage system are sent to the client according to the client identification information in the request; so that the client can save the topological structure information and the target disk selection rule of the storage system, and after obtaining the data to be read, determine the target disk corresponding to the data to be read according to the topological structure information and the target disk selection rule of the storage system saved by itself; and read the data to be read from the target disk according to the identification information of the data to be read.
[0083] In a fifth aspect, an embodiment of the present invention provides a data storage device, applied to a client in a storage system, the device comprising:
[0084] An acquisition module, used for acquiring data to be stored;
[0085] A determination module, used to determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the module;
[0086] The storage module is used to store the data to be stored in the target disk.
[0087] In a sixth aspect, an embodiment of the present invention provides a data storage device, which is applied to a management server in a storage system, wherein the storage system further includes: a client; the device includes:
[0088] A receiving module, configured to receive a request sent by a client to obtain topology information of a storage system and a target disk selection rule; the request includes identification information of the client;
[0089] A sending module is used to send the topological structure information and target disk selection rules of the storage system to the client according to the client identification information in the request; so that the client can save the topological structure information and target disk selection rules of the storage system, and after obtaining the data to be stored, determine the target disk corresponding to the data to be stored according to the topological structure information and target disk selection rules of the storage system saved by itself; and store the data to be stored in the target disk.
[0090] In a seventh aspect, an embodiment of the present invention provides a data reading device, applied to a client in a storage system, the device comprising:
[0091] An acquisition module, used to obtain identification information of data to be read;
[0092] A determination module, used to determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the module;
[0093] The reading module is used to obtain the data to be read from the target disk according to the identification information of the data to be read.
[0094] In an eighth aspect, an embodiment of the present invention provides a data reading device, which is applied to a management server in a storage system, wherein the storage system further includes: a client; the device includes:
[0095] A receiving module, configured to receive a request sent by a client to obtain a topology structure mapping table of a storage system and a target disk selection rule; the request includes identification information of the client;
[0096] A sending module is used to send the topological structure information of the storage system and the target disk selection rule to the client according to the client identification information in the request; so that the client can save the topological structure information of the storage system and the target disk selection rule, and after obtaining the identification information of the data to be read, determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule saved by itself; and read the data to be read from the target disk according to the identification information of the data to be read.
[0097] In a ninth aspect, an embodiment of the present invention provides a client, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus.
[0098] Memory, used to store computer programs;
[0099] The processor is used to implement all the method steps applied to the client described in the above embodiment when executing the program stored in the memory.
[0100] In a tenth aspect, an embodiment of the present invention provides a management server, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus.
[0101] Memory, used to store computer programs;
[0102] The processor is used to execute all the method steps applied to the management server described in the above embodiments when executing the program stored in the memory.
[0103] In an eleventh aspect, an embodiment of the present invention provides a storage system, comprising: a client, a management server, and one or more storage devices; each of the storage devices comprises a plurality of disks;
[0104] The client is used to: obtain data to be stored; determine the target disk corresponding to the data to be stored based on the topological structure information of the storage system and the target disk selection rule saved by the client; the topological structure information of the storage system and the target disk selection rule are obtained and saved in advance from the management server; store the data to be stored in the target disk; and / or obtain identification information of data to be read; determine the target disk corresponding to the data to be read based on the topological structure information of the storage system and the target disk selection rule saved by the client; the topological structure information of the storage system and the target disk selection rule are obtained and saved in advance from the management server; obtain the data to be read from the target disk based on the identification information of the data to be read;
[0105] The management server is used to: receive a request from a client to obtain topology information of a storage system and a target disk selection rule; and send the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request;
[0106] The disk of each storage device is used for storing data.
[0107] The data storage and reading method, device, client, management server and system provided by the embodiment of the present invention enable the client to obtain the data to be stored; determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule saved by the client; and store the data to be stored in the target disk. It can be seen that when performing data storage in the embodiment of the present invention, the target disk is determined by the client according to the topological structure information of the storage system and the target disk selection rule saved by the client; instead of the metadata node determining the target disk after receiving a request each time as in the prior art, the problem of being unable to perform data storage due to a failure of the metadata node can be avoided.
[0108] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0109] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only 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.
[0110] Figure 1 A schematic diagram of the topological structure of an existing data storage system;
[0111] Figure 2 A schematic diagram of the topological structure of a data storage system provided by an embodiment of the present invention;
[0112] Figure 3a A schematic diagram of a process of applying the data storage method provided in an embodiment of the present invention to a client in a storage system;
[0113] Figure 3b A schematic diagram of a process of determining a fault domain from topology information according to a rule for selecting a fault domain and a preset number of storage copies in a data storage method provided in an embodiment of the present invention;
[0114] Figure 3c A schematic diagram of a process of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain in a data storage method provided by an embodiment of the present invention;
[0115] Figure 4 A tree structure including three layers of nodes constructed according to the topological structure of the storage system provided in the embodiment of the invention;
[0116] Figure 5 Another schematic diagram of a process of applying the data storage method provided in an embodiment of the present invention to a client in a storage system;
[0117] Figure 6 A tree structure including six layers of nodes constructed according to the topological structure of the storage system provided in the embodiment of the invention;
[0118] Figure 7 Another schematic diagram of a process of applying the data storage method provided in an embodiment of the present invention to a client in a storage system;
[0119] Figure 8 A schematic diagram of a flow chart of applying the data storage method provided in an embodiment of the present invention to a management server in a storage system;
[0120] Figure 9a A schematic diagram of a process of applying the data reading method provided by an embodiment of the present invention to a client in a storage system;
[0121] Figure 9b A schematic diagram of a process of determining a fault domain from topology information according to a rule for selecting a fault domain and a preset number of storage copies in a data reading method provided in an embodiment of the present invention;
[0122] Fig.9c A schematic diagram of a flow chart of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain in a data reading method provided by an embodiment of the present invention;
[0123] Fig.10Another schematic diagram of a process of applying the data reading method provided by an embodiment of the present invention to a client in a storage system;
[0124] Fig.11 A schematic diagram of a flow chart of a data reading method provided by an embodiment of the present invention applied to a management server in a storage system;
[0125] Fig.12 A schematic diagram of a structure of a data storage device for a client in a storage system provided by an embodiment of the present invention;
[0126] Fig.13 A structural diagram of a data storage device for a management server in a storage system provided by an embodiment of the present invention
[0127] Fig.14 A schematic diagram of a structure of a data reading device for a client in a storage system provided by an embodiment of the present invention;
[0128] Fig.15 A schematic diagram of a structure of a data reading device applied to a management server in a storage system provided by an embodiment of the present invention;
[0129] Fig.16 A schematic diagram of the structure of a client provided by an embodiment of the present invention;
[0130] Fig.17 A schematic diagram of the structure of a management server provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0131] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0132] In order to solve the problem that metadata nodes fail and data cannot be stored in the prior art, see Figure 2 , an embodiment of the present invention provides a storage system, which may include: a client 201, a management server 202 and one or more storage devices 203; each storage device 203 includes multiple disks;
[0133] The client 201 is used to: obtain data to be stored; determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored by the client; the topological structure information of the storage system and the target disk selection rule are obtained and stored in advance from the management server; store the data to be stored in the target disk; and / or obtain identification information of data to be read; determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored by the client; the topological structure information of the storage system and the target disk selection rule are obtained and stored in advance from the management server; obtain the data to be read from the target disk according to the identification information of the data to be read;
[0134] The management server 202 is used to: receive a request from a client to obtain the topology information of the storage system and the target disk selection rule; and send the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request;
[0135] The disk of each storage device 203 is used to store data.
[0136] Depend on Figure 2 It can be seen from the illustrated embodiment that when the system provided by the embodiment of the present invention stores and reads data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to store and read data due to failure of the metadata node can be avoided.
[0137] based on Figure 2 The storage system shown in the figure, the embodiment of the present invention also provides a data storage method, applied to Figure 2 The client in the storage system shown is shown in Figure 3a , the method may include:
[0138] S301: Obtain data to be stored;
[0139] Wherein, each data to be stored includes corresponding identification information;
[0140] Currently, data is mostly stored in units of data blocks. In this embodiment, the data block to be stored and its identification information may be obtained.
[0141] S302: Determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule saved by itself;
[0142] In a specific embodiment, the topology information of the storage system and the target disk selection rule may be obtained and saved in advance from the management server;
[0143] In a specific embodiment, before the step of determining the target disk corresponding to the data to be stored according to the topological information of the storage system and the target disk selection rule stored in the storage system, the following steps may also be included:
[0144] Determine whether the topology information of the storage system and the target disk selection rules are stored in the storage system;
[0145] If the topology mapping table of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be stored is performed according to the topology information of the storage system and the target disk selection rule stored in the system;
[0146] If the storage system topology information and target disk selection rules are not saved, a request for obtaining the storage system topology information and target disk selection rules is sent to the management server; the storage system topology information and target disk selection rules returned by the management server are received and saved.
[0147] Specifically, the topology information of the storage system may be: a tree structure including multiple layers constructed according to the topology of the storage system; wherein each layer corresponds to a storage level; and each storage level includes one or more storage entities of the storage level.
[0148] The target disk selection rule may include: a rule for selecting a fault domain and a rule for selecting a disk from the fault domain.
[0149] The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system may include:
[0150] Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies; the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: the storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting the preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level;
[0151] According to the rules for selecting disks from fault domains, a disk is selected from each fault domain as the target disk.
[0152] In a specific embodiment, in a multi-layer tree structure, except for the root node, each layer of nodes can contain the identifier of a storage entity of the corresponding storage level and the selection weight information of the storage entity; wherein the selection weight of the node in the previous layer is determined by the selection weight of the node in the next layer it contains. For example, if the nodes in the next layer contained by node A are A'1, A'2, and A'3, then the weight of node A is the sum of the weights of the nodes in the next layer contained by it, A'1, A'2, and A'3.
[0153] See also Figure 3b , according to the rule for selecting the fault domain and the preset number of storage copies, the step of determining the fault domain from the topology information may include:
[0154] S3001: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determine the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities;
[0155] S3002: Obtaining the identification of the data to be stored;
[0156] S3003: Calculate the selection value of each candidate storage entity according to a preset fault domain selection algorithm based on the identifier of the data to be stored and the selection weight information of each candidate storage entity;
[0157] S3004: Obtain candidate storage entities with the highest selection values for a preset number of storage copies, and use them as fault domains respectively.
[0158] See also Figure 3c The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain may include:
[0159] S3101: Determine whether the storage level corresponding to the fault domain is disk level; if the storage level corresponding to the fault domain is non-disk level, execute step S3102: if the storage level corresponding to the fault domain is disk level, execute step S3105;
[0160] S3102: Based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk;
[0161] S3103: Calculate the selection value of each candidate disk according to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk;
[0162] S3104: Obtain candidate disks with the highest selection values in each fault domain and use them as target disks.
[0163] S3105: Determine the disk corresponding to each fault domain as the target disk.
[0164] S303: Storing the data to be stored in the target disk.
[0165] Depend on Figure 3a It can be seen from the illustrated embodiment that, when performing data storage, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to perform data storage due to a failure of the metadata node can be avoided.
[0166] The following two specific examples are given to further illustrate the data storage method provided by the embodiment of the present invention. The data storage method is applied to Figure 2 Clients in the storage system shown.
[0167] Embodiment 1: In this embodiment, the topological structure information of the storage system is as follows: Figure 4 The figure shows: a tree structure containing three layers of nodes constructed according to the topological structure of the storage system; wherein the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node contains: an identifier of a storage node, and selection weight information of the storage node; each leaf node contains: an identifier of a disk, and selection weight information corresponding to the disk.
[0168] In this embodiment, the preset number of storage copies is 3, that is, there are 3 fault domains in this embodiment. A copy of the data to be stored is stored in each fault domain, so that when one fault domain is damaged, the data can be obtained from other undamaged fault domains. Example 1: The fault domain is a storage node, that is, a server host, then the data will be stored in a disk in 3 different servers respectively, for example, in a disk in servers A, B, and C respectively. Example 2: The fault domain is disk Dev, then the data will be stored in 3 different disks in the same storage node respectively.
[0169] See also Figure 5 ,based on Figure 4 The topology information shown, the data storage method includes:
[0170] S501: Obtain data to be stored;
[0171] S502: Determine whether the topology information of the storage system and the target disk selection rule are saved; if the topology information of the storage system and the target disk selection rule are saved, execute step S505; if the topology information of the storage system and the target disk selection rule are not saved, execute step S503;
[0172] S503: Sending a request to the management server to obtain topology information of the storage system and target disk selection rules;
[0173] S504: receiving and saving the topology information of the storage system and the target disk selection rule returned by the management server;
[0174] In this embodiment, the target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from the fault domain; wherein the storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node.
[0175] S505: Determine each storage node as a candidate storage node according to the topology information of the storage system and the target disk selection rule;
[0176] Specifically, each storage node is determined as a candidate storage node according to a storage level corresponding to a fault domain included in a rule for selecting a fault domain;
[0177] In this embodiment, the storage level corresponding to the fault domain included in the rule for selecting the fault domain is the storage node. Therefore, in this step, Figure 4 Each storage node in the shown topology information is determined as a candidate storage node.
[0178] S506: Obtaining the identifier of the data to be stored;
[0179] S507: Calculate the selection value of each candidate storage node according to the preset fault domain selection algorithm in the rule for selecting the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate storage node;
[0180] In a specific embodiment, based on the identification of the data to be stored and the selection weight information of each candidate storage node, the step of calculating the selection value of each candidate storage node may be:
[0181] Using the preset hash function kcsh (ret_bid, weight, random_num), based on the identifier of the data to be stored and the selection weight information of each candidate storage node, the selection value of each candidate storage node is calculated, wherein the parameter ret_bid is the identifier bid of the data to be stored, and the value obtained after calculation by the message digest algorithm (Message Digest Algorithm, MD5) in the hash function; weight is the selection weight of each candidate storage node; random_num is a fixed constant, which is obtained by using a random function. Of course, in other embodiments, random_num can also be obtained by artificial setting. In other embodiments, ret_bid can also be used directly in kcsh instead of ret_bid. In this embodiment, the MD5 algorithm in the hash algorithm is first used to calculate bid to obtain ret_bid, and then ret_bid is used as a parameter in order to reduce the conflict probability of the hash function kcsh and ensure that the amount of data stored in each storage node is balanced; wherein the conflict here refers to the phenomenon that different data to be stored correspond to the same storage location in the hash algorithm.
[0182] Specifically, the process of calculating the selection value of each candidate storage node using the hash function kcsh(ret_bid, weight, random_num) may be:
[0183] For example, the data to be stored is a data block with an offset of 1000 bytes and a length of 100 bytes in the file to be written. The client first calculates the identifier of the data block to be stored using the formula offset / (2*1024*1024) to obtain the bid. In actual applications, the file to be written is usually divided into multiple data blocks according to a preset size unit, and one data block corresponds to one identifier. In this example, the size unit is 2 megabytes, where 1Mbytes=1024*1024bytes.
[0184] The bid is calculated using the MD5 algorithm in the hash function to obtain ret_bid, and the Robert Jenkins hash algorithm in the hash algorithm is used to calculate an x value. In this embodiment, the parameters in the Robert Jenkins hash algorithm are (ret_bid, id, random_num), where the parameter id is the identifier of each candidate storage node.
[0185] Reuse the formula: The selection value of each candidate storage node is calculated. In this formula, the purpose of dividing x by 655350 is to get a number less than 1, and the purpose of taking log() of this number is to get a negative number. In this way, This is equivalent to dividing a negative number by a positive number, which makes the amount of data stored on the storage node positively correlated with the selection weight of the storage node. 655350 is selected because the maximum value of the integer character range in the computer is 655350.
[0186] S508: Obtain three candidate storage nodes with the highest selection values, and use them as fault domain storage nodes respectively;
[0187] S509: Based on the multi-layer tree structure, the disk corresponding to each fault domain storage node is used as a candidate disk;
[0188] S510: Calculate a selection value of each candidate disk according to a rule for selecting a disk from a fault domain in a rule for selecting a fault domain, based on an identifier of the data to be stored and selection weight information of each candidate disk;
[0189] In a specific embodiment, the method of calculating the selection value of each candidate disk based on the identification of the data to be stored and the selection weight information of each candidate disk can be the same as the method of calculating the selection value of each candidate storage node based on the identification of the data to be stored and the selection weight information of each candidate storage node.
[0190] S511: Obtain the candidate disk with the highest selection value in each fault domain storage node and use them as target disks respectively;
[0191] S512: Storing the data to be stored in the target disk.
[0192] In other embodiments, the storage level corresponding to the fault domain included in the rule for selecting the fault domain may also be a disk. Then, after obtaining the data to be stored and the identifier of the data to be stored; determine the disk corresponding to each fault domain as the target disk; calculate the selection value of each candidate disk according to the preset fault domain selection algorithm based on the identifier of the data to be stored and the selection weight information of each candidate disk; obtain the candidate disks with the highest selection value for the preset number of storage copies, respectively as the fault domains, that is, obtain the candidate disks with the highest selection value for the preset number of storage copies as the target disks.
[0193] Embodiment 2: In this embodiment, the topological structure information of the storage system can also be as follows: Figure 6The tree structure with six layers of nodes is shown as follows: the first layer node is the root node, which corresponds to the storage system; the second layer node, that is, each child node connected to the root node, corresponds to the data center; the third layer node corresponds to the cabinet; the fourth layer node corresponds to the rack; the fifth layer node corresponds to the storage node; the sixth layer node, that is, the leaf node, corresponds to the disk; each child node contains: a node identifier and the selection weight information of the node; each leaf node contains: a disk identifier and the selection weight information corresponding to the disk. In practical applications, a data center can also be called a computer room, where multiple cabinets can be placed in a computer room, a cabinet can contain multiple racks, and a rack can place one or more storage nodes.
[0194] In this embodiment, the preset number of stored copies is 3.
[0195] See also Figure 7 ,based on Figure 6 The topological structure information shown, the data storage method may include:
[0196] S701: Obtain data to be stored;
[0197] S702: Determine whether the topology information of the storage system and the target disk selection rule are saved; if the topology information of the storage system and the target disk selection rule are saved, execute step S705; if the topology information of the storage system and the target disk selection rule are not saved, execute step S703;
[0198] S703: Sending a request to the management server to obtain topology information of the storage system and target disk selection rules;
[0199] S704: Receive and save the topology information of the storage system and the target disk selection rule returned by the management server;
[0200] In this embodiment, the target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from the fault domain; wherein the storage level corresponding to the fault domain included in the rule for selecting the fault domain is a rack.
[0201] S705: Determine each rack as a candidate rack according to the topology information of the storage system and the target disk selection rule;
[0202] Specifically, each rack is determined as a candidate storage node according to the storage level corresponding to the fault domain included in the rule for selecting the fault domain;
[0203] In this embodiment, the storage level corresponding to the fault domain included in the rule for selecting the fault domain is the rack. Therefore, in this step, Figure 6 Each rack in the shown topology information is determined as a candidate storage node.
[0204] S706: Obtaining the identifier of the data to be stored;
[0205] S707: Calculate the selection value of each candidate rack according to the preset fault domain selection algorithm in the rule for selecting the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate rack;
[0206] Specifically, the selection value of each candidate rack may be calculated based on the identifier of the data to be stored and the selection weight information of each candidate rack by using a preset hash function kcsh (ret_bid, weight, random_num).
[0207] S708: Obtain three candidate racks with the highest selection values and use them as fault domains respectively;
[0208] S709: Based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk;
[0209] Specifically, it can be Figure 6 All disks of all storage nodes contained in each fault domain in the topology information shown are candidate disks. For example, if the fault domains are rack 1, rack 2, and rack 3, Figure 6 In the topology information shown, the storage nodes contained under racks 1 to 3 are storage nodes 11 and 12, storage nodes 21 and 22, and storage nodes 31 and 32 respectively; the disks contained in storage nodes 11, 12, 21, 22, 31 and 32 are respectively 111-115, 121-125, 211-215, 221-225, 311-315 and 321-325; therefore, disks 111-115, 121-125, 211-215, 221-225, 311-315 and 321-325 are selected as candidate disks.
[0210] S710: Calculate a selection value of each candidate disk according to a rule for selecting a disk from a fault domain in a rule for selecting a fault domain, based on an identifier of the data to be stored and selection weight information of each candidate disk;
[0211] Specifically, the preset hash function kcsh(ret_bid, weight, random_num) can be first used to calculate the selection value of each storage node based on the identification of the data to be stored and the selection weight information of all storage nodes in the fault domain; the three storage nodes with the highest selection values are obtained as the target storage nodes respectively; and then the preset hash function kcsh(ret_bid, weight, random_num) can be used to calculate the selection value of each disk based on the identification of the data to be stored and the selection weight information of all disks in the target storage node.
[0212] S711: Obtain candidate disks with the highest selection values in each fault domain and use them as target disks.
[0213] S712: storing the data to be stored in the target disk;
[0214] Depend on Figure 5 and Figure 7 It can be seen from the illustrated embodiment that, when performing data storage, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to perform data storage due to a failure of the metadata node can be avoided.
[0215] In addition, when storing data, the embodiment of the present invention is that the client directly determines the target storage node and then sends the data to the target storage node, without the need to interact with the metadata node, thereby improving the efficiency of storing data.
[0216] The method provided by the embodiment of the present invention only needs to migrate the data on a certain node to other nodes when a node goes offline. Since the method provided by the embodiment of the present invention selects the target disk according to the selection value of each disk when selecting the target disk, and the data storage capacity of the node is taken into account when calculating the selection value, the data storage capacity of each disk can be balanced. Compared with the method of randomly selecting the target storage node by the metadata node in the prior art, the data storage capacity between the nodes in the storage system can be balanced.
[0217] The present invention also provides a data storage method, which is applied to Figure 2 The management server in the storage system shown is shown in Figure 8 , the method comprising:
[0218] S801: receiving a request sent by a client to obtain topology information of a storage system and a target disk selection rule; the request includes identification information of the client;
[0219] S802: Send the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request; enable the client to save the topology information of the storage system and the target disk selection rule, and after obtaining the data to be stored, determine the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule saved by itself; and store the data to be stored in the target disk.
[0220] Depend on Figure 8 It can be seen from the illustrated embodiment that when the client in the embodiment of the present invention stores data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to store data due to failure of the metadata node can be avoided.
[0221] The embodiment of the present invention corresponding to the data storage method also provides a data reading method, which is applied to Figure 2 The client in the storage system shown is shown in Figure 9a , the method comprising:
[0222] S901: Obtain identification information of data to be read;
[0223] S902: Determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule saved by itself; the topological structure information of the storage system and the target disk selection rule are obtained and saved in advance from the management server;
[0224] Specifically, before the step of determining the target disk corresponding to the to-be-read data according to the topological structure information of the storage system and the target disk selection rule stored in the storage system, the following steps may also be included:
[0225] Determine whether the topology information of the storage system and the target disk selection rules are stored in the storage system;
[0226] If the topology information of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be read is performed according to the topology information of the storage system and the target disk selection rule stored in the system;
[0227] If the storage system topology information and target disk selection rules are not saved, a request for obtaining the storage system topology information and target disk selection rules is sent to the management server; the storage system topology information and target disk selection rules returned by the management server are received and saved.
[0228] In a specific embodiment, the topology information of the storage system may be: a tree structure including multiple layers constructed according to the topology of the storage system; wherein each layer corresponds to a storage level; and each storage level includes one or more storage entities of the storage level.
[0229] The target disk selection rule may include: a rule for selecting a fault domain and a rule for selecting a disk from the fault domain.
[0230] The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system may include:
[0231] Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies; the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: the storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting the preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level;
[0232] According to the rules for selecting disks from fault domains, a disk is selected from each fault domain as the target disk.
[0233] In a specific embodiment, in a multi-layer tree structure, except for the root node, each layer of nodes may include an identifier of a storage entity corresponding to a storage level, and selection weight information of the storage entity;
[0234] See also Figure 9b , according to the rule for selecting the fault domain and the preset number of storage copies, the step of determining the fault domain from the topology information may include:
[0235] S9001: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determine the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities;
[0236] S9002: Calculate the selection value of each candidate storage entity according to a preset fault domain selection algorithm based on the identifier of the data to be read and the selection weight information of each candidate storage entity;
[0237] S9003: Obtain candidate storage entities with the highest selection values for a preset number of storage copies, and use them as fault domains respectively.
[0238] See also Fig.9c The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain may include:
[0239] S9101: Determine whether the storage level corresponding to the fault domain is the disk level; if the storage level corresponding to the fault domain is the non-disk level, execute step S9102; if the storage level corresponding to the fault domain is the disk level, execute step S9105;
[0240] S9102: Based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk;
[0241] S9103: Calculate a selection value of each candidate disk according to a rule for selecting a disk from a fault domain, based on an identifier of the data to be read and selection weight information of each candidate disk;
[0242] S9104: Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk;
[0243] S9105: Determine the disk corresponding to each fault domain as the target disk.
[0244] S903: Obtain the data to be read from the target disk according to the identification information of the data to be read.
[0245] Specifically, a target disk may be selected from the determined target disks as the target disk for obtaining the data to be read; for example, a target disk with the largest selection value is selected from the determined target disks as the target disk for obtaining the data to be read;
[0246] The data to be read is obtained from the target disk for obtaining the data to be read according to the identification information of the data to be read.
[0247] In some embodiments, when storing data, the client may record the correspondence between the data identifier and the target disk in a database. When reading data, the target disk is determined from the record information in the database according to the data identifier, and then the data is read from the target disk.
[0248] Depend on Figure 9a It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to read data due to a failure of the metadata node can be avoided.
[0249] The following is a specific example to further illustrate the data reading method provided by the embodiment of the present invention. The data reading method is applied to Figure 2 Clients in the storage system shown.
[0250] In this embodiment, the topological structure information of the storage system is as follows: Figure 4 The figure shows: a tree structure containing three layers of nodes constructed according to the topological structure of the storage system; wherein the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node contains: an identifier of a storage node, and selection weight information of the storage node; each leaf node contains: an identifier of a disk, and selection weight information corresponding to the disk.
[0251] In this embodiment, the preset number of stored copies is 3.
[0252] See also Fig.10 In this embodiment, the data reading method may include:
[0253] S1001: Obtain identification information of data to be read;
[0254] S1002: Determine whether the topology information of the storage system and the target disk selection rule are saved; if the topology information of the storage system and the target disk selection rule are saved, execute step S1005; if the topology information of the storage system and the target disk selection rule are not saved, execute step S1003;
[0255] S1003: Sending a request to the management server to obtain topology information of the storage system and target disk selection rules;
[0256] S1004: receiving and saving the topology information of the storage system and the target disk selection rule returned by the management server;
[0257] In this embodiment, the target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from the fault domain; wherein the storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node.
[0258] S1005: Determine each storage node as a candidate storage node according to the topology information of the storage system and the target disk selection rule;
[0259] Specifically, each storage node is determined as a candidate storage node according to a storage level corresponding to a fault domain included in a rule for selecting a fault domain;
[0260] In this embodiment, the storage level corresponding to the fault domain included in the rule for selecting the fault domain is the storage node. Therefore, in this step, Figure 4 Each storage node in the shown topology information is determined as a candidate storage node.
[0261] S1006: Calculate the selection value of each candidate storage node according to the preset fault domain selection algorithm in the rule for selecting the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate storage node;
[0262] In a specific embodiment, the method of calculating the selection value of each candidate storage node based on the identification of the data to be read and the selection weight information of each candidate storage node can be the same as the method of calculating the selection value of each candidate storage node based on the identification of the data to be accessed and the selection weight information of each candidate storage node.
[0263] S1007: Obtain candidate storage nodes with the highest selection values for a preset number of storage copies, and use them as fault domain storage nodes respectively;
[0264] S1008: Based on the multi-layer tree structure, the disk corresponding to each fault domain storage node is used as a candidate disk;
[0265] S1009: Calculate the selection value of each candidate disk according to the rule for selecting a disk from a fault domain in the rule for selecting a fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk;
[0266] In a specific embodiment, the method of calculating the selection value of each candidate disk based on the identification of the data to be read and the selection weight information of each candidate disk can be the same as the method of calculating the selection value of each candidate storage node based on the identification of the data to be read and the selection weight information of each candidate storage node.
[0267] S1010: Obtain candidate disks with the highest selection values in each fault domain storage node and use them as target disks;
[0268] S1011: Selecting a target disk from the determined target disks as a target disk for obtaining data to be read;
[0269] S1012: Obtain the data to be read from the target disk for obtaining the data to be read according to the identification information of the data to be read.
[0270] In other embodiments, the storage level corresponding to the fault domain included in the rule for selecting the fault domain may also be a disk. Then, after obtaining the data to be read and the identifier of the data to be read; determine the disk corresponding to each fault domain as the target disk; calculate the selection value of each candidate disk according to the preset fault domain selection algorithm based on the identifier of the data to be read and the selection weight information of each candidate disk; obtain the candidate disks with the highest selection value of the preset storage copies as the fault domains, that is, obtain the candidate disks with the highest selection value of the preset storage copies as the target disks.
[0271] Depend on Fig.10 It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to read data due to a failure of the metadata node can be avoided.
[0272] In addition, when reading data, the embodiment of the present invention allows the client to directly determine the target storage node and obtain data directly from the target storage node without interacting with the metadata node, thereby improving the efficiency of storage reading.
[0273] The present invention also provides a data reading method, which is applied to Figure 2 The management server in the storage system shown is shown in Fig.11 , the method comprising:
[0274] S1101: receiving a request sent by a client to obtain a topology structure mapping table and a target disk selection rule of a storage system; the request includes identification information of the client;
[0275] S1102: Send the topology information of the storage system and the target disk selection rules to the client according to the client identification information in the request; so that the client can save the topology information of the storage system and the target disk selection rules, and after obtaining the data to be read, determine the target disk corresponding to the data to be read according to the topology information of the storage system and the target disk selection rules saved by itself; and read the data to be read from the target disk according to the identification information of the data to be read.
[0276] Depend on Fig.11 It can be seen from the illustrated embodiment that when the client in the embodiment of the present invention reads data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to read data due to a failure of the metadata node can be avoided.
[0277] and Figure 3a Corresponding to the embodiment shown, the embodiment of the present invention also provides a data storage device, which is applied to Figure 2 The client in the storage system shown, see Fig.12 , the device may include:
[0278] An acquisition module 1201 is used to obtain data to be stored;
[0279] The determination module 1202 is used to determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the module;
[0280] The storage module 1203 is used to store the data to be stored in the target disk.
[0281] Depend on Fig.12 As can be seen from the illustrated embodiment, when performing data storage, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself, rather than by the metadata node as in the prior art. Therefore, the problem of being unable to perform data storage due to a metadata node failure can be avoided.
[0282] and Figure 8 Corresponding to the embodiment shown, the embodiment of the present invention also provides a storage device, which is applied to Figure 2 Management server in the storage system shown, see Fig.13 , the device may include:
[0283] The receiving module 1301 is used to receive a request sent by a client to obtain the topology information of the storage system and the target disk selection rule; the request includes the identification information of the client;
[0284] The sending module 1302 is used to send the topological structure information of the storage system and the target disk selection rules to the client according to the client identification information in the request; so that the client can save the topological structure information of the storage system and the target disk selection rules, and after obtaining the data to be stored, determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rules saved by itself; and store the data to be stored to the target disk.
[0285] Depend on Fig.13 It can be seen from the illustrated embodiment that, when performing data storage, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to perform data storage due to a failure of the metadata node can be avoided.
[0286] and Figure 9a Corresponding to the embodiment shown, the embodiment of the present invention also provides a storage device for reading Figure 2 The client in the storage system shown, see Fig.14 , the device may include:
[0287] An acquisition module 1401 is used to obtain identification information of data to be read;
[0288] The determination module 1402 is used to determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the module;
[0289] The reading module 1403 is used to obtain the data to be read from the target disk according to the identification information of the data to be read.
[0290] Depend on Fig.14 It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to read data due to a failure of the metadata node can be avoided.
[0291] and Fig.11 Corresponding to the embodiment shown, the embodiment of the present invention also provides a storage reading device, which is applied to Figure 2 Management server in the storage system shown, see Fig.15 , the device may include:
[0292] The receiving module 1501 is used to receive a request sent by a client to obtain a topology structure mapping table of a storage system and a target disk selection rule; the request includes identification information of the client;
[0293] The sending module 1502 is used to send the topological structure information of the storage system and the target disk selection rules to the client according to the client identification information in the request; so that the client can save the topological structure information of the storage system and the target disk selection rules, and after obtaining the identification information of the data to be read, determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rules saved by itself; and read the data to be read from the target disk according to the identification information of the data to be read.
[0294] Depend on Fig.15 It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to read data due to a failure of the metadata node can be avoided.
[0295] The embodiment of the present invention also provides a client, such as Fig.16 As shown, it 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.
[0296] Memory 1603, used for storing computer programs;
[0297] The processor 1601 is used to implement all the method steps applied to the client described in the above embodiment when executing the program stored in the memory 1603.
[0298] Depend on Fig.16 It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when storing and reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to store and read data due to failure of the metadata node can be avoided.
[0299] The embodiment of the present invention also provides a management server, such as Fig.17 As shown, it 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.
[0300] Memory 1703, used for storing computer programs;
[0301] The processor 1701 is used to execute all the method steps applied to the management server described in the above embodiments when executing the program stored in the memory 1703.
[0302] Depend on Fig.17 It can be seen from the illustrated embodiment that, in the embodiment of the present invention, when storing and reading data, the target disk is determined by the client based on the topological structure information of the storage system and the target disk selection rules saved by the client itself; instead of the metadata node determining the target disk after each request is received as in the prior art. Therefore, the problem of being unable to store and read data due to failure of the metadata node can be avoided.
[0303] 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 ease 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.
[0304] The communication interface is used for communication between the above electronic device and other devices.
[0305] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0306] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0307] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned data storage and / or data reading methods are implemented.
[0308] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the data storage and / or data reading methods in the above embodiments.
[0309] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0310] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0311] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0312] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A data storage method, characterized in that: Applied to a client in a storage system, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include the identification of a storage entity of the corresponding storage level and the selection weight information of the storage entity; The method comprises: Obtaining data to be stored; Determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule saved by itself; storing the data to be stored in the target disk; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; Obtaining an identifier of the data to be stored; According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
2. The method according to claim 1, characterized in that The storage system further includes a management server, and the topology information and target disk selection rules of the storage system are pre-acquired and stored from the management server.
3. The method according to claim 2, characterized in that Before the step of determining the target disk corresponding to the data to be stored according to the topological information of the storage system and the target disk selection rule stored in the storage system, the method further includes: Determine whether the topology information of the storage system and the target disk selection rule are stored in the storage system; If the topology mapping table of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule stored in the system is performed; If the topology information of the storage system and the target disk selection rule are not saved by the system itself, a request for obtaining the topology information of the storage system and the target disk selection rule is sent to the management server; Receive and save the topology information of the storage system and the target disk selection rule returned by the management server.
4. The method according to claim 1, characterized in that: The multi-layer tree structure includes three layers of nodes; the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node includes: an identifier of a storage node and selection weight information of the storage node; each leaf node includes: an identifier of a disk and selection weight information corresponding to the disk; The storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: Determine each storage node as a candidate storage node; According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage node, a selection value of each candidate storage node is calculated; Obtain candidate storage nodes with the highest selection values for the preset number of storage copies, and use them as fault domain storage nodes respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: Based on the multi-layer tree structure, a disk corresponding to each fault domain storage node is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; The candidate disk with the highest selection value is obtained in each fault domain storage node and used as the target disk.
5. A data storage method, characterized in that: A management server applied to a storage system, the storage system further comprising: a client; the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity of the corresponding storage level, and selection weight information of the storage entity; The method comprises: Receiving a request sent by a client to obtain topology information of a storage system and a target disk selection rule; the request includes identification information of the client; According to the client identification information in the request, the topology information of the storage system and the target disk selection rule are sent to the client; so that the client saves the topology information of the storage system and the target disk selection rule, and after obtaining the data to be stored, determines the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule saved by the client; and stores the data to be stored in the target disk; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; Obtaining an identifier of the data to be stored; According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
6. A data reading method, characterized in that: Applied to a client in a storage system, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include the identification of a storage entity of the corresponding storage level and the selection weight information of the storage entity; The method comprises: Obtaining identification information of data to be read; Determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule saved by itself; Obtaining the data to be read from the target disk according to identification information of the data to be read; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system includes: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
7. The method according to claim 6, characterized in that The storage system further includes a management server, and the topology information and target disk selection rules of the storage system are pre-acquired and stored from the management server.
8. The method according to claim 7, characterized in that Before the step of determining the target disk corresponding to the to-be-read data according to the topological structure information of the storage system and the target disk selection rule stored in the storage system, the method further includes: Determine whether the topology information of the storage system and the target disk selection rule are stored in the storage system; If the topology information of the storage system and the target disk selection rule are stored in the system, the step of determining the target disk corresponding to the data to be read according to the topology information of the storage system and the target disk selection rule stored in the system is performed; If the topology information of the storage system and the target disk selection rules are not saved, a request for obtaining the topology information of the storage system and the target disk selection rules is sent to the management server; and the topology information of the storage system and the target disk selection rules returned by the management server are received and saved.
9. The method according to claim 6, characterized in that The multi-layer tree structure includes three layers of nodes; the root node corresponds to the storage system; each child node connected to the root node corresponds to a storage node; the leaf node of each child node corresponds to a disk of the storage node corresponding to the child node; each child node includes: an identifier of a storage node and selection weight information of the storage node; each leaf node includes: an identifier of a disk and selection weight information corresponding to the disk; The storage level corresponding to the fault domain included in the rule for selecting the fault domain is a storage node; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: Determine each storage node as a candidate storage node; According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage node, a selection value of each candidate storage node is calculated; Obtain candidate storage nodes with the highest selection values for the preset number of storage copies, and use them as fault domain storage nodes respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: Based on the multi-layer tree structure, a disk corresponding to each fault domain storage node is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; The candidate disk with the highest selection value is obtained in each fault domain storage node and used as the target disk.
10. A data reading method, characterized in that: A management server applied to a storage system, the storage system further comprising: a client; the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity of the corresponding storage level, and selection weight information of the storage entity; The method comprises: Receiving a request sent by a client to obtain a topology structure mapping table and a target disk selection rule of a storage system; the request includes identification information of the client; According to the client identification information in the request, the topology information of the storage system and the target disk selection rule are sent to the client; so that the client saves the topology information of the storage system and the target disk selection rule, and after obtaining the data to be read, determines the target disk corresponding to the data to be read according to the topology information of the storage system and the target disk selection rule saved by the client; and reads the data to be read from the target disk according to the identification information of the data to be read; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system includes: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
11. A data storage device, characterized in that: Applied to a client in a storage system, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include the identification of a storage entity of the corresponding storage level and the selection weight information of the storage entity; The device comprises: An acquisition module, used for acquiring data to be stored; A determination module, used to determine the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the module; A storage module, used for storing the data to be stored in the target disk; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; Obtaining an identifier of the data to be stored; According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
12. A data storage device, characterized in that: A management server applied to a storage system, the storage system further comprising: a client; the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity of the corresponding storage level, and selection weight information of the storage entity; The device comprises: A receiving module, configured to receive a request sent by a client to obtain topology information of a storage system and a target disk selection rule; the request includes identification information of the client; A sending module, used for sending the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request; so that the client can save the topology information of the storage system and the target disk selection rule, and after obtaining the data to be stored, determine the target disk corresponding to the data to be stored according to the topology information of the storage system and the target disk selection rule saved by itself; and store the data to be stored in the target disk; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; Obtaining an identifier of the data to be stored; According to a preset fault domain selection algorithm, based on the identifier of the data to be stored and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
13. A data reading device, characterized in that: Applied to a client in a storage system, the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include the identification of a storage entity of the corresponding storage level and the selection weight information of the storage entity; The device comprises: An acquisition module, used to obtain identification information of data to be read; A determination module, used to determine the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the module; A reading module, used for obtaining the data to be read from the target disk according to the identification information of the data to be read; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system includes: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
14. A data reading device, characterized in that: A management server applied to a storage system, the storage system further comprising: a client; the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include an identifier of a storage entity of the corresponding storage level, and selection weight information of the storage entity; The device comprises: A receiving module, configured to receive a request sent by a client to obtain a topology structure mapping table of a storage system and a target disk selection rule; the request includes identification information of the client; A sending module, used for sending the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request; so that the client can save the topology information of the storage system and the target disk selection rule, and after obtaining the identification information of the data to be read, determine the target disk corresponding to the data to be read according to the topology information of the storage system and the target disk selection rule saved by itself; and read the data to be read from the target disk according to the identification information of the data to be read; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be read according to the topological structure information of the storage system and the target disk selection rule stored in the storage system includes: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; According to a preset fault domain selection algorithm, based on the identifier of the to-be-read data and the selection weight information of each candidate storage entity, a selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, a selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
15. A client, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method described in any one of claims 1-4 or 6-9 when executing a program stored in a memory.
16. A management server, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method described in any one of claims 5 or 10 when executing a program stored in a memory.
17. A storage system, characterized in that: include: A client, a management server and one or more storage devices; each storage device includes multiple disks; the topological structure information of the storage system is: a tree structure including multiple layers constructed according to the topological structure of the storage system; wherein each layer corresponds to a storage level; each storage level includes one or more storage entities of the storage level; in the multi-layer tree structure, except for the root node, the nodes of each layer include the identification of a storage entity of the corresponding storage level and the selection weight information of the storage entity; The client is used to: obtain data to be stored; determine the target disk corresponding to the data to be stored based on the topological structure information of the storage system and the target disk selection rule saved by the client; the topological structure information of the storage system and the target disk selection rule are obtained and saved in advance from the management server; store the data to be stored in the target disk; and / or obtain identification information of data to be read; determine the target disk corresponding to the data to be read based on the topological structure information of the storage system and the target disk selection rule saved by the client; the topological structure information of the storage system and the target disk selection rule are obtained and saved in advance from the management server; obtain the data to be read from the target disk based on the identification information of the data to be read; The management server is used to: receive a request from a client to obtain topology information of a storage system and a target disk selection rule; and send the topology information of the storage system and the target disk selection rule to the client according to the client identification information in the request; The disk of each storage device is used to: store data; The target disk selection rule includes: a rule for selecting a fault domain and a rule for selecting a disk from a fault domain; The step of determining the target disk corresponding to the data to be stored according to the topological structure information of the storage system and the target disk selection rule stored in the storage system comprises: Determine the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies, wherein the number of the fault domains is the same as the number of the preset number of storage copies; the rule for selecting the fault domain includes: a storage level corresponding to the fault domain, and a preset fault domain selection algorithm for selecting a preset number of storage copies of target storage entities as the fault domain from the storage entities included in the storage level; According to the rules for selecting disks from the fault domains, a disk is selected from each fault domain as the target disk; The step of determining the fault domain from the topology information according to the rule for selecting the fault domain and the preset number of storage copies comprises: According to the storage level corresponding to the fault domain included in the rule for selecting the fault domain, determining the storage entities corresponding to each node of the layer corresponding to the storage level as candidate storage entities; According to a preset fault domain selection algorithm, based on the identification of the data to be read and the selection weight information of each candidate storage entity, the selection value of each candidate storage entity is calculated; or the identification of the data to be stored is obtained; according to a preset fault domain selection algorithm, based on the identification of the data to be stored and the selection weight information of each candidate storage entity, the selection value of each candidate storage entity is calculated; Obtain candidate storage entities with the highest selection values for the preset number of storage copies, and use them as fault domains respectively; The step of selecting a disk from each fault domain as a target disk according to a rule for selecting a disk from a fault domain comprises: If the storage level corresponding to the fault domain is a non-disk level, based on the multi-layer tree structure, the disk corresponding to each fault domain is used as a candidate disk; According to the rule for selecting a disk from the fault domain, based on the identifier of the data to be read and the selection weight information of each candidate disk, the selection value of each candidate disk is calculated; or, according to the rule for selecting a disk from the fault domain, based on the identifier of the data to be stored and the selection weight information of each candidate disk, the selection value of each candidate disk is calculated; Obtain the candidate disk with the highest selection value in each fault domain and use them as the target disk; If the storage level corresponding to the fault domain is a disk level, then the disk corresponding to each fault domain is determined as a target disk.
Citation Information
Patent Citations
Distributed file system and data equilibrium distribution method orienting same
CN105912612A
Improved data distribution method and system for distributed storage systems
CN108491478A
Distributed data redundancy storage method based on consistent Hash algorithm
CN110169008A
Distributed data storage method and system based on multilayer consistent hashing
CN110169040A
Data analytics platform over parallel databases and distributed file systems
US20140244701A1
