Data storage method and related device
By generating or updating the data distribution table according to the data distribution strategy in the client-server architecture, and writing replica data only when the processing units are consistent, the problem of saving storage resources in multi-node storage systems is solved, and data reliability and resource optimization are achieved in the case of failure or scaling up and down.
Patent Information
- Application Number
- CN202180004728.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-12
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2041-03-12
AI Technical Summary
In client-server architecture software systems, how can we ensure data reliability while saving storage resources, especially reducing the occupation of redundant storage resources when data is stored on multiple nodes on the server side?
By generating or updating a data distribution table according to a data distribution strategy in the data storage system, replica data is written to the server node only when the processing units are consistent, and the data distribution is adjusted to optimize the use of storage resources when a processing unit fails or is scaled up or down.
While maintaining data reliability, the need to store duplicate data has been reduced, saving storage resources. At the same time, data reliability and balanced business distribution are maintained when dealing with unit failures or scaling up and down.
Smart Images

Figure CN115349116B_ABST
Abstract
Description
[0001] Cross-reference related applications
[0002] This application is an application that has entered the Chinese national phase of international application filed on March 12, 2021, with application number PCT / CN2021 / 080608, and the entire aforementioned application is incorporated herein by reference. Technical Field
[0003] This application relates to the field of computer technology, and in particular to a data storage method and related equipment. Background Technology
[0004] In client-server architecture software systems, data needs to be stored on multiple nodes on the server side to ensure data reliability. The more copies of data stored on multiple nodes on the server side, the higher the data reliability; however, this also means that more storage resources are consumed.
[0005] While ensuring data reliability, how to save storage resources has become a problem that needs to be solved. Summary of the Invention
[0006] This application discloses a data storage method and related equipment, which can save storage resources while ensuring data reliability.
[0007] The first aspect of this application discloses a data storage method applied to a data storage system. The data storage method includes: acquiring cached data and a first data distribution table, wherein the first data distribution table includes the primary location and replica location of the data; writing the cached data into a first client node; determining a first server node based on the primary location of the cached data obtained from the first data distribution table; writing primary data consistent with the cached data into the first server node; if the processing unit running the first client node is the same as the processing unit running the first server node, determining the replica location of the cached data based on the first data distribution table, and writing the replica data consistent with the primary data into the server node corresponding to the determined replica location.
[0008] Typically, for cached data on client nodes, the data storage system needs to store both primary and replica data corresponding to the cached data. In the embodiments provided in this application, replica data corresponding to the cached data is only written to the server node when the processing unit where the cached data resides is the same as the processing unit where the primary data resides, thereby saving storage space.
[0009] In some optional implementations, the data distribution table includes a first data distribution table, and the data distribution strategy corresponding to the data distribution table includes: the primary data and replica data of any data in the data storage system are distributed in different processing units; and / or the number of primary data and replica data in each processing unit is balanced; and any data has a corresponding primary location and replica location.
[0010] By adopting this technical solution, electronic devices or nodes in a data storage system can generate or update data distribution tables according to data distribution strategies.
[0011] In some alternative implementations, if the processing unit running the first client node is different from the processing unit running the first server node, the copy data is not written to the data storage system.
[0012] By adopting this technical solution, when the processing unit running the first client node is inconsistent with the processing unit running the first server node, no replica data is written to the data storage system. Even when a processing unit fails, the data storage system still stores backup data corresponding to the data lost in the failed processing unit, thus saving storage resources for replica data without compromising reliability.
[0013] In some optional implementations, if any processing unit in the data storage system fails or is scaled down, the processing unit that fails or is scaled down will be designated as the processing unit to be migrated out. The processing unit to be migrated out will run the client node to be migrated out and the server node to be migrated out. The client node to be migrated out will store the cached data to be migrated out, and the server node to be migrated out will store the primary data to be migrated out and the replica data to be migrated out. The data storage method further includes: updating the first data distribution table based on the client nodes and server nodes of the other processing units besides the processing unit to be migrated out, to obtain the second data distribution table.
[0014] By adopting this technical solution, the first data distribution table can be updated to obtain a second data distribution table. This allows for data storage based on the second data distribution table even in the event of a downsizing of the processing unit.
[0015] In some optional implementations, for the master data to be migrated, the data storage method further includes: determining the master location of the master data to be migrated as the server node to be migrated based on the second data distribution table; writing the master data to be migrated to the server node to be migrated; determining a second client node that stores cached data consistent with the master data to be migrated; if the processing unit running the second client node is the same as the processing unit running the server node to be migrated, determining the second server node based on the copy location of the master data to be migrated obtained from the second data distribution table; and writing copy data consistent with the master data to be migrated to the second server node.
[0016] By adopting this technical solution, the second server node can be determined based on the location of the replica of the master data to be migrated, obtained from the second data distribution table, provided that the processing unit running the second client node is the same as the processing unit running the server node to be migrated. Replica data identical to the master data to be migrated is then written to the second server node, ensuring data reliability.
[0017] In some optional implementations, if there is replica data in the server node to be migrated that is consistent with the master data to be migrated, the replica data in the server node to be migrated that is consistent with the master data to be migrated is converted into the master data and used as the master data to be migrated.
[0018] By adopting this technical solution, the conversion of replica data to primary data can be achieved when there is replica data in the server node to be migrated that is consistent with the primary data to be migrated.
[0019] In some optional implementations, writing the master data to be migrated to the server node to be migrated includes: if any client node in the processing unit running the server node to be migrated has cached data that is consistent with the master data to be migrated, writing the cached data that is consistent with the master data to be migrated to the server node to be migrated as the master data to be migrated.
[0020] By adopting this technical solution, it is possible to write cached data into the main data.
[0021] In some optional implementations, for the replica data to be migrated, the data storage method further includes: determining a third client node that stores cached data consistent with the replica data to be migrated based on a second data distribution table, and determining a third server node that stores primary data consistent with the replica data to be migrated; if the processing unit running the third client node is the same as the processing unit running the third server node, the replica data to be migrated is written to the server node corresponding to the replica location of the replica data to be migrated based on the second data distribution table.
[0022] By adopting this technical solution, when the processing unit running the third client node is the same as the processing unit running the third server node, the replica data to be migrated is written to the server node corresponding to the replica location of the replica data to be migrated according to the second data distribution table, thus ensuring data reliability.
[0023] In some optional implementations, if the processing unit running the third client node is different from the processing unit running the third server node, the replica data to be migrated is not written to the server node corresponding to the replica location of the replica data to be migrated.
[0024] By adopting this technical solution, storage resources required for migrating copy data can be saved while ensuring data reliability.
[0025] In some optional implementations, for cached data to be migrated, the data storage method further includes: determining the client node with the least load in the data storage system and adjusting the task corresponding to the cached data to be migrated to the client node with the least load in the data storage system; or determining the client node with the least remaining storage resources in the data storage system and adjusting the task corresponding to the cached data to be migrated to the client node with the least remaining storage resources in the data storage system.
[0026] By adopting this technical solution, tasks can be adjusted between client nodes.
[0027] In some optional implementations, if the processing unit in the data storage system is expanded, the expanded processing unit is used as the expansion processing unit. The expansion processing unit runs the fourth client node and the fourth server node. The data storage method further includes: updating the first data distribution table according to the expansion processing unit to obtain an updated third data distribution table; determining the cache data to be written that needs to be stored by the fourth client node and the main data to be written that needs to be stored by the fourth server node according to the updated third data distribution table; writing the main data to be written to the fourth server node and deleting the main data to be written from other server nodes in the data storage system; and adjusting the task corresponding to the cache data to be written to the fourth client node.
[0028] By adopting this technical solution, when the processing unit in the data storage system is expanded, the main data to be written can be written to the fourth server node, and the main data to be written can be deleted from other server nodes in the data storage system; the task corresponding to the cache data to be written can be adjusted to the fourth client node, ensuring a balanced distribution of business and data.
[0029] In some optional implementations, after writing the master data to be written to the fourth server node, the data storage method further includes: determining the client node in the data storage system that stores cached data consistent with the master data to be written as the fifth client node; determining whether the processing unit running the fifth client node is consistent with the processing unit running the fourth server node; if the processing unit running the fifth client node is inconsistent with the processing unit running the fourth server node, determining the fifth server node according to the copy location of the master data to be written obtained from the updated third data distribution table; and deleting the copy data consistent with the master data to be written from the fifth server node.
[0030] By adopting this technical solution, even if the processing unit running the fifth client node is different from the processing unit running the fourth server node, the fifth server node can be determined based on the location of the replica data to be written to the master node obtained from the updated third data distribution table. The replica data that is consistent with the master data to be written can be deleted from the fifth server node, thereby saving the storage resources required to store the replica data.
[0031] In some alternative implementations, if the processing unit running the fifth client node is different from the processing unit running the fourth server node, no copy data to be written to the primary data is generated in the data storage system.
[0032] By adopting this technical solution, storage resources required for storing duplicate data can be saved.
[0033] In some optional implementations, the data storage method further includes: determining, based on an updated third data distribution table, the copy data to be written to be stored by the fourth server node; determining, based on the updated third data distribution table, a sixth client node storing cached data consistent with the copy data to be written, and a sixth server node storing primary data consistent with the copy data to be written; if the processing unit running the sixth client node is the same as the processing unit running the sixth server node, writing the copy data to be written to the fourth server node based on the updated third data distribution table.
[0034] By adopting this technical solution, the reliability of the data can be ensured.
[0035] In some optional implementations, if the processing unit running the sixth client node is different from the processing unit running the sixth server node, and there is copy data to be written in the fourth server node, the copy data to be written is deleted from the fourth server node.
[0036] By adopting this technical solution, storage resources required for storing duplicate data can be saved.
[0037] In some alternative implementations, if the processing unit running the sixth client node is different from the processing unit running the sixth server node, the copy data to be written is not written to the fourth server node.
[0038] By adopting this technical solution, storage resources required for storing duplicate data can be saved.
[0039] In some optional implementations, after adjusting the task corresponding to the cached data to be written to the fourth client node, the data storage method further includes: determining the server node in the data storage system that stores the master data consistent with the cached data to be written as the seventh server node, and determining whether the processing unit running the fourth client node is consistent with the processing unit running the seventh server node; if the processing unit running the fourth client node is inconsistent with the processing unit running the seventh server node, no copy data of the cached data to be written is generated in the data storage system.
[0040] By adopting this technical solution, storage resources required for storing duplicate data can be saved.
[0041] A second aspect of this application discloses a data storage method applied to a data storage system. The data storage system includes multiple processing units, each processing unit running at least one client node and at least one server node. A first client node stores cached data, and a first server node stores master data consistent with the cached data. The data storage method includes: determining whether the processing unit running the first client node is consistent with the processing unit running the first server node; if the processing unit running the first client node is consistent with the processing unit running the first server node, and there is no copy data consistent with the master data in the data storage system, writing copy data consistent with the master data to any server node of another processing unit; if the processing unit running the first client node is inconsistent with the processing unit running the first server node, deleting the copy data consistent with the master data from the data storage system.
[0042] By adopting this technical solution, for data storage systems where the replica data does not meet the above data distribution strategy, this embodiment can modify the replica data stored in the data storage system by writing, deleting, etc., so as to save storage resources for storing replica data while ensuring data reliability.
[0043] A third aspect of this application discloses a computer-readable storage medium storing at least one computer instruction that, when executed on an electronic device, implements the data storage method described above.
[0044] A fourth aspect of this application discloses a computer device, including a processor and a memory; the memory is used to store instructions; the processor is used to invoke the instructions in the memory, causing the computer device to execute the data storage method.
[0045] The technical effects brought about by the third and fourth aspects can be found in the descriptions of the methods involved in the above methods section, and will not be repeated here. Attached Figure Description
[0046] Figure 1 This is a schematic diagram illustrating an application scenario of the data storage method disclosed in the embodiments of this application.
[0047] Figure 2 This is a diagram illustrating the data distribution.
[0048] Figure 3 This is a flowchart of the writing scenario of the data storage method disclosed in the embodiments of this application.
[0049] Figure 4 This is the first data distribution table.
[0050] Figure 5 This is a schematic diagram of the data distribution in the writing scenario of the data storage method disclosed in the embodiments of this application.
[0051] Figure 6 This is a flowchart illustrating a specific writing scenario of the data storage method disclosed in the embodiments of this application.
[0052] Figure 7 This is the second data distribution table.
[0053] Figure 8 This is a schematic diagram of data distribution in a scaled-down scenario of the data storage method disclosed in the embodiments of this application.
[0054] Figure 9 This is a flowchart illustrating a specific scaling-down scenario of the data storage method disclosed in the embodiments of this application.
[0055] Figure 10 This is the third data distribution table.
[0056] Figure 11 This is a schematic diagram of data distribution in a scenario of expanding the data storage method disclosed in the embodiments of this application.
[0057] Figure 12 This is a flowchart illustrating a specific expansion scenario of the data storage method disclosed in the embodiments of this application.
[0058] Figure 13 This is a schematic diagram of the structure of the electronic device disclosed in the embodiments of this application. Detailed Implementation
[0059] For ease of understanding, some concepts related to the embodiments of this application are illustrated and explained by way of example for reference.
[0060] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and drawings of this application are used to distinguish similar objects, not to describe a specific order or sequence.
[0061] To better understand the data storage method and related devices disclosed in the embodiments of this application, the application scenarios of the data storage method of this application are described below.
[0062] Figure 1 This is a schematic diagram illustrating an application scenario of the data storage method disclosed in this application. The data storage method of this application can be applied to a data storage system, which can be a software system based on a client-server architecture. The data storage system includes multiple processing units, each processing unit running at least one client node and at least one server node. The processing unit is the running entity where the client node and server node reside. Figure 1 As shown, the data storage system includes three processing units: processing unit 1 runs client node 1 and server node 1; processing unit 2 runs client node 2 and server node 2; and processing unit 3 runs client node 3 and server node 3.
[0063] In one embodiment of this application, when the client node and server node are processes, the processing unit can be a virtual machine or a physical machine. When the client node and server node are virtual machines or physical machines, the processing unit can be a rack or a cluster.
[0064] In other embodiments, a single processing unit may also run multiple client nodes and / or multiple server nodes.
[0065] Figure 2 This is a diagram illustrating the data distribution. Client nodes and server nodes are distributed across multiple processing units.
[0066] In one embodiment of this application, the client node may store cached data, and the server node may store primary data and replica data corresponding to the cached data. The replica data may be backup data of the primary data or the cached data. The cached data of the client node may reside on the same processing unit as the primary data or replica data of the server node, or it may reside on a different processing unit. The primary data and replica data of the server node may reside on different processing units. When a processing unit fails, data can be recovered from other processing units.
[0067] See Figure 2 As shown, taking data1 as an example, data1 represents the cached data stored on the client node, data1(m) represents the primary data stored on a server node that is consistent with data1, and data1(s) represents the replica data stored on another server node that is consistent with data1. Figure 2 As shown, data2, data3, data4, data5, and data6 will not be described in detail.
[0068] For any given data, such as data1, three copies are stored in a client-server architecture software system: data1, data1(m), and data1(s). These three copies of data1 only ensure that data is not lost if a single processing unit fails. Since data1 stored on client node 1 and data1(m) stored on server node 1 both reside on processing unit 1, meaning processing unit 1 stores two identical copies of the data, this does not increase the reliability of the software system but consumes additional storage resources. These storage resources can include memory, disk, and storage media.
[0069] It should be understood that, without compromising data reliability, the current challenge is how to reduce the number of data copies to save storage resources.
[0070] Figure 3 This is a flowchart of the writing scenario of the data storage method disclosed in the embodiments of this application. Figure 3 by Figure 1 Let's take an application scenario as an example for illustration. The data storage method is applied to a data storage system, which includes multiple processing units. Each processing unit runs at least one client node and at least one server node. Client nodes and server nodes can be aware of their respective processing units. The data storage method specifically includes:
[0071] 301. Retrieve cached data and the first data distribution table, wherein the first data distribution table includes the primary location and the replica location of the data.
[0072] The data distribution strategy corresponding to the data distribution table in this application embodiment includes: the master data and replica data of any data in the data storage system are distributed in different processing units; and / or the number of master data and replica data in each processing unit is balanced; and any data has a corresponding master position and replica position, that is, including the master position and replica position of any data.
[0073] In the data distribution strategy, the business processing of client nodes and the data storage of server nodes are logically separated. That is, when the server formulates the data distribution strategy, it does not need to be aware of the storage location of cached data (i.e., it does not need to be aware of the client nodes storing cached data). Therefore, the data distribution strategy needs to include the primary and replica locations of any data.
[0074] Figure 4 This is the first data distribution table. Combined with... Figure 4 As shown, taking cached data1 as an example, the primary location of data1 is server node 1 running in processing unit 1, and the replica location of data1 is server node 2 running in processing unit 2. The primary and replica data of data1 are distributed in different processing units. The first data distribution table includes the primary location of data1 (server node 1 running in processing unit 1) and the replica location (server node 2 running in processing unit 2). The number of primary data and the number of replica data are equal or similar in each processing unit.
[0075] 302, write cached data to the first client node.
[0076] Combination Figure 4 As shown, the cached data can be one of data1, data2, data3, data4, data5, and data6. The cached data can be written to different client nodes (i.e., the first client node), for example, using... Figure 5 As shown in the example, if the cached data is data1, the first client node in step 302 is client node 1; if the cached data is data2, the first client node is client node 2; if the cached data is data3, the first client node is client node 3; if the cached data is data4, the first client node is client node 1; if the cached data is data5, the first client node is client node 2; if the cached data is data6, the first client node is client node 3.
[0077] like Figure 1 As shown, client node 1 and server node 1 run in processing unit 1, client node 2 and server node 2 run in processing unit 2, and client node 3 and server node 3 run in processing unit 3.
[0078] 303. Determine the first server node based on the master location of the cached data obtained from the first data distribution table.
[0079] like Figure 4 The first data distribution table shown indicates that if the cached data is data1, the first server node in step 303 can be determined as server node 1 based on the master position of the cached data in the first data distribution table. If the cached data is data2, the first server node is determined as server node 1 based on the master position of the cached data in the first data distribution table. If the cached data is data3, the first server node is determined as server node 2 based on the master position of the cached data in the first data distribution table. Data4, data5, and data6 will not be described further.
[0080] 304, write the master data that is consistent with the cached data to the first server node.
[0081] As in the example above, the master data of data1 is written to server node 1, the master data of data2 is written to server node 1, and the master data of data3 is written to server node 2. The details for data4, data5, and data6 are not elaborated upon.
[0082] 305. If the processing unit running the first client node is the same as the processing unit running the first server node, determine the copy location of the cached data according to the first data distribution table, and write the copy data that is consistent with the primary data to the server node corresponding to the determined copy location.
[0083] As in the example above, for data1, the processing unit running client node 1 (i.e., the first client node of data1) is the same as the processing unit running server node 1 (i.e., the first server node of data1). According to the first data distribution table, the replica location of data1 is determined to be server node 2, and the replica data data1(s) of data1 is written to server node 2.
[0084] In one embodiment of this application, if the processing unit running the first client node is different from the processing unit running the first server node, no copy data is written to the data storage system. Since the cached data and the main data are already located in different processing units, data security and reliability can be ensured, and there is no need to write copy data again to occupy additional storage space.
[0085] As in the example above, for data2, the processing unit running client node 2 (i.e., the first client node of data2) is different from the processing unit running server node 1 (i.e., the first server node of data2), so a copy of data2, data2(s), is not written to the data storage system. For data3, the processing unit running client node 3 (i.e., the first client node of data3) is different from the processing unit running server node 2 (i.e., the first server node of data3), so data3(s) is not written to the data storage system. Data4, data5, and data6 will not be described further.
[0086] Figure 5 This is a schematic diagram of the data distribution in the writing scenario of the data storage method disclosed in the embodiments of this application. Figure 5 This represents the write results for data1, data2, data3, data4, data5, and data6. Figure 2 In contrast, when using the data storage method provided in the embodiments of this application, Figure 5 This method saves storage resources required for data2(s), data3(s), data4(s), and data5(s) without compromising data reliability. If any processing unit fails, data can be recovered from another processing unit. Therefore, the data storage method of this embodiment saves storage resources while maintaining data reliability.
[0087] Figure 6 This is a flowchart illustrating a specific writing scenario of the data storage method disclosed in the embodiments of this application.
[0088] For data1, client node 1 writes data1 to the cache. Client node 1 synchronizes the write operation of data1 to server node 1, obtaining the primary data data1(m). Since both data1 and data1(m) are in processing unit 1, to ensure reliability, a replica data needs to be generated on server node 2 (which can be determined according to the first data distribution table). The replica data data1(s) is then written to server node 2.
[0089] For data2, client node 2 writes data2 to its cache. Client node 2 then synchronizes the write operation of data2 to server node 1, obtaining the primary copy of data2, data2(m). Since data2 and data2(m) are processed in different units, there is no need to write replica data.
[0090] For data3, client node 3 writes data3 to the cache. Client node 3 synchronizes the write operation of data3 to server node 2, obtaining the primary copy of data3, data3(m). Since data3 and data3(m) are in different processing units, there is no need to write the replica data. data4, data5, and data6 will not be described further.
[0091] The following describes a scaling-down scenario for the data storage method disclosed in the embodiments of this application.
[0092] If any processing unit in the data storage system fails or shrinks, that unit will be designated as a unit to be migrated out, indicating that the data within that unit needs to be migrated. Client nodes running on the unit to be migrated out are called client nodes, and server nodes running on that unit are called server nodes. Client nodes store the cached data to be migrated, and server nodes store the primary and replica data to be migrated. The data storage method also includes:
[0093] The second data distribution table is obtained by updating the first data distribution table based on the client nodes and server nodes of the remaining processing units other than the processing unit to be migrated out.
[0094] Specifically, based on the aforementioned data distribution strategy, the data storage system updates the first data distribution table according to the client nodes and server nodes of the processing units other than the processing unit to be migrated out, thus obtaining a second data distribution table. Alternatively, based on the data distribution strategy, the data storage system regenerates the second data distribution table according to the client nodes and server nodes of the processing units other than the processing unit to be migrated out.
[0095] Figure 7 This is the second data distribution table. Taking cached data1 as an example, the primary location of data1 is server node 1 running in processing unit 1, and the replica location of data1 is server node 2 running in processing unit 2.
[0096] In one embodiment of this application, the data storage method for the master data to be migrated further includes:
[0097] The master location of the master data to be migrated is determined according to the second data distribution table, which is the server node to be migrated to; the master data to be migrated is written to the server node to be migrated to; a second client node that stores cached data consistent with the master data to be migrated is determined; if the processing unit running the second client node is consistent with the processing unit running the server node to be migrated to, the second server node is determined according to the copy location of the master data to be migrated obtained from the second data distribution table; and copy data consistent with the master data to be migrated is written to the second server node.
[0098] like Figure 5 Data distribution diagram (in) Figure 5 Based on this, it is known that the processing unit to be migrated out is processing unit 3. Processing unit 3 (processing unit to be migrated out) runs client node 3 (client node to be migrated out) and server node 3 (server node to be migrated out). Client node 3 (client node to be migrated out) stores data3 and data6 (cache data to be migrated out), and server node 3 (server node to be migrated out) stores data5(m) and data6(m).
[0099] For data5(m), the master location of the corresponding master data data5(m) is determined to be server node 2 (the server node to be migrated) according to the second data distribution table; data5(m) is written to server node 2; client node 2 (the second client node) is determined to store cached data data5 that is consistent with data5(m); if the processing unit running client node 2 is consistent with the processing unit running server node 2, the replica location of data5(m) obtained from the second data distribution table is server node 1 (the second server node); replica data data5(s) that is consistent with data5(m) is written to server node 1.
[0100] Optionally, writing the master data to be migrated to the server node to be migrated includes: if there is replica data in the server node to be migrated that is consistent with the master data to be migrated, converting the replica data in the server node to be migrated that is consistent with the master data to be migrated into master data, and using it as the master data to be migrated.
[0101] For data6(m), the master location of the corresponding master data data6(m) is determined to be server node 1 (the server node to be migrated) according to the second data distribution table; such as Figure 5As shown, since a replica of data data6(s) identical to data6(m) already exists in server node 1, data6(s) is converted to data6(m). When processing unit 3 fails, the cached data data6 to be migrated is adjusted to client node 1. Based on the replica data data6(s) of server node 1, the replica data data6(s) is written to client node 1, that is, data6 is migrated to client node 1. If the processing unit running client node 1 is the same as the processing unit running server node 1, the replica location of data6(m) obtained from the second data distribution table is server node 2 (second server node). The replica data data6(s) identical to data6(m) is written to server node 2.
[0102] Optionally, writing the master data to be migrated to the server node to be migrated includes: if any client node in the processing unit running the server node to be migrated has cached data that is consistent with the master data to be migrated, writing the cached data that is consistent with the master data to be migrated to the server node to be migrated as the master data to be migrated.
[0103] For data3, client node 2 determines that data3(m) is stored in server node 2 according to the second data distribution table; data3 is restored from server node 2 to client node 2, that is, data3 is written to client node 2 according to the master data data3(m); if the processing unit running client node 2 is the same as the processing unit running server node 2, the replica location of data3(m) obtained from the second data distribution table is server node 1 (second server node); replica data data3(s) consistent with data3(m) is written to server node 1.
[0104] In one embodiment of this application, the data storage method for the copy data to be migrated further includes:
[0105] Based on the second data distribution table, a third client node storing cached data consistent with the replica data to be migrated is determined, and a third server node storing primary data consistent with the replica data to be migrated is determined. If the processing unit running the third client node is consistent with the processing unit running the third server node, the replica data to be migrated is written to the server node corresponding to the replica location of the replica data to be migrated, according to the second data distribution table.
[0106] In another embodiment of this application, if the processing unit running the third client node is different from the processing unit running the third server node, the replica data to be migrated will not be written to the server node corresponding to the replica location of the replica data to be migrated.
[0107] In one embodiment of this application, the data storage method for cached data to be migrated further includes:
[0108] Identify the client node with the lowest load in the data storage system and adjust the tasks corresponding to the cached data to be migrated to the client node with the lowest load in the data storage system; or identify the client node with the least remaining storage resources in the data storage system and adjust the tasks corresponding to the cached data to be migrated to the client node with the least remaining storage resources in the data storage system.
[0109] Figure 8 This is a schematic diagram of data distribution in a scaled-down scenario of the data storage method disclosed in the embodiments of this application. Figure 8 This indicates the result of scaling down processing unit 3. The shaded portion of processing unit 3 represents either a fault or scaling down. Figure 5 contrast, Figure 8 The data storage system lacks processing unit 3. The data storage system migrates or backs up the data in the original processing unit 3 to processing units 1 and 2.
[0110] Figure 9 This is a flowchart illustrating a specific scaling-down scenario of the data storage method disclosed in the embodiments of this application.
[0111] After processing unit 3 fails, data5(m) and data6(m) of server node 3 are lost, and data3 and data6 of client node 3 are also lost. The services corresponding to data3 and data6 of client node 3 are transferred to client node 2 and client node 1 for processing, respectively. The shaded areas of client node 3 and server node 3 indicate either a failure or downsizing.
[0112] For data5(m), according to the second data distribution table, data5(m) should be stored on server node 2. Since client node 2 stores cached data5, data5 can be restored from client node 2 to server node 2 based on the cached data5. That is, the server node 2 writes the master data data5(m) that is consistent with the cached data5. Because client node 2 and server node 2 are in the same processing unit, replica data needs to be generated to ensure reliability. After writing the master data data5(m) on server node 2, the replica data data5(s) is written on server node 1 according to the second data distribution table.
[0113] For data6(m), according to the adjusted data distribution strategy (second data distribution table), the primary data data6(m) should be stored in server node 1. Since server node 1 already has a replica data data6(s) identical to the primary data data6(m), the original replica data data6(s) in server node 1 can be changed to the primary data data6(m), meaning there is no need to repeatedly write the same data. Client node 1 (according to the adjusted data distribution strategy) discovers that the primary data data6(m) is in server node 1 and can directly restore the cached data data6 from server node 1, i.e., client node 1 writes data6 into the cache. Client node 1 initiates a data location check for data6 to server node 1. Since data6 and data6(m) are in the same processing unit 1, replica data needs to be generated to ensure reliability. Server node 1 generates the corresponding replica data data6(s) in server node 2 according to the data distribution strategy (second data distribution table).
[0114] For cached data3, client node 2 (according to the adjusted data distribution strategy) discovers the corresponding primary data data3(m) on server node 2, and then restores the data from server node 2. Client node 2 writes data3 into the cache. Client node 2 initiates a data location check for data3 with server node 2. Since data3 and data3(m) are in the same processing unit, a replica data needs to be generated to ensure reliability. Server node 2 generates the corresponding replica data data3(s) on server node 1 according to the data distribution strategy (second data distribution table).
[0115] The following describes the expansion scenarios of the data storage method disclosed in the embodiments of this application.
[0116] If the processing unit in the data storage system is expanded, the expanded processing unit will be used as the expansion processing unit. The expansion processing unit will run the fourth client node and the fourth server node. The data storage method also includes:
[0117] According to the expansion processing unit, the first data distribution table is updated to obtain the updated third data distribution table; according to the updated third data distribution table, the cache data to be written that needs to be stored by the fourth client node and the main data to be written that needs to be stored by the fourth server node are determined; the main data to be written is written to the fourth server node, the main data to be written is deleted from other server nodes in the data storage system; and the task corresponding to the cache data to be written is adjusted to the fourth client node.
[0118] Specifically, based on the aforementioned data distribution strategy, the data storage system updates the first data distribution table according to the client nodes and server nodes of the expanded processing unit and the original processing unit, resulting in an updated third data distribution table. Alternatively, based on the data distribution strategy, the data storage system regenerates the third data distribution table according to the client nodes and server nodes of the expanded processing unit and the original processing unit.
[0119] Figure 10 This is the third data distribution table. Taking cached data1 as an example, the primary location of data1 is server node 1 running in processing unit 1, and the replica location of data1 is server node 2 running in processing unit 2.
[0120] like Figure 5 Data distribution diagram (in) Figure 5 Based on the existing system, an additional expansion processing unit is added: processing unit 4. Processing unit 4 runs client node 4 (the fourth client node) and server node 4 (the fourth server node). Combined with... Figure 10 as well as Figure 11 As shown in the third data distribution table, client node 4 stores cached data data6 to be written, and server node 4 stores main data data4(m) to be written. Data4(m) can be migrated to server node 4, data4(m) can be deleted from server node 2, and data6 can be migrated to client node 4, or the task corresponding to data6 can be moved to client node 4 for execution.
[0121] In one embodiment of this application, after writing the master data to be written to the fourth server node, the data storage method further includes: determining the client node in the data storage system that stores cached data consistent with the master data to be written as the fifth client node; determining whether the processing unit running the fifth client node is consistent with the processing unit running the fourth server node; if the processing unit running the fifth client node is inconsistent with the processing unit running the fourth server node, determining the fifth server node according to the copy location of the master data to be written obtained from the updated third data distribution table; and deleting the copy data consistent with the master data to be written from the fifth server node.
[0122] Optionally, if the processing unit running the fifth client node is different from the processing unit running the fourth server node, no replica data to be written to the primary data will be generated in the data storage system.
[0123] In the example above, the primary data is data4(m), and the fourth server node is server node 4, running in processing unit 4. Combined with... Figure 5It can be seen that the fifth client node mentioned above is client node 1, which runs in processing unit 1. Processing unit 4 is inconsistent with processing unit 1, therefore, it does not generate a replica of data data4(s) in the data storage system.
[0124] In one embodiment of this application, the data storage method further includes: determining, according to an updated third data distribution table, the copy data to be written to be stored by a fourth server node; determining, according to the updated third data distribution table, a sixth client node storing cached data consistent with the copy data to be written, and a sixth server node storing primary data consistent with the copy data to be written; if the processing unit running the sixth client node is the same as the processing unit running the sixth server node, writing the copy data to be written to the fourth server node according to the updated third data distribution table.
[0125] Optionally, if the processing unit running the sixth client node is different from the processing unit running the sixth server node, and there is copy data to be written in the fourth server node, the copy data to be written is deleted from the fourth server node.
[0126] In another embodiment of this application, if the processing unit running the sixth client node is different from the processing unit running the sixth server node, the copy data to be written is not written to the fourth server node.
[0127] As in the example above, for the data data6(s) to be written to the copy, according to the updated third data distribution table, it is determined that data6(s) needs to be stored by server node 4 (fourth server node); according to the updated third data distribution table, it is determined that client node 4 (sixth client node) stores data6, and server node 3 (sixth server node) stores data6(m); if the processing unit running client node 4 is inconsistent with the processing unit running server node 3, data6(s) is not written to server node 4.
[0128] In one embodiment of this application, after adjusting the task corresponding to the cache data to be written to the fourth client node, the data storage method further includes: determining the server node in the data storage system that stores the master data consistent with the cache data to be written as the seventh server node, and determining whether the processing unit running the fourth client node is consistent with the processing unit running the seventh server node; if the processing unit running the fourth client node is inconsistent with the processing unit running the seventh server node, no copy data of the cache data to be written is generated in the data storage system.
[0129] As in the example above, after the task corresponding to data6 is adjusted to client node 4 (the fourth client node) (the cached data data6 is written to client node 4), the seventh server node storing the replica data data6(m) in the data storage system is server node 3. The processing unit running client node 4 is inconsistent with the processing unit running server node 3, and the replica data data6(s) to be written is not generated in the data storage system.
[0130] Figure 11 This is a schematic diagram of data distribution in a scenario of expanding the data storage method disclosed in the embodiments of this application. Figure 11 This indicates the result of expanding the capacity of processing unit 3. Specifically, processing unit 4 also underwent expansion, which is related to... Figure 5 contrast, Figure 11 The data storage system adds processing unit 3. The data storage system transfers data from processing units other than processing unit 4 to processing unit 4.
[0131] Figure 12 This is a flowchart illustrating a specific expansion scenario of the data storage method disclosed in the embodiments of this application.
[0132] For the primary data data4(m), after the data storage system expands to include processing unit 4, data4(m) is migrated from server node 2 to server node 4 according to the adjusted data distribution strategy (updated third data distribution table). After the migration is complete, server node 2 deletes data4(m). Client node 1 initiates a data location check for data4 with server node 4. Since data4 and data4(m) are in different processing units, there is no need to generate a replica.
[0133] For cached data data6, a replica data data6(s) is generated on server node 4 according to the adjusted data distribution strategy (updated third data distribution table). Server node 1 deletes the original replica data data6(s). After expanding processing unit 4, the business corresponding to the cached data data6 of client node 3 is adjusted to be processed by client node 4. Client node 4 discovers that the primary data data6(m) is on server node 3 (using the adjusted data distribution strategy), and then restores the data from server node 3 to client node 4, that is, writes the corresponding cached data to client node 4 according to the primary data data6(m) of server node 3. Client node 4 writes data6 into the cache. Client node 4 initiates a data location check for data6 with server node 3. Since data6 and data6(m) are in different processing units, there is no need to generate replica data. Server node 4 deletes data6(s).
[0134] The following describes modified scenarios of the data storage method disclosed in the embodiments of this application.
[0135] The data storage method is applied to a data storage system, which includes multiple processing units. Each processing unit runs at least one client node and at least one server node. A first client node stores cached data, and a first server node stores master data identical to the cached data. Specifically, the data storage method includes:
[0136] Determine whether the processing unit running the first client node is the same as the processing unit running the first server node; if the processing unit running the first client node is the same as the processing unit running the first server node, and there is no copy data consistent with the primary data in the data storage system, write copy data consistent with the primary data to any server node of the other processing unit; if the processing unit running the first client node is different from the processing unit running the first server node, delete the copy data consistent with the primary data in the data storage system.
[0137] For data storage systems where the replica data does not meet the above data distribution strategy, this embodiment can be used to modify the replica data stored in the data storage system by writing, deleting, etc.
[0138] In one embodiment of this application, if the client node cannot cache data, a server node on the processing unit where the client node is located can be used as a local data access node, i.e., a new client node.
[0139] The following describes the storage resources saved by the data storage method disclosed in the embodiments of this application.
[0140] If a data storage system comprises N processing units, each processing unit deploys one server node, and each processing unit deploys a fixed number of client nodes, and the client nodes' data is evenly backed up across all server nodes, with each server node storing 1 / N of the master data, only replicas of the master data on server nodes in the same processing unit as the client nodes are required. Therefore, the data storage system in this embodiment needs to store 1 + (1 / N) copies of the data. Typically, a data storage system needs to store 2 copies of the data; therefore, the data storage system in this embodiment saves 1 - 1 / N copies of the data, a saving ratio of (N-1) / 2N. The larger N is, the more storage resources are saved, and the saving ratio is closer to 50%.
[0141] Figure 13 This is an electronic device disclosed in the embodiments of this application (e.g. Figure 1 A structural diagram of the sites (in the diagram). Figure 13As shown, the electronic device 130 may include components such as: a radio frequency (RF) circuit 1301, a memory 1302, an input unit 1303, a display unit 1304, a sensor 1305, an audio circuit 1306, a Wi-Fi module 1307, a processor 1308, and a power supply 1309. Those skilled in the art will understand that... Figure 13 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0142] RF circuit 1301 can be used to send and receive information or, during a call, to receive and transmit signals. Specifically, after receiving downlink information from the base station, it forwards it to processor 1308 for processing; additionally, it transmits uplink data to the base station. Typically, RF circuit 1301 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc.
[0143] The memory 1302 can be used to store software programs and modules. The processor 1308 executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory 1302. The memory 1302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, etc.). In addition, the memory 1302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0144] The input unit 1303 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the electronic device. Specifically, the input unit 1303 may include a touch panel 13031 and other input devices 13032. The touch panel 13031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 13031), and drive the corresponding connected devices according to a pre-set program. Optionally, the touch panel 13031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 1308, and receives and executes commands from the processor 1308. In addition, the touch panel 13031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 13031, the input unit 1303 may also include other input devices 13032. Specifically, other input devices 13032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0145] Display unit 1304 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device. Display unit 1304 may include display panel 13041, optionally configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 13041. Further, touch panel 13031 may cover display panel 13041. When touch panel 13031 detects a touch operation on or near it, it transmits the information to processor 1308 to determine the type of touch event. Subsequently, processor 1308 provides corresponding visual output on display panel 13041 based on the type of touch event. Although in Figure 13 In this embodiment, the touch panel 13031 and the display panel 13041 are two separate components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 13031 and the display panel 13041 can be integrated to realize the input and output functions of the electronic device.
[0146] The electronic device may also include at least one sensor 1305, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 13041 according to the ambient light level, and the proximity sensor can turn off the display panel 13041 and / or the backlight when the electronic device is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the electronic device (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometers, taps), etc. In addition, the electronic device may also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be described in detail here.
[0147] Audio circuit 1306, speaker 13061, and microphone 13062 provide an audio interface between the user and the electronic device. Audio circuit 1306 converts received audio data into electrical signals and transmits them to speaker 13061, where speaker 13061 converts them into sound signals for output. On the other hand, microphone 13062 converts collected sound signals into electrical signals, which are received by audio circuit 1306, converted into audio data, and then processed by processor 1308 before being sent to another electronic device via RF circuit 1301, or the audio data can be output to memory 1302 for further processing.
[0148] Wi-Fi is a short-range wireless transmission technology. Electronic device 130, through Wi-Fi module 1307, can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 13 Wi-Fi module 1307 is shown, but it is understood that it is not an essential component of the electronic device and can be omitted as needed without changing the nature of the invention.
[0149] The processor 1308 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 1302, and by calling data stored in the memory 1302, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 1308 may include one or more processing units; preferably, the processor 1308 may integrate an application processor and a modem, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem mainly handles wireless communication. It is understood that the aforementioned modem processor may not be integrated into the processor 1308.
[0150] The electronic device also includes a power supply 1309 (such as a battery) that supplies power to various components. Optionally, the power supply can be logically connected to the processor 1308 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0151] Although not shown, electronic devices may also include cameras, Bluetooth modules, etc., which will not be described in detail here.
[0152] Figure 13 The electronic devices described herein can be used to implement some or all of the processes in the method embodiments described in this application. Please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.
[0153] This embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the memory reclamation method in the above embodiment.
[0154] This embodiment also provides a computer program product that, when run on an electronic device, causes the electronic device to perform the aforementioned steps to implement the memory reclamation method described in the above embodiment.
[0155] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the memory reclamation methods in the above-described method embodiments.
[0156] In this embodiment, the electronic device, computer storage medium, computer program product or chip are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding method provided above, and will not be repeated here.
[0157] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0158] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0159] The unit described as a separate component may or may not be physically separate. The component shown as a unit can be one physical unit or multiple physical units, that is, it can be located in one place or distributed in multiple different places. Some or all of the units can be selected to achieve the purpose of the solution in this embodiment according to actual needs.
[0160] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0161] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially or in other words, the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0162] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data storage method, applied to a data storage system, characterized in that, The data storage system includes multiple processing units, each processing unit running at least one client node and at least one server node, and the data storage method includes: Obtain cached data and a first data distribution table, wherein the first data distribution table includes the primary location and replica location of the data; The cached data is written to the first client node; The first server node is determined based on the primary location of the cached data obtained from the first data distribution table; Write the master data, which is consistent with the cached data, into the first server node; If the processing unit running the first client node is the same as the processing unit running the first server node, the replica location of the cached data is determined according to the first data distribution table, and the replica data that is consistent with the primary data is written to the server node corresponding to the determined replica location. If the processing unit running the first client node is different from the processing unit running the first server node, the copy data will not be written into the data storage system.
2. The data storage method as described in claim 1, characterized in that, The data distribution table includes the first data distribution table, and the data distribution strategy corresponding to the data distribution table includes: In the data storage system, the primary and replica data of any single piece of data are distributed across different processing units; and / or The amount of primary data and replica data in each processing unit is balanced; and Each piece of data exists in a corresponding master location and a replica location.
3. The data storage method as described in claim 1, characterized in that, If any processing unit in the data storage system fails or shrinks, the failed or shrunk processing unit will be designated as a migration-out processing unit. This migration-out processing unit runs a client node and a server node to be migrated out. The client node stores the cached data to be migrated, and the server node stores the primary data and replica data to be migrated. The data storage method further includes: The first data distribution table is updated based on the client nodes and server nodes of the other processing units besides the processing unit to be migrated out, to obtain the second data distribution table.
4. The data storage method as described in claim 3, characterized in that, For the master data to be migrated, the data storage method further includes: Based on the second data distribution table, the master location of the master data to be migrated is determined as the server node to be migrated to. Write the master data to be migrated to the server node to be migrated; Identify a second client node that stores cached data consistent with the master data to be migrated; If the processing unit running the second client node is the same as the processing unit running the server node to be migrated, the second server node is determined according to the replica location of the master data to be migrated obtained from the second data distribution table; Write replica data that is consistent with the master data to be migrated to the second server node.
5. The data storage method as described in claim 4, characterized in that, If there is a replica data in the server node to be migrated that is consistent with the master data to be migrated, the replica data in the server node to be migrated that is consistent with the master data to be migrated is converted into master data and used as the master data to be migrated.
6. The data storage method as described in claim 4, characterized in that, The step of writing the master data to be migrated to the server node to be migrated includes: If any client node in the processing unit running the server node to be migrated has cached data that is consistent with the master data to be migrated, the cached data that is consistent with the master data to be migrated is written to the server node to be migrated as the master data to be migrated.
7. The data storage method as described in claim 4, characterized in that, For the replica data to be migrated, the data storage method further includes: Based on the second data distribution table, a third client node that stores cached data consistent with the replica data to be migrated is determined, and a third server node that stores master data consistent with the replica data to be migrated is determined. If the processing unit running the third client node is the same as the processing unit running the third server node, the replica data to be migrated is written to the server node corresponding to the replica location of the replica data to be migrated, according to the second data distribution table.
8. The data storage method as described in claim 7, characterized in that, If the processing unit running the third client node is different from the processing unit running the third server node, the replica data to be migrated will not be written to the server node corresponding to the replica location of the replica data to be migrated.
9. The data storage method as described in claim 4, characterized in that, For the cached data to be migrated, the data storage method further includes: The client node with the lowest load in the data storage system is determined, and the task corresponding to the cached data to be migrated is adjusted to the client node with the lowest load in the data storage system. Alternatively, the client node with the least remaining storage resources in the data storage system can be identified, and the task corresponding to the cached data to be migrated can be adjusted to the client node with the least remaining storage resources in the data storage system.
10. The data storage method as described in claim 1, characterized in that, If the processing unit in the data storage system is expanded, the expanded processing unit will be used as the expansion processing unit. The expansion processing unit will run a fourth client node and a fourth server node. The data storage method further includes: According to the expansion processing unit, the first data distribution table is updated to obtain the updated third data distribution table; Based on the updated third data distribution table, determine the cache data to be written that needs to be stored by the fourth client node and the main data to be written that needs to be stored by the fourth server node; Write the master data to be written to the fourth server node, and delete the master data to be written from other server nodes in the data storage system; The task corresponding to the cached data to be written is moved to the fourth client node.
11. The data storage method as described in claim 10, characterized in that, After writing the master data to be written to the fourth server node, the data storage method further includes: The client node that stores cached data consistent with the main data to be written in the data storage system is identified as the fifth client node, and it is determined whether the processing unit running the fifth client node is consistent with the processing unit running the fourth server node. If the processing unit running the fifth client node is different from the processing unit running the fourth server node, the fifth server node is determined according to the location of the replica of the master data to be written, obtained from the updated third data distribution table. Delete the replica data that is consistent with the primary data to be written from the fifth server node.
12. The data storage method as described in claim 11, characterized in that, If the processing unit running the fifth client node is different from the processing unit running the fourth server node, the replica data to be written to the primary data will not be generated in the data storage system.
13. The data storage method as described in claim 10, characterized in that, The data storage method further includes: Based on the updated third data distribution table, determine the copy data to be written that needs to be stored by the fourth server node; Based on the updated third data distribution table, a sixth client node that stores cached data consistent with the copy data to be written is determined, and a sixth server node that stores primary data consistent with the copy data to be written is determined. If the processing unit running the sixth client node is the same as the processing unit running the sixth server node, the copy data to be written is written to the fourth server node according to the updated third data distribution table.
14. The data storage method as described in claim 13, characterized in that, If the processing unit running the sixth client node is different from the processing unit running the sixth server node, and the fourth server node contains the copy data to be written, then the copy data to be written is deleted from the fourth server node.
15. The data storage method as described in claim 13, characterized in that, If the processing unit running the sixth client node is different from the processing unit running the sixth server node, the copy data to be written will not be written to the fourth server node.
16. The data storage method as described in claim 10, characterized in that, After adjusting the task corresponding to the cached data to be written to the fourth client node, the data storage method further includes: The server node in the data storage system that stores the same master data as the cache data to be written is determined as the seventh server node, and it is determined whether the processing unit running the fourth client node is the same as the processing unit running the seventh server node. If the processing unit running the fourth client node is different from the processing unit running the seventh server node, a copy of the cached data to be written will not be generated in the data storage system.
17. A data storage method, applied to a data storage system, characterized in that, The data storage system includes multiple processing units, each processing unit running at least one client node and at least one server node, wherein a first client node stores cached data, and a first server node stores master data consistent with the cached data. The data storage method includes: Determine whether the processing unit running the first client node is the same as the processing unit running the first server node; If the processing unit running the first client node is the same as the processing unit running the first server node, and there is no copy data consistent with the master data in the data storage system, copy data consistent with the master data is written to any server node of the other processing unit. If the processing unit running the first client node is inconsistent with the processing unit running the first server node, delete the copy data in the data storage system that is consistent with the primary data.
18. A computer-readable storage medium, characterized in that, It includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the data storage method as described in any one of claims 1 to 17.
19. An electronic device, characterized in that, The electronic device includes a processor and a memory, the processor being configured to invoke instructions in the memory to cause the electronic device to perform the data storage method as described in any one of claims 1 to 17.
Citation Information
Patent Citations
System expansion method and device of redundant array of independent disks (RAID)
CN103513938A
Data balancing method and device and management device in distributed storage system
CN108023967A