A data storage method and device, electronic equipment and storage medium
By creating replica objects and replica sub-objects in storage nodes, matching the data to be stored using the replica number, storing the target replica sub-object in the cache module, and storing the non-target replica sub-object in the disk module, and setting weight thresholds to optimize cache utilization, combined with data splitting and weight management, the problem of redundant data occupying cache resources is solved, and efficient data storage and retrieval are achieved.
Patent Information
- Application Number
- CN202211129755.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-16
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-09-16
AI Technical Summary
In distributed storage systems, redundant data consumes cache resources, resulting in wasted cache space and long response times for read and write interfaces.
By creating replica objects and replica sub-objects in storage nodes, matching the data to be stored using replica numbers, storing the target replica sub-object in the cache module, and storing the non-target replica sub-object in the disk module, setting weight thresholds to optimize cache utilization, and combining data splitting and weight management, asynchronous storage and precise storage are achieved.
It effectively avoids wasting cache resources, improves data storage and retrieval efficiency, ensures data integrity, and reduces the waste of cache resources.
Smart Images

Figure CN115454344B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage, and more particularly to a data storage method, apparatus, electronic device, and storage medium. Background Technology
[0002] To ensure data availability, distributed storage systems typically employ a replication model for redundant data storage, meaning that the same data is stored in multiple copies to achieve data backup.
[0003] To reduce the response time of read and write interfaces, caches are usually deployed on storage nodes. Data to be stored is stored to the hard disk through the cache. Obviously, in replica mode, a copy of data to be stored needs to be written to the caches of multiple storage nodes.
[0004] However, in the above data storage method, the same storage data is stored in the cache of each storage node. In fact, one copy of the storage data can meet the reading and calling needs of the management node. The existence of the above redundant data occupies a large amount of storage space in the cache, which greatly wastes cache resources. Summary of the Invention
[0005] This invention provides a data storage method and apparatus to solve the problem of redundant data consuming excessive cache resources.
[0006] According to one aspect of the present invention, a data storage method is provided, applied to a storage node in a distributed storage system, comprising:
[0007] In response to receiving an object creation instruction sent by the management node, a replica object is created according to the obtained replica number, and replica sub-objects are created in the replica object according to the obtained replica quantity;
[0008] The replica object stores the data to be stored sent by the management node, so that each replica sub-object in the replica object is matched one by one with each sub-data to be stored in the data to be stored;
[0009] Based on the replica number, a target replica sub-object is determined among each of the replica sub-objects, and the sub-data to be stored in the target replica sub-object is stored in the cache module, while the sub-data to be stored in the non-target replica sub-objects is stored in the hard disk module.
[0010] According to the copy number, the target copy sub-object is determined in each copy sub-object, and the method further comprises: storing the to-be-stored data in the copy object to a cache module, and copying the to-be-stored data to a hard disk module through the cache module; in the cache module, the to-be-stored sub-data corresponding to the target copy sub-object is continuously stored, and the to-be-stored sub-data corresponding to a non-target copy sub-object is deleted. The cache module of the storage node does not include duplicate data, which avoids wasting of cache resources in the distributed storage system, and realizes asynchronous storage of data and improves data storage efficiency.
[0011] After the to-be-stored data sent by the management node is saved in the copy object, so that each copy sub-object in the copy object is matched with each to-be-stored sub-data in the to-be-stored data, the method further comprises: setting a weight for each copy sub-object according to a correction coefficient, the copy number, the copy number and the copy sub-number of each copy sub-object; the target copy sub-object is determined in each copy sub-object according to the copy number, which comprises: determining the target copy sub-object in each copy sub-object according to the weight of each copy sub-object and a preset weight threshold; if the weight of the current copy sub-object is greater than or equal to the preset weight threshold, the current copy sub-object is the target copy sub-object; if the weight of the current copy sub-object is less than the preset weight threshold, the current copy sub-object is a non-target copy sub-object; the preset weight threshold is related to the remaining storage capacity of the cache module. The storage node sets the weight for the copy sub-objects in the current copy object, so that when the remaining storage space in the cache module is large, a large number of to-be-stored sub-data are stored in the cache module, the characteristics of the cache module that the read-write speed is fast are fully utilized, and fast writing and reading of data are realized; when the remaining storage space in the cache module is small, only a small number of to-be-stored sub-data are stored in the cache module, so as to realize accurate storage of data, reduce waste of cache resources, and still ensure the integrity of the current to-be-stored data in the cache module of the distributed storage system.
[0012] The data storage method further comprises: in response to detecting that the remaining storage capacity of the cache module is less than or equal to a first storage threshold, obtaining the weight corresponding to each stored data in the cache module; according to the sorting result of the weight of each stored data, sequentially deleting a target stored data with the lowest weight until the remaining storage capacity of the cache module is greater than or equal to a second storage threshold; and the second storage threshold is greater than the first storage threshold. Through the weight corresponding to each stored data, not only the importance comparison between each sub-data in the same data is realized, but also the importance comparison between each sub-data in different data is realized. Compared with the prior art in which the storage node can only rely on the existing cache eviction algorithm to perform cache eviction based on the data record of the single storage node itself, the above technical solution is based on the overall storage of the distributed storage system, and each replica sub-object is allocated a corresponding weight, which more accurately reflects the importance of each stored data and improves the accuracy of the cache eviction result.
[0013] According to another aspect of the application, a data storage method applied to a management node of a distributed storage system is provided, comprising:
[0014] In response to obtaining the to-be-stored data, object creation instructions are respectively sent to the corresponding plurality of storage nodes, so that each storage node creates a replica object according to the obtained replica number, and creates replica sub-objects in the replica object according to the obtained replica quantity; wherein different storage nodes correspond to different replica numbers;
[0015] The to-be-stored data is data split according to the replica quantity; wherein the data split to-be-stored data comprises a plurality of to-be-stored sub-data;
[0016] The data split to-be-stored data is sent to each storage node, so that each storage node determines a target replica sub-object in each replica sub-object according to the obtained replica number, and stores the to-be-stored sub-data in the target replica sub-object to a cache module, and stores the to-be-stored sub-data in a non-target replica sub-object to a hard disk module.
[0017] The data storage method further comprises: in response to obtaining a data reading instruction, obtaining a plurality of target storage nodes matched with the data reading instruction and target copy objects in each of the target storage nodes; obtaining, through the target copy objects in each of the target storage nodes, target copy sub-objects matched with the copy number of the current target copy object; obtaining, through the target copy sub-objects of each of the target storage nodes, matched stored data from the corresponding cache module; and splicing each of the stored data to obtain target storage data, and responding to the data reading instruction based on the target storage data. The management node obtains complete storage data from the cache modules of the plurality of storage nodes, improves the reading efficiency of the stored data, and meanwhile, the cache modules of each of the storage nodes do not include duplicate data, thereby avoiding the waste of cache resources in the distributed storage system.
[0018] According to another aspect of the present application, a data storage device is provided, applied to a storage node of a distributed storage system, comprising:
[0019] A copy object creation module is configured to, in response to obtaining an object creation instruction sent by a management node, create a copy object according to the obtained copy number, and create copy sub-objects in the copy object according to the obtained copy quantity.
[0020] A matching storage execution module is configured to save the to-be-stored data sent by the management node in the copy object, so that each of the copy sub-objects in the copy object is matched with each of the to-be-stored sub-data in the to-be-stored data.
[0021] A data storage execution module is configured to determine a target copy sub-object in each of the copy sub-objects according to the copy number, store the to-be-stored sub-data in the target copy sub-object to a cache module, and store the to-be-stored sub-data in a non-target copy sub-object to a hard disk module.
[0022] According to another aspect of the present application, a data storage device is provided, applied to a management node of a distributed storage system, comprising:
[0023] An object creation instruction sending module is configured to, in response to obtaining to-be-stored data, send an object creation instruction to a corresponding plurality of storage nodes respectively, so that each of the storage nodes creates a copy object according to the obtained copy number, and creates copy sub-objects in the copy object according to the obtained copy quantity; wherein different storage nodes correspond to different copy numbers.
[0024] A data splitting execution module is configured to split the to-be-stored data according to the copy quantity; wherein the to-be-stored data after data splitting comprises a plurality of to-be-stored sub-data.
[0025] The data sending execution module is configured to send the split data to be stored to each of the storage nodes, so that each of the storage nodes determines a target copy sub-object in each of the copy sub-objects according to the obtained copy number, and stores the to-be-stored sub-data in the target copy sub-object to the cache module and stores the to-be-stored sub-data in a non-target copy sub-object to the hard disk module.
[0026] According to another aspect of the present application, an electronic device is provided, which comprises:
[0027] at least one processor; and
[0028] a memory connected with the at least one processor; wherein
[0029] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data storage method according to the first embodiment of the present application or the data storage method according to the second embodiment of the present application.
[0030] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the data storage method according to the first embodiment of the present application or the data storage method according to the second embodiment of the present application when executed by the processor.
[0031] The technical solution of the embodiments of the present application enables each storage node to store each to-be-stored sub-data of the to-be-stored data in each copy sub-object one by one after creating the copy object and the copy sub-objects, and store the to-be-stored sub-data in the target copy sub-object to the cache module and store the to-be-stored sub-data in the non-target copy sub-object to the hard disk module, thereby not only realizing the copy storage of the to-be-stored data, i.e., realizing data backup, but also avoiding the waste of cache resources in the distributed storage system because the cache module of each storage node does not include duplicate data, and in addition, the management node can read the complete storage data through the cache modules of the plurality of storage nodes, thereby improving the reading efficiency of the storage data.
[0032] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to make the technical solution in the embodiments of the present application clearer, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those skilled in the art without any creative effort should be within the protection scope of the present application.
[0034] Figure 1A is a structural schematic diagram of a distributed storage system according to an embodiment of the present application;
[0035] Figure 1A is a flow chart of a data storage method according to an embodiment of the present application;
[0036] Figure 2 is a flow chart of a data storage method according to an embodiment of the present application;
[0037] Figure 3 is a flow chart of a data storage operation of a distributed storage system according to an embodiment of the present application;
[0038] Figure 4 is a flow chart of a data read operation of a distributed storage system according to an embodiment of the present application;
[0039] Figure 5 is a structural schematic diagram of a data storage device according to an embodiment of the present application;
[0040] Figure 6 is a structural schematic diagram of a data storage device according to an embodiment of the present application;
[0041] Figure 7 is a structural schematic diagram of an electronic device implementing a data storage method according to an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to make the technical solution in the embodiments of the present application clearer, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those skilled in the art without any creative effort should be within the protection scope of the present application.
[0043] It is to be understood that the terminology "first", "second" and the like used in the specification and the claims of the application as well as the foregoing drawings is merely intended to distinguish between similar objects and not necessarily for describing a particular sequential order. It is to be understood that the use of such terms can be interchanged in suitable circumstances so that the embodiments of the application described herein are capable of being practiced in other than the order illustrated or described herein. Furthermore, the terms "comprise" and "comprising" and any variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, system, product or apparatus that comprises a list of steps or units not necessarily limited to those specifically listed and can include other steps or units not expressly listed or inherent to such process, method, product or apparatus.
[0044] Figure 1A is a structural schematic diagram of a distributed storage system in an embodiment of the application, as shown in Figure 1A The distributed storage system comprises one management node (i.e. head node) 100 and at least one storage node 200; wherein the management node 100 itself can also be used as a storage node 200, thus, the minimum structure of the distributed storage system is composed of two electronic devices, one of which is used as the management node 100 and the other of which is used as the storage node 200.
[0045] When external data is written into the above distributed storage system, it is first written into the management node 100, the management node 100 allocates a plurality of storage nodes 200 for the current write data for performing replica storage, and then sends the current write data to the allocated storage nodes 200; the storage nodes 200 are used to store the above external write data; and when external devices read data from the above distributed storage system, the data read instruction is also first written into the management node 100, and the management node 100 takes out the storage data from the corresponding plurality of storage nodes 200 to respond to the data read instruction.
[0046] The storage node comprises a cache module 201 and a hard disk module 202, the cache module 201 is connected to the hard disk module 202; the cache module 201 can comprise a memory, and the hard disk module 202 can comprise a mechanical hard disk (HDD); the cache module 201 has higher read-write efficiency than the mechanical hard disk 202, and the mechanical hard disk 202 has larger storage capacity than the cache module 201; in particular, since a solid state disk (SSD) has better read efficiency than a mechanical hard disk, the solid state disk can also be used as the cache module 201, i.e. the cache module 201 can comprise a memory and / or a solid state disk, and the memory and the solid state disk are connected in series or in parallel.
[0047] Embodiment one
[0048] Figure 1B A flow chart of a data storage method provided for embodiment one of the present application, the embodiment can be applicable to the storage node managing the to-be-stored data through the created copy object and copy sub-object, the method can be executed by the data storage device in embodiment five, the data storage device can be realized in the form of hardware and / or software, and the data storage device can be configured in an electronic device such as a server.
[0049] As shown in Figure 1B , the method comprises:
[0050] S101, in response to obtaining the object creation instruction sent by the management node, creating a copy object according to the obtained copy number, and creating a copy sub-object in the copy object according to the obtained copy number.
[0051] The copy number is the number of data that needs to be saved at the same time when the distributed storage system stores data; in the embodiment of the present application, the management node can be set to a fixed copy mode, that is, the copy number is fixed, and the management node allocates storage nodes for the current to-be-stored data with the same copy number when obtaining each to-be-stored data; for example, the management node is set to a three-copy mode, that is, the copy number is three, and the management node needs to store each to-be-stored data through three storage nodes respectively, and each storage node saves a complete data.
[0052] The management node can also be set to a non-fixed copy mode, that is, the copy number is not fixed, and the management node allocates storage nodes for the current to-be-stored data with different copy numbers according to different copy requirements of different to-be-stored data when obtaining each to-be-stored data; for example, to-be-stored data A is stored in a two-copy mode, and to-be-stored data B is stored in a three-copy mode; in particular, the copy number of different to-be-stored data can be determined by the importance of the current to-be-stored data, and the importance and the copy number are positively correlated; wherein, the importance of the to-be-stored data can be determined according to the data type and / or data source (i.e. data sender) of the to-be-stored data.
[0053] The management node allocates the above number of storage nodes for the current data to be stored by a distribution manner such as a hash algorithm, to ensure the balance of storage space among all storage nodes in the distributed storage system; the copy number is the number of each copy of the current data to be stored; the object creation instruction sent by the management node to each storage node includes the copy number and the copy number of the copy to be created; taking the above technical solution as an example, the data to be processed B is stored in a three-copy mode, and the copy numbers are 1, 2 and 3 respectively; and the storage nodes C, D and E are allocated for the copy storage of the data to be processed B by the above hash algorithm, so that the copy number (i.e. 3) and the copy number 1 are sent to the storage node C, the copy number (i.e. 3) and the copy number 2 are sent to the storage node D, and the copy number (i.e. 3) and the copy number 3 are sent to the storage node E.
[0054] The storage node creates a copy object according to the copy number after obtaining the object creation instruction; wherein the copy object, i.e. the object used for performing copy storage, is also a discrete unit used for managing data in the storage node; in the embodiment of the application, the distributed storage system stores the copies of the data to be stored in an object storage manner; the copy sub-object is a sub-unit in the copy object, and each copy sub-object is used for storing a part of the data to be stored corresponding to the current copy object, i.e. a sub-data to be stored, and all copy sub-objects store the sub-data to be stored to form complete data to be stored; in the embodiment of the application, the number of copy sub-objects is the same as the number of copies, and the storage node creates the above number of copy sub-objects in the current copy object according to the obtained copy number.
[0055] Taking the above technical solution as an example, for the data to be stored B, the storage node C obtains the copy number (i.e. 3) and the copy number (i.e. copy number 1), creates a copy object with copy number 1, and creates three copy sub-objects, i.e. copy sub-object 1, copy sub-object 2 and copy sub-object 3, in the copy object.
[0056] S102, save the data to be stored sent by the management node in the copy object, so that each copy sub-object in the copy object is matched with each sub-data to be stored in the data to be stored.
[0057] The management node splits the to-be-stored data after obtaining the to-be-stored data, to split the to-be-stored data into a plurality of to-be-stored sub-data; wherein the number of to-be-stored sub-data is the same as the number of replicas; the management node can split the to-be-stored data in equal proportions according to the data size of the to-be-stored data, or can divide the continuous data with strong correlation in the to-be-stored data in the same to-be-stored data according to the correlation between the data in the to-be-stored data; in the embodiment of the application, the splitting manner of the to-be-stored data is not specifically limited; the management node sends the complete to-be-stored data to each replica object.
[0058] The storage node stores the to-be-stored sub-data and the replica sub-objects in a one-to-one matching manner in sequence after obtaining the to-be-stored data sent by the management node, and sequentially numbers each replica sub-object; for example, the storage node C has created replica object 1 before obtaining the to-be-stored data B, so that when storing the to-be-stored data B through the replica object 1, the to-be-stored data B1 is stored through the replica sub-object 1, the to-be-stored data B2 is stored through the replica sub-object 2, and the to-be-stored data B3 is stored through the replica sub-object 3; obviously, a replica object (i.e. replica object 1) includes complete to-be-stored data (i.e. to-be-stored data B), and each replica sub-object in a replica object carries different to-be-stored sub-data.
[0059] S103, according to the replica number, determining a target replica sub-object in each replica sub-object, and storing the to-be-stored sub-data in the target replica sub-object to a cache module, and storing the to-be-stored sub-data in a non-target replica sub-object to a hard disk module.
[0060] After the storage node stores the to-be-stored data into the replica object, in each replica sub-object, the number of the replica sub-objects (i.e. replica sub-number) and the number of the replica objects (i.e. replica number) can be compared, and the replica sub-object corresponding to the same replica sub-number as the current replica number is taken as the target replica sub-object; taking the above technical solution as an example, for the to-be-stored data B, the storage node C takes the replica sub-object 1 in the replica object 1 as the target replica sub-object, and the to-be-stored sub-data B1 is stored in the replica sub-object 1; the storage node D takes the replica sub-object 2 in the replica object 2 as the target replica sub-object, and the to-be-stored sub-data B2 is stored in the replica sub-object 2; the storage node E takes the replica sub-object 3 in the replica object 3 as the target replica sub-object, and the to-be-stored sub-data B3 is stored in the replica sub-object 3.
[0061] After obtaining the target to-be-stored sub-data in the target copy sub-object, the storage node stores the target to-be-stored sub-data to the cache module, and directly stores the to-be-stored sub-data in the copy sub-objects other than the target copy sub-object (i.e., the non-target copy sub-object) to the hard disk module; for example, according to the above technical solution, for the to-be-stored data B, the storage node C stores the to-be-stored sub-data B1 in the copy sub-object 1 of the copy object 1 to the cache module, and directly stores the to-be-stored sub-data B2 in the copy sub-object 2 of the copy object 1 and the to-be-stored sub-data B3 in the copy sub-object 3 of the copy object 1 to the hard disk module; in particular, the storage node can also store the target to-be-stored sub-data in the cache module to the hard disk module through data flushing and the like, so as to store the complete to-be-stored data B in the hard disk module.
[0062] Similarly, the storage node D stores the to-be-stored sub-data B2 in the copy sub-object 2 of the copy object 2 to the cache module, and stores the to-be-stored sub-data B in the copy sub-object 1 of the copy object 2 and the to-be-stored sub-data B3 in the copy sub-object 3 of the copy object 2 to the hard disk module; the storage node E stores the to-be-stored sub-data B3 in the copy sub-object 3 of the copy object 3 to the cache module, and stores the to-be-stored sub-data B1 in the copy sub-object 1 of the copy object 3 and the to-be-stored sub-data B2 in the copy sub-object 2 of the copy object 3 to the hard disk module.
[0063] Obviously, in the above technical solution, not only the copy storage of the to-be-stored data is realized, i.e., the complete to-be-stored data is stored by the plurality of storage nodes, and data backup is realized; but also only a part of the to-be-stored data, i.e., the to-be-stored sub-data, is retained in the cache module of each storage node, and the to-be-stored sub-data in the cache module of each storage node is different, and the to-be-stored sub-data in the cache module of each storage node collectively constitutes the complete to-be-stored data, so that the management node can read the complete stored data through the cache modules of the plurality of storage nodes, and the reading efficiency of the stored data is improved, and meanwhile, the cache module of each storage node does not include repeated data, and the waste of cache resources in the distributed storage system is avoided.
[0064] Optionally, in the embodiment of the application, after the target copy sub-object is determined in each copy sub-object according to the copy number, the method further comprises: storing the to-be-stored data in the copy object to the cache module, and copying the to-be-stored data to the hard disk module through the cache module; in the cache module, continuing to store the to-be-stored sub-data corresponding to the target copy sub-object, and deleting the to-be-stored sub-data corresponding to the non-target copy sub-object.
[0065] Specifically, the storage node can also store the to-be-stored data saved in the copy object into the cache module first, and then copy and store the to-be-stored data into the hard disk module through the cache module by using data back flushing and the like, and only keep the target to-be-stored sub-data in the target copy sub-object in the cache module, and delete the to-be-stored sub-data in the non-target copy sub-object, so that the cache module of the storage node does not include duplicate data, avoids waste of cache resources in the distributed storage system, and realizes asynchronous storage of data and improves data storage efficiency.
[0066] Optionally, in the embodiment of the application, after the to-be-stored data sent by the management node is saved in the copy object, so that each copy sub-object in the copy object is matched with each to-be-stored sub-data in the to-be-stored data, the embodiment further comprises: setting a weight for each copy sub-object according to a correction coefficient, the copy quantity, the copy number and the copy sub-number of each copy sub-object; and determining a target copy sub-object in each copy sub-object according to the copy number, which comprises: determining a target copy sub-object in each copy sub-object according to the weight of each copy sub-object and a preset weight threshold; wherein, if the weight of a current copy sub-object is greater than or equal to the preset weight threshold, the current copy sub-object is a target copy sub-object; if the weight of the current copy sub-object is less than the preset weight threshold, the current copy sub-object is a non-target copy sub-object; and the preset weight threshold is related to the remaining storage capacity of the cache module.
[0067] Specifically, the storage node can set the weight of each copy sub-object in the current copy object according to the following formula:
[0068]
[0069] wherein, i is the number of the copy sub-object, i.e. the copy sub-number; x is the number of the copy object, i.e. the copy number; M i is the weight of the i th copy sub-object; δ is a correction coefficient, which is used to adjust the proportion or difference between the weights of each copy sub-object in the same copy object, and can be set to any positive number value as needed, for example, δ can be set to 1; n is the copy quantity corresponding to the current to-be-stored data; obviously, when each to-be-stored data corresponds to the same correction coefficient and copy quantity, the weight of each copy sub-object is only related to the absolute value of the difference between the copy number (i.e. the number of the copy object) and the copy sub-number (i.e. the number of the copy sub-object). Taking the above technical solution as an example, the correction coefficient of the to-be-stored data B is 1, the copy quantity is 3, and the storage node E corresponds to the copy object 3, in the copy object 3, the weight of the copy sub-object 1 is 17 (the result is rounded to the integer part); the weight of the copy sub-object 2 is 33; and the weight of the copy sub-object 3 is 100.
[0070] The preset weight threshold is a preset screening value for screening the weight of each copy sub-object; when the preset weight threshold is set to a small value, the number of target copy sub-objects can be multiple, that is, the to-be-stored sub-data in multiple copy sub-objects are simultaneously saved in the cache module to fully utilize the feature that the cache module reads and writes data fast; in particular, when δ is set to 1 and the preset weight threshold is set to 100, there is only one target copy sub-object in each copy object; the preset weight threshold can be determined according to the current remaining storage capacity of the cache module, and the remaining storage capacity and the preset weight threshold are in a negative correlation, that is, when the remaining storage capacity of the cache module is large, the preset weight threshold is set to a small value, so that more to-be-stored sub-data are stored in the cache module as much as possible, that is, more data is written into the cache module; when the remaining storage capacity of the cache module is small, the preset weight threshold is set to a large value, so that the number of to-be-stored sub-data in the cache module is reduced, that is, less data is written into the cache module.
[0071] The storage node sets the weight of the copy sub-object in the current copy object, so that when the remaining storage space in the cache module is large, more to-be-stored sub-data are stored in the cache module, fully utilizing the feature that the cache module reads and writes fast, realizing fast writing and reading of data; when the remaining storage space in the cache module is small, only a small number of to-be-stored sub-data are stored in the cache module to realize accurate storage of data, while reducing waste of cache resources, and still ensuring the integrity of the current to-be-stored data in the cache module of the distributed storage system. In particular, the weight of each copy sub-object in the copy object can also be calculated and obtained by the management node, and each copy weight in each copy object calculated and obtained is sent to the corresponding storage node.
[0072] Optionally, in the embodiment of the application, the data storage method further comprises: in response to detecting that the remaining storage capacity of the cache module is less than or equal to a first storage threshold, obtaining the weight corresponding to each stored data in the cache module; according to the sorting result of the weight of each stored data, sequentially deleting a target stored data with the lowest weight until the remaining storage capacity of the cache module is greater than or equal to a second storage threshold; wherein the second storage threshold is greater than the first storage threshold.
[0073] Specifically, as the storage node continuously performs the storage operation of each data, the remaining storage capacity in the cache module is also continuously reduced, thereby the stored data needs to be sorted and deleted to ensure that the cache module provides sufficient data storage space for the subsequent to-be-stored data; when the remaining storage capacity in the cache module is small, i.e., less than or equal to the first storage threshold, the storage node can directly filter based on the weight corresponding to each stored data in the cache module, or based on the existing cache eviction algorithm, such as LFU (Least Frequently Used, Least Frequently Used Algorithm), LRU (Least Recently User, Least Recently Used Algorithm), ARC (Adaptive Replacement Cache), adaptive cache replacement algorithm), FIFO (First in First out, First in First out algorithm) and 2Q (Two queues, two queues), etc., calculate the non-eviction probability of each stored data, and then multiply the corresponding weight, and then sort and delete according to the product result.
[0074] Through the weight corresponding to each stored data, not only the importance comparison between each sub-data in the same data is realized, but also the importance comparison between each sub-data in different data is realized. Compared with the prior art, the storage node can only rely on the existing cache eviction algorithm to perform cache eviction based on the data record of the single storage node itself. The above technical solution allocates a corresponding weight to each replica sub-object based on the overall storage mode of the distributed storage system, more accurately reflects the importance of each stored data, and improves the accuracy of the cache eviction result.
[0075] The technical solution of the embodiment of the application, after the storage node creates the replica object and the replica sub-object, stores each to-be-stored sub-data of the to-be-stored data through each replica sub-object, and stores the to-be-stored sub-data in the target replica sub-object to the cache module and the to-be-stored sub-data in the non-target replica sub-object to the hard disk module. Not only the replica storage of the to-be-stored data is realized, i.e., data backup is realized, but also the cache module of each storage node does not include duplicate data, avoiding the waste of cache resources in the distributed storage system. In addition, the management node can read the complete storage data through the cache module of the plurality of storage nodes, improving the reading efficiency of the storage data.
[0076] Embodiment two
[0077] Figure 2A flowchart of a data storage method provided for the second embodiment of the present application, the embodiment can be applicable to a management node to split to-be-stored data, so that each storage node performs data storage based on the split to-be-stored data. The method can be performed by the data storage device in the sixth embodiment, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device such as a server. As shown in FIG. 17, the method comprises the following steps. Figure 2
[0078] S201, in response to obtaining to-be-stored data, issuing object creation instructions to a plurality of corresponding storage nodes respectively, so that each storage node creates a replica object according to the obtained replica number, and creates a replica sub-object in the replica object according to the obtained replica quantity; wherein different storage nodes correspond to different replica numbers.
[0079] S202, data splitting the to-be-stored data according to the replica quantity; wherein the data split to-be-stored data comprises a plurality of to-be-stored sub-data.
[0080] The management node can set a split mark at a specified position of the to-be-stored data by setting a split mark, so as to mark how to divide the to-be-stored data into a plurality of to-be-stored sub-data by the split mark.
[0081] S203, sending the data split to-be-stored data to each storage node, so that each storage node determines a target replica sub-object in each replica sub-object according to the obtained replica number, and stores the to-be-stored sub-data in the target replica sub-object to a cache module, and stores the to-be-stored sub-data in a non-target replica sub-object to a hard disk module.
[0082] Optionally, in the embodiment of the present application, the data storage method further comprises: in response to obtaining a data read instruction, obtaining a plurality of target storage nodes matched with the data read instruction and a target replica object in each target storage node; obtaining a target replica sub-object matched with the replica number of the current target replica object through the target replica object in each target storage node; obtaining the matched stored data from the corresponding cache module through the target replica sub-object of each target storage node; data splicing each stored data to obtain spliced target storage data, and responding to the data read instruction based on the target storage data.
[0083] Specifically, taking the above technical solution as an example, when the management node determines that the data read data is data B according to the data read instruction, it is determined that the data B is stored in the copy object 1 of the storage node C, the copy object 2 of the storage node E and the copy object 2 of the storage node F; then according to the above copy number, the copy sub-object 1 is determined in the copy object 1, the copy sub-object 2 is determined in the copy object 2, and the copy sub-object 3 is determined in the copy object 3; then the stored data B1 is obtained through the copy sub-object 1 in the storage node C, the stored data B2 is obtained through the copy sub-object 2 in the storage node D, and the stored data B3 is obtained through the copy sub-object 3 in the storage node E; finally, after the stored data B1, the stored data B2 and the stored data B3 are spliced, the complete data B is obtained, and then the data B is responded according to the data read instruction; the management node obtains the complete stored data from the cache modules of the plurality of storage nodes, improves the reading efficiency of the stored data, and at the same time, the cache modules of the plurality of storage nodes do not include repeated data, avoiding the waste of cache resources in the distributed storage system.
[0084] The technical scheme of the embodiment of the application, after the management node respectively issues object creation instructions to the storage nodes to make the storage nodes create copy objects and copy sub-objects, the to-be-stored data is split into a plurality of to-be-stored sub-data, so that each storage node stores the to-be-stored sub-data in the target copy sub-object to the cache module and stores the to-be-stored sub-data in the non-target copy sub-object to the hard disk module, not only realizing the copy storage of the to-be-stored data, that is, realizing data backup, but also avoiding the waste of cache resources in the distributed storage system, because the cache modules of the plurality of storage nodes do not include repeated data, and in addition, the management node can read the complete stored data through the cache modules of the plurality of storage nodes, improving the reading efficiency of the stored data.
[0085] Embodiment three
[0086] Figure 3 The flowchart of the distributed storage system of the embodiment of the application when performing a data storage operation (that is, obtaining to-be-stored data) is as shown in Figure 3
[0087] The management node responds to the to-be-stored data, and allocates a plurality of storage nodes according to the copy number; the management node issues an object creation instruction to the plurality of storage nodes, and the object creation instruction includes a copy number and a copy number; after the storage node obtains the object creation instruction issued by the management node, the copy object is created according to the obtained copy number, and the copy sub-object is created in the copy object according to the obtained copy number; the storage node feeds back to the management node that the object creation is completed.
[0088] The management node obtains that the object creation of the storage node is completed, and splits the to-be-stored data according to the number of copies, wherein the to-be-stored data after data splitting comprises a plurality of to-be-stored sub-data; the management node sends the to-be-stored data after data splitting to each storage node; and the storage node saves the to-be-stored data sent by the management node through a copy object, so that each copy sub-object in the copy object is matched with each to-be-stored sub-data in the to-be-stored data.
[0089] The storage node determines a target copy sub-object in each copy sub-object according to a copy number, and stores the to-be-stored sub-data in the target copy sub-object in the cache module and stores the to-be-stored sub-data in the non-target copy sub-object in the hard disk module.
[0090] The technical scheme of the embodiment of the application not only realizes the copy storage of the to-be-stored data, that is, realizes data backup, but also avoids the waste of cache resources in the distributed storage system, because the cache module of each storage node does not include duplicate data, and in addition, the management node can read the complete stored data through the cache module of the plurality of storage nodes, thereby improving the reading efficiency of the stored data.
[0091] Embodiment Four
[0092] Figure 4 The flowchart of the distributed storage system of the embodiment of the application when performing a data reading operation (that is, obtaining a data reading instruction) is shown in FIG. 4. Figure 4
[0093] The management node obtains the data reading instruction sent by the external device, determines the target storage node corresponding to the to-be-read data and the target copy object in each target storage node according to the data reading instruction, obtains the target copy sub-object in each target copy object according to the copy number of each target copy object, and sends the data reading instruction to the target copy sub-object of each target storage node.
[0094] After the storage node obtains the data reading instruction, the storage node determines the storage location of the stored data through the corresponding target copy sub-object; if the storage node determines that the current stored data is located in the cache module, the storage node obtains the stored data through the cache module; and if the storage node determines that the current stored data is not located in the cache module, the storage node obtains the stored data through the hard disk module.
[0095] After the management node obtains the stored data fed back by each target storage node, the management node splices each stored data to obtain the spliced target stored data, and responds to the data reading instruction based on the target stored data.
[0096] The technical scheme of the embodiment of the present application, the management node obtains complete storage data from the cache modules of the plurality of storage nodes, improves the reading efficiency of the stored data, meanwhile, the cache modules of the plurality of storage nodes do not include duplicate data, thereby avoiding the waste of cache resources in the distributed storage system.
[0097] Embodiment five
[0098] Figure 5 is a structural block diagram of a data storage device provided by the embodiment five of the present application, and the device specifically comprises:
[0099] The copy object creation module 501 is configured to create a copy object according to the obtained copy number in response to obtaining the object creation instruction sent by the management node, and create copy sub-objects in the copy object according to the obtained copy number;
[0100] The matching storage execution module 502 is configured to save the to-be-stored data sent by the management node in the copy object, so that each copy sub-object in the copy object is matched with each to-be-stored sub-data in the to-be-stored data one by one.
[0101] The data storage execution module 503 is configured to determine a target copy sub-object in each copy sub-object according to the copy number, store the to-be-stored sub-data in the target copy sub-object to the cache module, and store the to-be-stored sub-data in the non-target copy sub-object to the hard disk module.
[0102] The technical scheme of the embodiment of the present application, the storage node stores each to-be-stored sub-data of the to-be-stored data in each copy sub-object one by one after creating the copy object and the copy sub-object, stores the to-be-stored sub-data in the target copy sub-object to the cache module, and stores the to-be-stored sub-data in the non-target copy sub-object to the hard disk module, which not only realizes the copy storage of the to-be-stored data, that is, realizes data backup, but also avoids the waste of cache resources in the distributed storage system, because the cache modules of the plurality of storage nodes do not include duplicate data, and the management node can read complete storage data through the cache modules of the plurality of storage nodes, thereby improving the reading efficiency of the storage data.
[0103] Optionally, the data storage execution module 503 is further configured to store the to-be-stored data in the copy object to the cache module, and copy the to-be-stored data to the hard disk module through the cache module; continue to store the to-be-stored sub-data corresponding to the target copy sub-object in the cache module, and delete the to-be-stored sub-data corresponding to the non-target copy sub-object.
[0104] Optionally, the data storage device further comprises:
[0105] The weight setting module is configured to set weights for each of the copy sub-objects according to the correction coefficient, the copy quantity, the copy number, and a copy sub-number of each of the copy sub-objects.
[0106] The data storage execution module 503 is specifically configured to determine a target copy sub-object from each of the copy sub-objects according to the weight of each of the copy sub-objects and a preset weight threshold value; if the weight of a current copy sub-object is greater than or equal to the preset weight threshold value, the current copy sub-object is the target copy sub-object; if the weight of the current copy sub-object is less than the preset weight threshold value, the current copy sub-object is a non-target copy sub-object; and the preset weight threshold value is related to the remaining storage capacity of the cache module.
[0107] Optionally, the data storage device further comprises:
[0108] The weight acquisition module is configured to acquire the weight corresponding to each of the stored data in the cache module in response to detecting that the remaining storage capacity of the cache module is less than or equal to a first storage threshold value.
[0109] The sorting execution module is configured to sequentially delete a target stored data with the lowest weight according to a sorting result of the weights of each of the stored data, until the remaining storage capacity of the cache module is greater than or equal to a second storage threshold value; and the second storage threshold value is greater than the first storage threshold value.
[0110] The above device can perform the data storage method provided by any embodiment one of the present application, has the function modules and beneficial effects corresponding to the execution method. Technical details not described in detail in the present embodiment can be referred to the data storage method provided by embodiment one of the present application.
[0111] Embodiment six
[0112] Figure 6 is a structural block diagram of a data storage device provided by embodiment six of the present application, which specifically comprises:
[0113] The object creation instruction sending module 601 is configured to send object creation instructions to a plurality of storage nodes corresponding to the object creation instructions respectively in response to acquiring the to-be-stored data, so as to make each of the storage nodes create a copy object according to the acquired copy number, and create a copy sub-object in the copy object according to the acquired copy quantity; and different storage nodes correspond to different copy numbers.
[0114] The data splitting execution module 602 is configured to split the to-be-stored data according to the copy quantity; and the to-be-stored data after data splitting comprises a plurality of to-be-stored sub-data.
[0115] The data sending execution module 603 is configured to send the split data to be stored to each storage node, so that each storage node determines a target copy sub-object in each copy sub-object according to the obtained copy number, and stores the to-be-stored sub-data in the target copy sub-object to the cache module and stores the to-be-stored sub-data in a non-target copy sub-object to the hard disk module.
[0116] The technical scheme of the embodiment of the application, after the management node respectively sends an object creation instruction to the storage nodes to make the storage nodes create a copy object and a copy sub-object, splits the data to be stored into a plurality of to-be-stored sub-data, so that each storage node stores the to-be-stored sub-data in the target copy sub-object to the cache module and stores the to-be-stored sub-data in the non-target copy sub-object to the hard disk module, not only realizes the copy storage of the data to be stored, that is, realizes data backup, but also avoids the waste of cache resources in the distributed storage system because the cache module of each storage node does not include duplicate data, and in addition, the management node can read the complete stored data through the cache modules of the plurality of storage nodes, thereby improving the reading efficiency of the stored data.
[0117] Optionally, the data storage device further comprises:
[0118] The target copy object acquisition module is configured to acquire a plurality of target storage nodes and target copy objects in each target storage node matched with the data reading instruction in response to the acquisition of the data reading instruction.
[0119] The target copy sub-object acquisition module is configured to acquire a target copy sub-object matched with the copy number of the current target copy object through the target copy object in each target storage node.
[0120] The stored data acquisition module is configured to acquire matched stored data from the corresponding cache module through the target copy sub-object of each target storage node.
[0121] The data splicing module is configured to splice each stored data to obtain spliced target stored data, and respond to the data reading instruction based on the target stored data.
[0122] The above device can execute the data storage method provided by any embodiment two of the application, has the corresponding function modules and beneficial effects of the execution method. Technical details not described in detail in the embodiment can be referred to the data storage method provided by the embodiment two of the application.
[0123] Embodiment seven
[0124] Figure 7A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.
[0125] As shown in Figure 7 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0126] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, speakers, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0127] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the data storage method.
[0128] In some embodiments, the data storage method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., a memory device. In some embodiments, portions or all of the computer program can be loaded and / or installed onto the heterogeneous hardware accelerator via a ROM and / or communication unit. When the computer program is loaded into RAM and executed by the processor, one or more steps of the data storage method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform the data storage method by other means, e.g., with the aid of firmware.
[0129] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0130] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor of the machine, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0131] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0132] To provide for interaction with a user, the systems and techniques described here can be implemented on a heterogeneous hardware accelerator having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the heterogeneous hardware accelerator. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0133] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), blockchain network, and the Internet.
[0134] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0135] It should be understood that the various forms of flow shown above can be reordered, added to, or have steps deleted. For example, the steps described in the present application can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, and this is not limited herein.
[0136] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data storage method, characterized by, A storage node applied to a distributed storage system, comprising: in response to obtaining an object creation instruction sent by a management node, creating a replica object according to the obtained replica number, and creating replica sub-objects in the replica object according to the obtained replica quantity; storing the to-be-stored data sent by the management node in the replica object, so that each replica sub-object in the replica object is matched with each to-be-stored sub-data in the to-be-stored data one by one; wherein the replica sub-object is used to store to-be-stored sub-data, and the to-be-stored sub-data is a part of the to-be-stored data corresponding to the current replica object; the to-be-stored data is composed of to-be-stored sub-data stored by all replica sub-objects; determining a target replica sub-object in each replica sub-object according to the replica number, and storing the to-be-stored sub-data in the target replica sub-object to a cache module and storing the to-be-stored sub-data in non-target replica sub-objects to a hard disk module.
2. The method of claim 1, wherein, after determining the target replica sub-object in each replica sub-object according to the replica number, further comprising: storing the to-be-stored data in the replica object to the cache module, and copying the to-be-stored data to the hard disk module through the cache module; continuing to store the to-be-stored sub-data corresponding to the target replica sub-object in the cache module, and deleting the to-be-stored sub-data corresponding to the non-target replica sub-objects.
3. The method according to claim 1 or 2, characterized in that, after storing the to-be-stored data sent by the management node in the replica object, so that each replica sub-object in the replica object is matched with each to-be-stored sub-data in the to-be-stored data one by one, further comprising: setting a weight for each replica sub-object according to a correction coefficient, the replica quantity, the replica number, and a replica sub-number of each replica sub-object; the determining the target replica sub-object in each replica sub-object according to the replica number comprises: determining the target replica sub-object in each replica sub-object according to the weight of each replica sub-object and a preset weight threshold; wherein, if the weight of the current replica sub-object is greater than or equal to the preset weight threshold, the current replica sub-object is the target replica sub-object; if the weight of the current replica sub-object is less than the preset weight threshold, the current replica sub-object is the non-target replica sub-object; the preset weight threshold is related to the remaining storage capacity of the cache module.
4. The method of claim 3, wherein, the data storage method further comprises: in response to detecting that the remaining storage capacity of the cache module is less than or equal to a first storage threshold, obtaining the weight corresponding to each stored data in the cache module; according to the sorting result of the weight of each stored data, sequentially deleting the target stored data with the lowest weight until the remaining storage capacity of the cache module is greater than or equal to a second storage threshold; wherein the second storage threshold is greater than the first storage threshold.
5. A data storage method characterized by, a management node applied to a distributed storage system, comprising: In response to obtaining the to-be-stored data, object creation instructions are respectively sent to the corresponding plurality of storage nodes, so that each of the storage nodes creates a replica object according to the obtained replica number, and creates replica sub-objects in the replica object according to the obtained replica quantity; wherein different storage nodes correspond to different replica numbers; the replica sub-objects are used to store to-be-stored sub-data, and the to-be-stored sub-data is part of the to-be-stored data corresponding to the current replica object; The to-be-stored data is data-split according to the replica quantity; wherein the to-be-stored data after data splitting includes a plurality of to-be-stored sub-data; The to-be-stored data after data splitting is sent to each of the storage nodes, so that each of the storage nodes determines a target replica sub-object in each of the replica sub-objects according to the obtained replica number, and stores the to-be-stored sub-data in the target replica sub-object to a cache module, and stores the to-be-stored sub-data in a non-target replica sub-object to a hard disk module.
6. The method of claim 5, wherein, The data storage method further comprises: In response to obtaining a data read instruction, a plurality of target storage nodes and target replica objects in each of the target storage nodes that match the data read instruction are obtained; Through the target replica objects in each of the target storage nodes, target replica sub-objects that match the replica number of the current target replica object are respectively obtained; Through the target replica sub-objects of each of the target storage nodes, matching stored data is respectively obtained from the corresponding cache module; Each of the stored data is data-spliced to obtain spliced target stored data, and the data read instruction is responded based on the target stored data.
7. A data storage device, characterized by A storage node applied to a distributed storage system comprises: A replica object creation module, configured to create a replica object according to an obtained replica number in response to obtaining an object creation instruction sent by a management node, and create replica sub-objects in the replica object according to an obtained replica quantity; A matching storage execution module, configured to save to-be-stored data sent by the management node through the replica object, so that each of the replica sub-objects in the replica object one-to-one matches each to-be-stored sub-data in the to-be-stored data; wherein the replica sub-objects are used to store to-be-stored sub-data, and the to-be-stored sub-data is part of to-be-stored data corresponding to the current replica object; the to-be-stored data is composed of to-be-stored sub-data stored by all replica sub-objects; A data storage execution module, configured to determine a target replica sub-object in each of the replica sub-objects according to the replica number, and store to-be-stored sub-data in the target replica sub-object to a cache module, and store to-be-stored sub-data in a non-target replica sub-object to a hard disk module.
8. A data storage device, characterized by A management node applied to a distributed storage system comprises: The object creation instruction sending module is configured to, in response to obtaining the to-be-stored data, send object creation instructions to the corresponding multiple storage nodes respectively, so that each of the storage nodes creates a replica object according to the obtained replica number and creates replica sub-objects in the replica object according to the obtained replica quantity; wherein different storage nodes correspond to different replica numbers; the replica sub-objects are configured to store to-be-stored sub-data, and the to-be-stored sub-data is part of the to-be-stored data corresponding to the current replica object; The data splitting execution module is configured to split the to-be-stored data according to the replica quantity; wherein the to-be-stored data after data splitting includes multiple to-be-stored sub-data; The data sending execution module is configured to send the to-be-stored data after data splitting to each of the storage nodes, so that each of the storage nodes determines a target replica sub-object in each of the replica sub-objects according to the obtained replica number, stores the to-be-stored sub-data in the target replica sub-object to the cache module, and stores the to-be-stored sub-data in the non-target replica sub-object to the hard disk module.
9. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data storage method of any one of claims 1-4, or execute the data storage method of claim 5 or 6.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to implement the data storage method of any one of claims 1-4, or implement the data storage method of claim 5 or 6 when executed.
Citation Information
Patent Citations
Data caching method and system capable of conducting dynamic distribution
CN104598394A
Data storage method and device and computer storage medium
CN112416264A