Data processing method and device

By receiving data processing instructions in the distributed system, synchronously requesting operations and selecting the target node, the performance problems caused by slave node data redundancy in the distributed system are solved, and the efficient operation and data consistency of the system are achieved.

CN113301084BActive Publication Date: 2024-09-27ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010613714.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-09-27
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

In a distributed system, since slave nodes need to store a large amount of data in preparation for election as the master node, performance is affected, and an effective method is urgently needed to solve such problems.

Method used

By receiving data processing instructions, appending them to the log, initiating a synchronization request operation, causing the slave node to copy the log entries, and in the case of safe replication from the slave node, selecting the target node from multiple slave nodes, applying the log entries to the master node and The state machine of the target node ensures data consistency and availability.

Benefits of technology

It improves the availability and performance of distributed systems, reduces data redundancy, and helps improve the operating efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113301084B
    Figure CN113301084B
Patent Text Reader

Abstract

The embodiments of the present specification provide a data processing method and device, wherein the data processing method includes: receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction; initiating a synchronization request operation to m slave nodes in a distributed system so that the slave nodes copy the log entry; when the slave nodes safely copy the log entry, selecting n slave nodes from the m slave nodes as target nodes; applying the log entry to the state machine of the master node of the distributed system and the state machine of the target node, and returning the execution result of the state machine of the master node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of data processing technology, and in particular to a data processing method. One or more embodiments of this specification also relate to a data processing apparatus, a computing device, and a computer-readable storage medium. Background Art

[0002] With the rapid development of Internet technology, the application scope of distributed systems is becoming wider and wider. Since the distributed system contains multiple distributed nodes and the distributed system can provide data read / write services for the client, the client can access the data through any distributed node in the distributed system. In order to ensure that the data accessed by the client through any distributed node in the distributed system is consistent, the distributed nodes in the distributed system are generally divided into a master node and multiple slave nodes. The master node can not only modify the data stored in itself, but also modify the data stored in the multiple slave nodes, thereby ensuring the consistency of the data in the distributed system.

[0003] After the distributed system is created, the distributed system can randomly select a distributed node from the multiple distributed nodes as the master node, and use the distributed nodes in the distributed system except the master node as slave nodes. In the event of a failure of the master node, the master node can be re-elected from other slave nodes. Therefore, in order to ensure that the slave node can be elected as the master node and provide services to the client, a large amount of data needs to be stored in each node, which has a certain impact on the performance of the distributed system. Therefore, an effective method is urgently needed to solve this problem. Summary of the invention

[0004] In view of this, the present specification provides a data processing method. One or more embodiments of the present specification also relate to a data processing device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.

[0005] According to one aspect of an embodiment of this specification, a data processing method is provided, including:

[0006] receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction;

[0007] Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer;

[0008] In the case where the slave node safely replicates the log entry, n slave nodes are selected from the m slave nodes as target nodes; wherein n is a positive integer, m>n;

[0009] Apply the log entry to the state machine of the master node of the distributed system and the state machine of the target node, and return the execution result of the state machine of the master node.

[0010] Optionally, before the steps of receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, the steps further include:

[0011] Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0012] Determine a threshold value of the number of data copies to be created associated with each node according to the node fault tolerance;

[0013] According to the quantity threshold and the identification information of each node, a data copy is created on each node respectively.

[0014] Optionally, before the steps of receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, the steps further include:

[0015] Distributing the acquired data to be sharded to each node of the distributed system according to a preset sharding rule;

[0016] Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0017] Determine a preset threshold of the data replicas to be created associated with the data shards of each node according to the node fault tolerance;

[0018] According to the preset threshold and the identification information of the data shards in each node, a data copy is created in each node respectively.

[0019] Optionally, before the steps of receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, the steps further include:

[0020] Determine a preset number threshold of data copies to be created for each node in the distributed system according to the number of nodes in the distributed system and the total number of data shards in the distributed system;

[0021] According to the preset quantity threshold and identification information of the data shards in each node, a data copy is created in each node respectively.

[0022] Optionally, the data processing instruction carries keyword information of the data to be processed;

[0023] Accordingly, before the step of selecting n slave nodes from the m slave nodes as target nodes is performed, the step further includes:

[0024] Determine identification information of the data shard to which the to-be-processed data belongs according to the keyword information, and determine whether the master node contains a data copy associated with the data shard according to the identification information;

[0025] If so, the step of selecting n slave nodes from the m slave nodes as target nodes is executed.

[0026] Optionally, the selecting n slave nodes from the m slave nodes as target nodes includes:

[0027] Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes.

[0028] Optionally, the data processing instruction carries keyword information of the data to be processed;

[0029] Correspondingly, the selecting n slave nodes from the m slave nodes as target nodes includes:

[0030] Determine identification information of the data shard to which the data to be processed belongs according to the keyword information;

[0031] Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; wherein a preset threshold value ≤n+1≤m.

[0032] Optionally, if the heartbeat information returned by the master node is not received within the preset election period, the result of determining whether the master node contains a data copy associated with the data shard is no, and the following operations are performed:

[0033] Determine a candidate node according to the identification information;

[0034] Initiate an election instruction to the m slave nodes, and elect a new master node of the distributed system from the candidate nodes through the election instruction;

[0035] Obtaining voting results submitted by each slave node for voting on the candidate node;

[0036] The voting results are counted, and the first candidate node that obtains a number of votes greater than a preset threshold is determined as a new master node of the distributed system.

[0037] Optionally, the selecting n slave nodes from the m slave nodes as target nodes includes:

[0038] Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; n+1≤m.

[0039] Optionally, creating a data copy in each node according to the preset threshold and identification information of the data shard in each node includes:

[0040] Determine, based on the identification information, whether the initial node contains a data copy associated with the target data shard;

[0041] If not included, determining, based on the identification information, whether the number of data copies associated with the target data shard in the distributed system is greater than or equal to a preset copy number threshold;

[0042] If not, determining whether the number of data copies contained in the initial node is less than a preset copy number threshold;

[0043] If it is less, a data copy associated with the target data shard is created in the initial node.

[0044] According to another aspect of an embodiment of this specification, there is provided a data processing device, including:

[0045] A receiving module, configured to receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction;

[0046] A request initiation module is configured to initiate a synchronization request operation to m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer;

[0047] A selection module is configured to select n slave nodes from the m slave nodes as target nodes when the slave node safely replicates the log entry; wherein n is a positive integer, m>n;

[0048] The application module is configured to apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

[0049] According to another aspect of an embodiment of this specification, there is provided a computing device, including:

[0050] Memory and processor;

[0051] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions:

[0052] receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction;

[0053] Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer;

[0054] In the case where the slave node safely replicates the log entry, n slave nodes are selected from the m slave nodes as target nodes; wherein n is a positive integer, m>n;

[0055] Apply the log entry to the state machine of the master node of the distributed system and the state machine of the target node, and return the execution result of the state machine of the master node.

[0056] According to another aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the data processing method are implemented.

[0057] An embodiment of the present specification receives a data processing instruction, appends the data processing instruction to a log, obtains a log entry of the data processing instruction, initiates a synchronization request operation to m slave nodes in a distributed system, so that the slave nodes copy the log entry, selects n slave nodes from the m slave nodes as target nodes when the slave nodes safely copy the log entry, applies the log entry to a state machine of a master node of the distributed system and a state machine of the target node, and returns an execution result of the state machine of the master node;

[0058] It is possible to determine several nodes as target nodes from multiple slave nodes in a distributed system and apply log entries to the master node and the target node. On the one hand, it can ensure the availability and other performance of the distributed system, and on the other hand, it can reduce the redundancy of data in the distributed system, which is conducive to improving the operation efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 is a processing flow chart of a data processing method provided by an embodiment of this specification;

[0060] Figure 2 is a schematic diagram of a distributed system provided by an embodiment of this specification;

[0061] Figure 3 It is a processing flow chart of a data processing method provided by an embodiment of this specification applied to an actual scenario;

[0062] Figure 4 is a schematic diagram of a data processing device provided by an embodiment of this specification;

[0063] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0064] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0065] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0066] It should be understood that although various information may be described using terms in one or more embodiments of the present specification, such information should not be limited to these terms. Depending on the context, the word "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determining".

[0067] First, the terms involved in one or more embodiments of this specification are explained.

[0068] Consistency protocol: distributed consistency protocols such as raft and paxos.

[0069] Replica: A redundant data unit that is replicated by the consistency protocol to achieve fault tolerance.

[0070] In this specification, a data processing method is provided. This specification also relates to a data processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0071] Figure 1 A processing flow chart of a data processing method provided according to an embodiment of the present specification is shown, including steps 102 to 108.

[0072] Step 102: Receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction.

[0073] With the rapid development of Internet technology, the application scope of distributed systems is becoming wider and wider. Since a distributed system contains multiple distributed nodes and the distributed system can provide data read / write services for clients, clients can access data through any distributed node in the distributed system.

[0074] After the distributed system is created, the distributed system can include multiple distributed nodes, one of which is a master node, and all other nodes except the master node are slave nodes. In the event of a failure of the master node, the master node can be re-elected from other slave nodes. In order to ensure that the slave node can be elected as the master node and provide services to the client, each slave node needs to store a large amount of data, which has a certain impact on the performance of the distributed system.

[0075] Based on this, an embodiment of the present specification provides a data processing method, which receives a data processing instruction, appends the data processing instruction to a log, obtains a log entry of the data processing instruction, initiates a synchronization request operation to m slave nodes in a distributed system, so that the slave nodes copy the log entry, selects n slave nodes from the m slave nodes as target nodes when the slave nodes safely copy the log entry, applies the log entry to the state machine of the master node of the distributed system and the state machine of the target node, and returns the execution result of the state machine of the master node;

[0076] Determine several nodes as target nodes from multiple slave nodes in the distributed system, and apply log entries to the master node and the target node. On the one hand, it can ensure the availability and other performance of the distributed system, and on the other hand, it can reduce the redundancy of data in the distributed system, which is conducive to improving the operation efficiency of the system.

[0077] Specifically, the data processing instruction may be a data write instruction. After receiving the data write instruction, a log is written through the consistency protocol layer, that is, the data write instruction is appended to the log to obtain a log entry of the data processing instruction. The master node in the distributed system synchronizes the log to other slave nodes through a synchronization mechanism.

[0078] In specific implementation, before receiving the data processing instruction, it is necessary to create a data copy on each node of the distributed system, which can be achieved in the following ways:

[0079] Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0080] Determine a threshold value of the number of data copies to be created associated with each node according to the node fault tolerance;

[0081] According to the quantity threshold and the identification information of each node, a data copy is created on each node respectively.

[0082] Specifically, the node fault tolerance means the number of distributed nodes that the distributed system allows to fail simultaneously, on the premise of being able to provide services to clients normally. Different numbers of distributed nodes in the distributed system mean different numbers of distributed nodes that are allowed to fail simultaneously.

[0083] If the data processing instruction is a data write instruction, after determining the target distributed node to which the data to be processed in the write instruction belongs, and processing the write instruction to obtain a processing result, the processing result may be stored in a data copy associated with the target distributed node;

[0084] If the received data processing instruction is a data read instruction, and the distributed node to which the data to be processed in the read instruction belongs is the target distributed node, the distributed system can provide services by including distributed nodes associated with the data copies; therefore, in order to ensure the availability of distributed nodes (in the event that one of the nodes fails, services can still be provided to the client normally through other nodes), the number of data copies associated with the target distributed node in the distributed system can be determined based on the node fault tolerance of the distributed system.

[0085] In actual applications, after the master node of the distributed system receives the data write instruction from the client, it needs to append the data write instruction to the log, obtain the log entry of the data write instruction, and store the generated execution result in the data copy by executing the log entry. The client can query the execution result in the data copy. Therefore, in order to successfully provide services to the client, a data copy related to the data to be processed in the data write instruction must exist in the master node.

[0086] If x represents the number of distributed nodes in the distributed system (x=m+1), and f represents the node fault tolerance of the distributed system (the node fault tolerance is an integer), then the node fault tolerance of the distributed system can be calculated by the formula 2f+1=x, where f is an integer; if y represents the threshold value of the number of data copies to be created associated with each node in the distributed system, then the threshold value of the number can be calculated by y=f+1.

[0087] Taking the case where the distributed system includes 3 distributed nodes as an example, by substituting x=3 into the formula 2f+1=x, the node fault tolerance of the distributed system can be determined to be f=1; similarly, if the distributed system includes 4 distributed nodes, the node fault tolerance of the distributed system is also 1;

[0088] After determining that the node fault tolerance of the distributed system is 1, substituting f=1 into the formula y=f+1, it can be determined that the threshold value of the number of data copies to be created associated with each node in the distributed system is y=2, that is, at least one data copy associated with the target data shard is created in each of the two distributed nodes of the distributed system;

[0089] If the distributed system contains 3 distributed nodes, a data copy can be created in any two distributed nodes respectively; if the distributed system contains 4 distributed nodes, a data copy can be created in any two or any three distributed nodes respectively.

[0090] By reducing the number of data copies in a distributed system, it is helpful to reduce data redundancy in the distributed system and improve the efficiency of system operation.

[0091] Furthermore, the number of data replicas to be created in each node in the distributed system can be determined in the following way:

[0092] Distributing the acquired data to be sharded to each node of the distributed system according to a preset sharding rule;

[0093] Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0094] Determine a preset threshold of the data replicas to be created associated with the data shards of each node according to the node fault tolerance;

[0095] According to the preset threshold and the identification information of the data shards in each node, a data copy is created in each node respectively.

[0096] Specifically, the preset threshold is a lower limit of the number of data copies to be created in association with the data shards in each node.

[0097] In order to ensure higher performance and greater scalability of the distributed system, data sharding technology can be used to distribute application data (data to be sharded) to different distributed nodes according to certain sharding rules.

[0098] Therefore, in order to ensure the availability of distributed nodes (in the event that one of the nodes fails, services can still be provided to the client normally through other nodes), the number of data copies associated with the target data shard in the distributed system can be determined based on the node fault tolerance of the distributed system, that is, the preset threshold of the data copies to be created associated with the data shards of each node can be determined based on the node fault tolerance.

[0099] In specific implementation, if x represents the number of distributed nodes in the distributed system and f represents the node fault tolerance of the distributed system, the node fault tolerance of the distributed system can be calculated by the formula 2f+1=x, where f is an integer; if y represents the preset threshold of the data copy to be created associated with the target data shard in the distributed system, the preset threshold can be calculated by y=f+1.

[0100] If the data to be sharded is divided into data shard A, data shard B and data shard C according to the preset sharding rules, taking the distributed system containing 3 distributed nodes and the target data shard being data shard A as an example, by substituting x=3 into the formula 2f+1=x, the node fault tolerance f=1 of the distributed system can be determined; after determining that the fault tolerance of the distributed system is 1, f=1 can be substituted into the formula y=f+1, and it can be obtained that the preset threshold of the data copy to be created associated with the target data shard A in the distributed system is 2, that is, in order to ensure that the system can provide services to the client normally, it is necessary to create a data copy of the target data shard A in any two distributed nodes of the distributed system respectively;

[0101] Similarly, if the distributed system contains 4 distributed nodes, the fault tolerance of the distributed system is also 1. After determining the fault tolerance of the distributed system, f can be substituted into the formula y=f+1, and it can be obtained that the preset threshold of the data copy to be created associated with the target data shard A in the distributed system is 2. That is, in order to ensure that the system can provide services to the client normally, at least one data copy associated with the target data shard A must be created in any two nodes of the distributed system, and one data copy associated with the target data shard A must be created in any three nodes of the distributed system.

[0102] In addition, the method for determining the number of data copies to be created for data shard B and data shard C is similar to that for data copy A, and will not be repeated here.

[0103] By using data sharding technology, application data (data to be sharded) is distributed to different distributed nodes according to certain sharding rules. When precise query or small-range query is needed, according to the sharding rules, the query only affects the node where the target data shard is located, while other nodes can continue to provide services to the outside world, so that the distributed database can provide higher concurrent access performance to the outside world.

[0104] Furthermore, according to the preset threshold and the identification information of the data shards in each node, a data copy is created in each node respectively, which can be specifically implemented in the following manner:

[0105] Determine, based on the identification information, whether the initial node contains a data copy associated with the target data shard;

[0106] If not included, determining, according to the identification information, whether the number of data copies associated with the target data shard in the distributed system is greater than or equal to a third preset threshold;

[0107] If not, determining whether the number of data copies contained in the initial node is less than a fourth preset threshold;

[0108] If it is less, a data copy associated with the target data shard is created in the initial node.

[0109] Specifically, the third preset threshold is the upper limit of the number of data copies associated with the target data shard in the distributed system; the fourth preset threshold is the upper limit of the number of data copies in each node.

[0110] In order to ensure load balancing of each node in a distributed system, data copies need to be evenly distributed, and in order to ensure availability, the copies to be created associated with the same data shard need to be created on different distributed nodes. Therefore, in determining the preset threshold of the data copies to be created associated with the data shards of each node, and creating data copies according to the preset threshold and the identification information of the data shards in each node, it can be determined based on the identification information whether the initial node of the distributed system contains the data copy associated with the target data shard; if not, determine whether the number of data copies associated with the target data shard in the distributed system exceeds the upper limit of the number of copies based on the identification information; if not, determine whether the number of data copies associated with the target data shard in the distributed system exceeds the upper limit of the number of copies based on the identification information; if not, determine whether the number of data copies contained in the initial node is lower than the upper limit of the number of copies; if lower, create a data copy associated with the target data shard in the initial node.

[0111] Still taking the example of the distributed system containing three distributed nodes, namely node 1, node 2 and node 3, if the data to be sharded is divided into data shard A, data shard B and data shard C according to the preset sharding rule, the target data shard is data shard A, and it can be calculated that the number of data copies to be created associated with data shard A is 2. If you plan to create a data copy in node 1 (initial node), before creating it, you need to determine whether node 1 already contains a data copy associated with data shard A. If not, determine whether the number of data copies associated with data shard A in the distributed system is greater than or equal to 2. If less than, determine whether the number of data copies contained in node 1 is less than 2. If so, create 1 data copy associated with data shard A in node 1.

[0112] In addition, if it is determined based on the identification information that the initial node contains a data copy associated with the target data shard, then continue to determine whether the next node contains a data copy associated with the target data shard based on the identification information; or, if it is determined based on the identification information that the number of data copies associated with the target data shard in the distributed system is greater than or equal to a third preset threshold, then continue to create data copies associated with other data shards; or, if it is determined that the number of data copies contained in the initial node is greater than or equal to a fourth preset threshold, then determine whether the next node contains a data copy associated with the target data shard based on the identification information.

[0113] The schematic diagram of the creation result of the data copy is as follows Figure 2 As shown, Figure 2 The distributed system shown in the figure contains three nodes (x=3), namely, node 1, node 2 and node 3, and contains three data shards, namely, data shard A, data shard B and data shard C. Each data shard is distributed on a different node. Then, according to the formula 2f+1=x, the node fault tolerance of the distributed system is determined to be f=1. The number of data copies to be created for each node is 2. Figure 2 It can be seen that node 1 contains data copies A0 and B1 associated with data shard A and data shard B, node 2 contains data copies B0 and C1 associated with data shard B and data shard C, and node 3 contains data copies A1 and C0 associated with data shard A and data shard C.

[0114] in addition, Figure 2 a0, a1, a2, b0, b1, b2, c0, c1, c2 are all log copies, which are used to store log entries of data processing instructions. After node 1 receives the data processing instruction, it determines that the data shard to which the information to be processed belongs is data shard A according to the keyword information of the information to be processed in the data processing instruction, and then node 1 synchronizes the log entry of the data processing instruction to a1 of node 2 and a3 of node 3. The processing process of node 2 and node 3 after receiving the data processing instruction is similar to that of node 1, which will not be repeated here.

[0115] Determine several nodes as target nodes among multiple nodes in the distributed system, and create data copies associated with the target data shards in the target nodes. On the one hand, it can ensure the availability and other performance of the distributed system, and on the other hand, it can reduce the redundancy of data in the distributed system, which is conducive to improving the operation efficiency of the system.

[0116] In addition, the number of data copies to be created for each node in the distributed system can also be determined in the following ways:

[0117] Determine a preset number threshold of data copies to be created for each node in the distributed system according to the number of nodes in the distributed system and the total number of data shards in the distributed system;

[0118] According to the preset quantity threshold and identification information of the data shards in each node, a data copy is created in each node respectively.

[0119] Specifically, the preset quantity threshold is the lower limit of the number of data copies associated with the target data shard in the distributed system, and may also represent the lower limit of the number of distributed nodes that include the data copies associated with the target data shard.

[0120] If the number of distributed nodes in a distributed system is x, the node fault tolerance is f, and the number of data shards in the system is z, y represents the preset number threshold of data copies to be created in each node associated with the target data shard, then y = (xf)z / x.

[0121] Taking the example of 5 nodes and 5 data shards in a distributed system, substituting x=5 into 2f+1=5, we can obtain the node fault tolerance of the distributed system f=3. Substituting z=5, x=5, and f=2 into the formula y=(xf)z / x, we can obtain the preset number threshold y=3 of data copies to be created in each node associated with the target data shard, that is, the lower limit of the number of distributed nodes containing data copies associated with the target data shard in the distributed system is 3. Therefore, data copies associated with the target data shard can be created in 3 or 4 distributed nodes in the distributed system.

[0122] After determining the number of data copies to be created for each node in the distributed system, the specific creation process can refer to the aforementioned data copy creation process, which will not be repeated here.

[0123] Determine several nodes as target nodes among multiple nodes in the distributed system, and create data copies associated with the target data shards in the target nodes. On the one hand, it can ensure the availability and other performance of the distributed system, and on the other hand, it can reduce the redundancy of data in the distributed system, which is conducive to improving the operation efficiency of the system.

[0124] Step 104, initiating a synchronization request operation to m slave nodes in the distributed system, so that the slave nodes replicate the log entry; wherein m is a positive integer.

[0125] Specifically, the master node in the distributed system implements log synchronization through a synchronization mechanism. The synchronization mechanism is that the master node appends the data processing instructions submitted by each client to the log, obtains the log entry of the data processing instruction, and initiates a synchronization request operation to all other slave nodes, allowing the slave nodes to copy the log entry to achieve data consistency in the distributed system.

[0126] Step 106, in the case where the slave node safely replicates the log entry, select n slave nodes from the m slave nodes as target nodes; wherein n is a positive integer, m>n.

[0127] Specifically, the consensus protocol algorithm (Raft algorithm) ensures that all submitted log entries are persistent and will eventually be executed by all available state machines. Once the master node that created the log entry has copied it to more than half of the slave nodes (i.e., the slave nodes have safely copied the log entry), the log entry will be submitted, and the master node will apply the submitted log entry to the state machine.

[0128] In specific implementation, the data processing instruction carries keyword information of the data to be processed, and n slave nodes are selected from the m slave nodes as target nodes, which can be specifically implemented in the following manner:

[0129] Determine identification information of the data shard to which the data to be processed belongs according to the keyword information;

[0130] Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; wherein a preset threshold value ≤n+1≤m.

[0131] Specifically, the preset threshold is the lower limit of the number of data copies to be created associated with the data shard in the nodes of the distributed system, and may also represent the lower limit of the number of distributed nodes in the distributed system that contain data copies associated with the target data shard. If the master node is taken as one target node, n+1 represents the number of data copies associated with the data shard in the distributed system, and m represents the number of slave nodes in the distributed system. Therefore, the preset threshold ≤n+1≤m.

[0132] After receiving a data write instruction, the target data shard to which the data to be processed belongs can be determined based on the keyword information (key value) of the data to be processed in the data write instruction, and a distributed node containing a data copy associated with the target data shard can be selected from the slave node as the target node.

[0133] In addition, after receiving the data processing instruction, if the master node wants to provide services to the client, the condition that the master node needs to meet is that the master node contains a data copy associated with the target data copy to which the information to be processed belongs. Therefore, before selecting n slave nodes from the m slave nodes as the target nodes, it is necessary to determine whether the master node meets this condition, which can be specifically achieved in the following ways:

[0134] Determine identification information of the data shard to which the to-be-processed data belongs according to the keyword information, and determine whether the master node contains a data copy associated with the data shard according to the identification information;

[0135] If so, n slave nodes are selected from the m slave nodes as target nodes.

[0136] Specifically, after the master node of the distributed system receives the data write instruction from the client, it needs to store the generated execution result in the data copy through the execution log. The client can query the execution result in the data copy. Therefore, in order to successfully provide services to the client, the node must contain a data copy.

[0137] If the master node meets the conditions, n slave nodes are selected from the m slave nodes as target nodes, that is, n slave nodes containing data copies associated with the data shard are determined according to the identification information, and the n slave nodes are used as the target nodes.

[0138] In addition, if the heartbeat information returned by the master node is not received within the preset election period, it is determined that the master node does not contain a data copy associated with the data shard, and a new master node needs to be re-elected, which can be achieved in the following ways:

[0139] Determine a candidate node according to the identification information;

[0140] Initiate an election instruction to the m slave nodes, and elect a new master node of the distributed system from the candidate nodes through the election instruction;

[0141] Obtaining voting results submitted by each slave node for voting on the candidate node;

[0142] The voting results are counted, and the first candidate node that obtains a number of votes greater than a preset threshold is determined as a new master node of the distributed system.

[0143] Specifically, when the heartbeat information returned by the master node is not received within the preset election cycle, it is determined that the master node does not meet the conditions, that is, the master node does not contain a data copy associated with the data shard and cannot provide services to the client. Therefore, a new master node needs to be re-elected, and the slave node containing the data copy associated with the target data shard is used as a candidate node, and an election instruction is initiated to the slave nodes in the distributed system, and the slave nodes vote, and a new master node is determined based on the voting results; wherein, the statistics of the voting results are dynamically performed with the voting process, and the slave nodes in the distributed system vote for the candidate nodes, and a new master node is determined based on the voting results, that is, during the voting process, the number of votes for each candidate node is dynamically counted, and the first node among at least two candidate nodes with a number of votes greater than a preset threshold is determined as the new master node.

[0144] After obtaining the voting results of the voting members, the voting results are counted, and the first candidate node that obtains a number of votes greater than a preset threshold is determined as the new master node; in actual applications, the preset threshold can be determined according to the number of nodes in the distributed system. For example, if the distributed system contains 3 nodes (1 master node and 2 slave nodes), the preset threshold can be set to 2 (the vote rate is greater than 50%), and the first candidate node that obtains a number of votes greater than 2 is determined as the new master node.

[0145] When the master node fails to provide services normally, the master node election is performed again to ensure the availability of the distributed system.

[0146] Furthermore, if the master node of the distributed system does not meet the conditions, after re-election of a new master node, n slave nodes are selected from the m slave nodes as target nodes, which can be specifically implemented in the following manner:

[0147] Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; n+1≤m.

[0148] Specifically, the distributed system contains m slave nodes in total, and the new master node is elected from the m slave nodes, and n slave nodes are selected as target nodes from the remaining m-1 slave nodes other than the master node, so n+1≤m.

[0149] like Figure 2As shown, if node 1 is the master node, according to the keyword information of the data to be processed in the data processing instruction, it is determined that the target data shard to which the data to be processed belongs is data shard C, but node 1 does not contain the data copy associated with data shard C and cannot provide services normally, then a new master node needs to be re-elected, and according to the identification information of data shard C, it is determined that nodes 2 and 3 contain the data copies associated with data shard C, so nodes 2 and 3 are determined as candidate nodes for election, and if node 2 is elected as the new master node, n nodes containing the data copies associated with the data shard are determined from the m slave nodes, and the remaining 1 slave node (node ​​3) is used as the target node.

[0150] Step 108: Apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

[0151] Specifically, after the target node is determined, the log entry can be applied to the state machines of the master node and the target node.

[0152] Continuing with the above example, if the master node meets the conditions, the log entry is applied to the state machines of nodes 1 and 2, and node 1 returns the execution result; if the master node does not meet the conditions, the log entry is applied to nodes 2 and 3, and node 2 returns the execution result.

[0153] Figure 2 a0, a1, a2, b0, b1, b2, c0, c1, and c2 are all log copies. Node 1 and node 2 contain data copies A0 and data copies A1 respectively. Node 3 does not contain a data copy associated with data shard A. Therefore, log copy a2 can be decoupled from the state machine of node 3. After log synchronization is completed, node 1 reads the log entry in log copy a0, and the state machine of node 1 executes the log entry, and node 2 reads the log entry in log copy a1, and the state machine of node 2 executes the log entry, while the state machine of node 3 does not execute the log entry.

[0154] In the embodiments of this specification, log copies are still deployed according to the number of copies in the distributed system, and the data generated by applying the log to the state machine can be adjusted according to the data redundancy configuration. Moreover, on the basis of reducing data copies to reduce data redundancy, the fault tolerance and availability of the distributed system can still be guaranteed, and reducing data redundancy is conducive to reducing the overhead caused by storing data, which is conducive to improving the operating speed of the distributed system, thereby improving the data processing efficiency of the distributed system.

[0155] The following combination Figure 3 , taking the application of the data processing method provided in this specification in a practical scenario as an example, the data processing method is further explained. Figure 3 A flowchart of a processing process of a data processing method provided by an embodiment of the present specification applied to an actual scenario is shown, and the specific steps include steps 302 to 318.

[0156] Step 302: Distribute the acquired data to be sharded to each node of the distributed system according to a preset sharding rule.

[0157] Step 304: Calculate the node fault tolerance of the distributed system according to the number of nodes in the distributed system.

[0158] Step 306: Determine a preset threshold of the data replica to be created associated with the data shard of each node according to the node fault tolerance.

[0159] Step 308: Create a data copy in each node according to the preset threshold and the identification information of the data shard in each node.

[0160] Step 310: receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction, wherein the data processing instruction contains keyword information of the data to be processed.

[0161] Step 312: Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer.

[0162] In case the log entry is safely replicated from the node, step 314 is executed.

[0163] Step 314, determining the identification information of the data shard to which the to-be-processed data belongs according to the keyword information, and judging whether the master node of the distributed system contains a data copy associated with the data shard according to the identification information.

[0164] Specifically, if the master node of the distributed system contains a data copy associated with the data shard, step 316 is executed.

[0165] Step 316: determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; wherein the preset threshold ≤ n+1 <m。

[0166] Step 318: Apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

[0167] In the embodiments of this specification, log copies are still deployed according to the number of copies in the distributed system, and the data generated by applying the log to the state machine can be adjusted according to the data redundancy configuration. Moreover, on the basis of reducing data copies to reduce data redundancy, the fault tolerance and availability of the distributed system can still be guaranteed, and reducing data redundancy is conducive to reducing the overhead caused by storing data, which is conducive to improving the operating speed of the distributed system, thereby improving the data processing efficiency of the distributed system.

[0168] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 4 FIG. 1 is a schematic diagram of a data processing device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises:

[0169] The receiving module 402 is configured to receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction;

[0170] The request initiation module 404 is configured to initiate a synchronization request operation to m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer;

[0171] The selection module 406 is configured to select n slave nodes from the m slave nodes as target nodes when the slave node safely replicates the log entry; wherein n is a positive integer, m>n;

[0172] The application module 408 is configured to apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

[0173] Optionally, the data processing device further includes:

[0174] A calculation module, configured to calculate the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0175] A determination module is configured to determine a threshold value of the number of data copies to be created associated with each node according to the node fault tolerance;

[0176] The creation module is configured to create a data copy on each node according to the quantity threshold and the identification information of each node.

[0177] Optionally, the data processing device further includes:

[0178] A distribution module is configured to distribute the acquired data to be sharded to each node of the distributed system according to a preset sharding rule;

[0179] A fault tolerance calculation module, configured to calculate the node fault tolerance of the distributed system according to the number of nodes in the distributed system;

[0180] A threshold determination module is configured to determine a preset threshold of a data copy to be created associated with a data shard of each node according to the node fault tolerance;

[0181] The replica creation module is configured to create a data replica in each node according to the preset threshold and the identification information of the data shards in each node.

[0182] Optionally, the data processing device further includes:

[0183] A quantity threshold determination module is configured to determine a preset quantity threshold of data copies to be created for each node in the distributed system according to the number of nodes in the distributed system and the total number of data shards in the distributed system;

[0184] The data copy creation module is configured to create a data copy in each node according to the preset quantity threshold and the identification information of the data shards in each node.

[0185] Optionally, the data processing instruction carries keyword information of the data to be processed;

[0186] Accordingly, the data processing device further includes:

[0187] a judgment module configured to determine identification information of the data shard to which the to-be-processed data belongs according to the keyword information, and to judge whether the master node contains a data copy associated with the data shard according to the identification information;

[0188] If the result of the operation of the judgment module is yes, the selection module 406 is executed.

[0189] Optionally, the selection module 406 includes:

[0190] The selection submodule is configured to determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes.

[0191] Optionally, the data processing instruction carries keyword information of the data to be processed;

[0192] Accordingly, the selection module 406 includes:

[0193] A determination submodule, configured to determine identification information of the data shard to which the to-be-processed data belongs according to the keyword information;

[0194] The node selection submodule is configured to determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; wherein the preset threshold is ≤n+1≤m.

[0195] Optionally, when the heartbeat information returned by the master node is not received within the preset election period, it is determined that the operation result of the judgment module is no, and the data processing device further includes:

[0196] A candidate node determination module, configured to determine a candidate node according to the identification information;

[0197] An instruction initiation module is configured to initiate an election instruction to the m slave nodes, and elect a new master node of the distributed system from the candidate nodes through the election instruction;

[0198] A voting result acquisition module is configured to acquire the voting results submitted by each slave node for voting on the candidate node;

[0199] The master node determination module is configured to count the voting results and determine the first candidate node that obtains a number of votes greater than a preset threshold as the new master node of the distributed system.

[0200] Optionally, the selection module 406 includes:

[0201] The target node determination submodule is configured to determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; n+1≤m.

[0202] Optionally, the replica creation module includes:

[0203] A determination submodule is configured to determine whether the initial node contains a data copy associated with the target data shard according to the identification information;

[0204] If the operation result of the determination submodule is not included, the quantity determination submodule is executed;

[0205] The quantity determination submodule is configured to determine, according to the identification information, whether the number of data copies associated with the target data shard in the distributed system is greater than a preset copy number threshold;

[0206] If the running result of the quantity determination submodule is not greater than, then running the copy determination submodule;

[0207] The replica determination submodule is configured to determine whether the number of data replicas contained in the initial node is less than a preset replica number threshold;

[0208] If the running result of the replica determination submodule is less than, then running the creation submodule;

[0209] The creation submodule is configured to create a data copy associated with the target data shard in the initial node.

[0210] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can be referred to the description of the technical scheme of the above data processing method.

[0211] Figure 5 The structure block diagram of a computing device 500 provided according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.

[0212] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0213] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0214] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.

[0215] The memory 510 is used to store computer executable instructions, and the processor 520 is used to execute the following computer executable instructions:

[0216] receiving a data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction;

[0217] Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer;

[0218] In the case where the slave node safely replicates the log entry, n slave nodes are selected from the m slave nodes as target nodes; wherein n is a positive integer, m>n;

[0219] Apply the log entry to the state machine of the master node of the distributed system and the state machine of the target node, and return the execution result of the state machine of the master node.

[0220] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data processing method.

[0221] An embodiment of the present specification also provides a computer-readable storage medium storing computer instructions, which are used to implement the steps of the data processing method when executed by a processor.

[0222] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data processing method.

[0223] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0224] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0225] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.

[0226] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0227] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A data processing method, comprising: Receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction, wherein the data processing instruction includes keyword information of the data to be processed, and the keyword information is used to determine identification information of a data shard to which the data to be processed belongs; Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer; In the case where the log entry is safely replicated from the slave node, n slave nodes are selected from the m slave nodes as target nodes; wherein n is a positive integer, m>n, the target node is a node that contains a data copy associated with the data shard determined according to the identification information, the data copy is a data copy associated with a target data shard created at the target node when n slave nodes are determined as target nodes from the m slave nodes in the distributed system, the target data shard is any data shard obtained by sharding the data to be sharded, and the data to be sharded includes the data to be processed; Apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

2. The data processing method according to claim 1, before the steps of receiving the data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, further comprising: Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system; Determine a threshold value of the number of data copies to be created associated with each node according to the node fault tolerance; According to the quantity threshold and the identification information of each node, a data copy is created on each node respectively.

3. The data processing method according to claim 1, before the steps of receiving the data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, further comprising: Distributing the acquired data to be sharded to each node of the distributed system according to a preset sharding rule; Calculating the node fault tolerance of the distributed system according to the number of nodes in the distributed system; Determine a preset threshold of the data replicas to be created associated with the data shards of each node according to the node fault tolerance; According to the preset threshold and the identification information of the data shards in each node, a data copy is created in each node respectively.

4. The data processing method according to claim 1, before the steps of receiving the data processing instruction, appending the data processing instruction to a log, and obtaining a log entry of the data processing instruction are performed, further comprising: Determine a preset number threshold of data copies to be created for each node in the distributed system according to the number of nodes in the distributed system and the total number of data shards in the distributed system; According to the preset quantity threshold and identification information of the data shards in each node, a data copy is created in each node respectively.

5. The data processing method according to claim 1, before the step of selecting n slave nodes from the m slave nodes as target nodes is performed, further comprising: Determine identification information of the data shard to which the to-be-processed data belongs according to the keyword information, and determine whether the master node contains a data copy associated with the data shard according to the identification information; If so, the step of selecting n slave nodes from the m slave nodes as target nodes is executed.

6. The data processing method according to claim 5, wherein the step of selecting n slave nodes from the m slave nodes as target nodes comprises: Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes.

7. The data processing method according to claim 3, wherein the data processing instruction carries keyword information of the data to be processed; Correspondingly, the selecting n slave nodes from the m slave nodes as target nodes includes: Determine identification information of the data shard to which the data to be processed belongs according to the keyword information; Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; wherein a preset threshold value ≤n+1≤m.

8. According to the data processing method of claim 5, when the heartbeat information returned by the master node is not received within the preset election period, the result of determining whether the master node contains a data copy associated with the data shard is no, and the following operations are performed: Determine a candidate node according to the identification information; Initiate an election instruction to the m slave nodes, and elect a new master node of the distributed system from the candidate nodes through the election instruction; Obtaining voting results submitted by each slave node for voting on the candidate node; The voting results are counted, and the first candidate node that obtains a number of votes greater than a preset threshold is determined as a new master node of the distributed system.

9. The data processing method according to claim 8, wherein the step of selecting n slave nodes from the m slave nodes as target nodes comprises: Determine n slave nodes containing data copies associated with the data shard according to the identification information, and use the n slave nodes as the target nodes; n+1≤m.

10. The data processing method according to claim 3, wherein the step of creating a data copy in each node according to the preset threshold and the identification information of the data shard in each node comprises: Determine, based on the identification information, whether the initial node contains a data copy associated with the target data shard; If not included, determining, based on the identification information, whether the number of data copies associated with the target data shard in the distributed system is greater than or equal to a preset copy number threshold; If not, determining whether the number of data copies contained in the initial node is less than a preset copy number threshold; If it is less, a data copy associated with the target data shard is created in the initial node.

11. A data processing device, comprising: a receiving module configured to receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction, wherein the data processing instruction includes keyword information of the data to be processed, and the keyword information is used to determine identification information of a data shard to which the data to be processed belongs; A request initiation module is configured to initiate a synchronization request operation to m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer; A selection module is configured to select n slave nodes from the m slave nodes as target nodes when the slave node safely replicates the log entry; wherein n is a positive integer, m>n, the target node is a node that contains a data copy associated with the data shard determined according to the identification information, the data copy is a data copy associated with a target data shard created at the target node when n slave nodes are determined as target nodes from the m slave nodes in the distributed system, the target data shard is any data shard obtained by sharding the data to be sharded, and the data to be sharded includes the data to be processed; The application module is configured to apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

12. A computing device comprising: Memory and processor; The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions: Receive a data processing instruction, append the data processing instruction to a log, and obtain a log entry of the data processing instruction, wherein the data processing instruction includes keyword information of the data to be processed, and the keyword information is used to determine identification information of a data shard to which the data to be processed belongs; Initiate a synchronization request operation on m slave nodes in the distributed system so that the slave nodes replicate the log entry; wherein m is a positive integer; In the case where the log entry is safely replicated from the slave node, n slave nodes are selected from the m slave nodes as target nodes; wherein n is a positive integer, m>n, the target node is a node that contains a data copy associated with the data shard determined according to the identification information, the data copy is a data copy associated with a target data shard created at the target node when n slave nodes are determined as target nodes from the m slave nodes in the distributed system, the target data shard is any data shard obtained by sharding the data to be sharded, and the data to be sharded includes the data to be processed; Apply the log entry to the state machine of the master node and the state machine of the target node of the distributed system, and return the execution result of the state machine of the master node.

13. A computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the data processing method according to any one of claims 1 to 10.