CN113157709A - Distributed system node dynamic change method, device, equipment and storage medium - Google Patents

Distributed system node dynamic change method, device, equipment and storage medium Download PDF

Info

Publication number
CN113157709A
CN113157709A CN202110130843.3A CN202110130843A CN113157709A CN 113157709 A CN113157709 A CN 113157709A CN 202110130843 A CN202110130843 A CN 202110130843A CN 113157709 A CN113157709 A CN 113157709A
Authority
CN
China
Prior art keywords
node
distributed system
sequence number
request
operation requests
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110130843.3A
Other languages
Chinese (zh)
Inventor
余钧
简怀兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bigo Technology Singapore Pte Ltd
Original Assignee
Bigo Technology Singapore Pte Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bigo Technology Singapore Pte Ltd filed Critical Bigo Technology Singapore Pte Ltd
Priority to CN202110130843.3A priority Critical patent/CN113157709A/en
Publication of CN113157709A publication Critical patent/CN113157709A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a distributed system node dynamic change method, a device, equipment and a storage medium, wherein the method comprises the following steps: any node in the distributed system can judge whether the node is in the latest node list in the distributed system; if yes, obtaining operation requests which are not in consensus in the distributed system so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests; and sequentially executing corresponding operation requests according to the sequence number, wherein if the executed operation request is a data operation request, the node data is updated, and if the executed operation request is a node change request, the node list is updated. Therefore, the consistency algorithm stage and the request execution stage are asynchronous, a leading step length does not need to be set, the execution of the node change request does not need to be delayed, the throughput rate of the system can be improved, and the performance of the distributed system is improved.

Description

Distributed system node dynamic change method, device, equipment and storage medium
Technical Field
The present application relates to the field of distributed system technologies, and in particular, to a method, an apparatus, a device, and a storage medium for dynamically changing nodes of a distributed system.
Background
In order to improve the availability of the service, a distributed system may be used for data storage, where the distributed system includes a plurality of nodes, and each node needs to perform the same operation in the same order, so that the data of each node is consistent.
The paxos algorithm may be used to determine the execution order of each operation in the distributed system, so as to ensure that the order of each operation executed by each node is consistent. The paxos algorithm is a highly fault-tolerant consensus algorithm proposed by lesli lambert (Leslie Lamport) in 1990. Specifically, each node may broadcast the operation request, and each node in the distributed system resolves an execution sequence of the operation requests, so that each operation request and a sequence number thereof are agreed among all nodes in the distributed system, and after the agreement is achieved, each node may execute each operation request in sequence according to the sequence number of each operation request, so that data states obtained by each node are consistent.
In some cases, nodes in a distributed system may change, for example, new nodes may be added to the distributed system, or nodes may be deleted from the distributed system. However, in the distributed system, the time for each node to execute each operation request may not be synchronized, and after the node is changed, the time for each node to update its node list may also be unsynchronized.
In the existing paxos algorithm, the operation request may be divided into a data operation request and a member change operation request, and a leading step length L is set, where for each operation request, the operation phase of running the paxos algorithm must not lead the operation phase L, for example, assuming that the sequence number of the currently latest executed operation request is i, the sequence number of the operation request of running the paxos algorithm must not exceed i + L, and the member change operation is delayed and then taken into effect by L, for example, assuming that the sequence number of the member change operation of an added node is j, when the operation request is executed, the node list is not updated immediately, but a new node is not added to the node list until the operation of j + L-1 is executed.
In the node changing method, if the L setting is too small, the serial number of the phase of running paxos algorithm can only lead the execution phase by a small step length, thereby reducing the throughput efficiency of the distributed system, and if the L setting is too large, the node list can be updated after being delayed for a long time, thereby increasing the complexity of the system, which reduces the performance of the distributed system and affects the user experience.
Disclosure of Invention
In order to solve the above technical problem, the present application shows a method, an apparatus, a device, and a storage medium for dynamically changing nodes of a distributed system.
In a first aspect, the present application shows a method for dynamically changing a node of a distributed system, where the method is applied to any node in the distributed system, and the method includes:
judging whether the node is in a latest node list in the distributed system;
if yes, obtaining operation requests which are not in consensus in the distributed system so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests;
and sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, the node data are updated, and if the executed operation requests are node change requests, the node list is updated.
In a second aspect, the present application shows a distributed system node dynamic change apparatus, which is applied to any node in a distributed system, and the apparatus includes:
the judging module is used for judging whether the node is in a latest node list in the distributed system or not;
the consistency module is used for acquiring the operation requests which are not in consensus in the distributed system if the operation requests are in consensus, so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests;
and the execution module is used for sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, the node data are updated, and if the executed operation requests are node change requests, the node list is updated.
In a third aspect, the present application shows an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the steps of the distributed system node dynamic change method according to any one of the above items.
In a fourth aspect, the present application shows a computer-readable storage medium having a computer program stored thereon, where the computer program when executed by a processor implements the steps of the distributed system node dynamic change method as described in any one of the above.
Compared with the prior art, the method has the following advantages:
in the application, any node in the distributed system can judge whether the node is in the latest node list in the distributed system; if yes, obtaining operation requests which are not in consensus in the distributed system so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests; and sequentially executing corresponding operation requests according to the sequence number, wherein if the executed operation request is a data operation request, the node data is updated, and if the executed operation request is a node change request, the node list is updated.
Thus, before reaching a consensus on each operation request and its corresponding serial number, each node in the distributed system needs to determine whether the node is in the latest node list in the distributed system, that is, before executing the consistency algorithm, each node considers that the node lists participating in the resolution are the same, so that the serial numbers of the operation requests at the nodes reach the consensus, and the data obtained by each node are consistent. That is to say, in the application, the consistency algorithm phase and the request execution phase are asynchronous, a leading step length does not need to be set, execution of the node change request does not need to be delayed, and the throughput rate of the system can be improved, so that the performance of the distributed system is improved, and the user experience is improved.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating steps of a distributed system node dynamic change method according to the present application;
fig. 2 is a schematic diagram of a distributed system node dynamic change method according to the present application;
fig. 3 is a block diagram of a distributed system node dynamic change apparatus according to the present application;
fig. 4 is a block diagram of an electronic device according to the present application.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The following describes in detail a distributed system node dynamic change method provided by the embodiment of the present invention through a specific embodiment.
Referring to fig. 1, a flowchart of steps of a distributed system node dynamic change method according to the present application is shown, where the method is applied to any node in a distributed system, and specifically may include the following steps:
s101: and judging whether the node is in the latest node list in the distributed system. If yes, go to S102.
In this step, if the node is in the latest node list, it indicates that the node is an online node in the distributed system, and may continue to execute other agreed-upon operation requests in the distributed system. On the contrary, if the node is not in the latest node list, the node is indicated to be offline from the distributed system, the node can be stopped, and the subsequent operation request is not required to be executed.
In one implementation manner, whether the node list stored in the node is the latest node list in the distributed system may be determined by determining whether the first sequence number is not less than the second sequence number. The first sequence number is the maximum sequence number corresponding to the operation request executed by the node, and the second sequence number is the maximum sequence number of the node change request which has achieved consensus in the distributed system.
If the first sequence number is not less than the second sequence number, it indicates that the node has executed the latest node change request that has achieved consensus in the distributed system, then the node list in the node is the latest node list in the distributed system.
If the first sequence number is smaller than the second sequence number, it indicates that the node has not executed the latest node change request that has achieved consensus in the distributed system, and then the node list in the node is not the latest node list in the distributed system, then the node may continue to execute the corresponding operation requests in sequence according to the sequence number and update the first sequence number until the first sequence number is not smaller than the second sequence number.
In the present application, each node maintains the first sequence number, the second sequence number, and the node list of the node. The first sequence number may be denoted as max apply index, the second sequence number may be denoted as max chosen config index, and the node list may be denoted as config. All online nodes in the distributed system are recorded in the node list, and when the nodes in the distributed system are changed, the node list is updated accordingly.
S102: and acquiring the operation requests which are not in consensus in the distributed system so that each node in the distributed system agrees with each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests.
In the application, a consensus algorithm thread is run in each node, and the consensus algorithm thread can acquire an operation request which is not in consensus in the distributed system, so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof.
The operation request can be divided into two types: data operation requests and node change requests.
Data operation refers to operation on data stored in nodes of a distributed system, and any node performs data operation to change the data state of the node.
The node change request refers to a change operation on a node in the distributed system, and is used for adding or deleting the node in the distributed system, for example, adding a node in the distributed system or deleting a node in the distributed system. After any node executes the node change request, the node list is changed. Typically, the data operation request comes from a client of the distributed service; and the node change request comes from the operation and maintenance tool, and operation and maintenance personnel initiate the node adding and deleting change operation to the system through the operation and maintenance tool.
In one implementation, obtaining operation requests that are not agreed to in the distributed system, so that each node in the distributed system agrees to a sequence number corresponding to each operation request, may include the following steps:
firstly, the operation requests which are not in common knowledge in the node are sequentially obtained as target operation requests. Each node of the distributed system can receive and store operation requests input by a user, the operation requests which do not reach a consensus in the distributed system can be stored in a request queue according to corresponding receiving time, the operation requests in the request queue are all the operation requests which do not reach the consensus, and only the operation requests which reach the consensus are executed by each node in the distributed system, so that data in each node are consistent.
Then, the third sequence number is incremented by one to be used as the target sequence number. In the nodes of the distributed system, a third sequence number may also be maintained, where the third sequence number is the maximum sequence number of the operation request that the distributed system has agreed, and may be denoted by a max chosen index, and the target sequence number is the max chosen index + 1. The operation request corresponding to the third sequence number may be a data operation request or a node change request, and is not limited specifically.
And further broadcasting the target operation request and the target serial number thereof in the distributed system so as to enable each node in the distributed system to achieve consensus on the operation request corresponding to the target serial number, and updating the third serial number.
If the operation request achieving the consensus corresponding to the target sequence number is not the target operation request, indicating that other operation requests achieving the consensus correspond to the target sequence number in the distributed system, at this time, the maximum sequence number of the operation requests achieving the consensus in the distributed system, that is, the third sequence number also changes, and after the third sequence number is updated, returning to the step of adding one to the third sequence number to obtain a new target sequence number.
If the agreed-upon operation request corresponding to the target serial number is a target operation request, which indicates that the node has agreed upon the target operation request corresponding to the target serial number in the distributed system, the next unacknowledged operation request in the node can be obtained as a new target operation request.
In one implementation, each node may adopt Paxos algorithm to agree on an operation request corresponding to a target sequence number. According to the Paxos algorithm, the nodes in the distributed system can be divided into two participating roles, namely a Proposer and an Acceptor, and each node can only take one role in the process of agreeing on operation requests corresponding to the same target serial number.
If there is an operation request that does not achieve a consensus in the node, the node may further calculate a target sequence number equal to max chosen index +1 as a Proposer of the target sequence number, and if there is no operation request that does not achieve a consensus in the node, the node may serve as an Acceptor of the target sequence number.
The Paxos algorithm specifically includes two phases:
in the first stage, the promoter selects a proposal number Mn and then broadcasts a Prepare request with the number Mn to all acceptors. In the Paxos algorithm, the proposal number selected by each propeser is not repeated, and the new proposal number selected each time is larger than the last proposal number for each propeser.
After the Acceptor receives the Prepare request with the number Mn, if the number Mn is greater than the maximum proposal number received by the Acceptor, the Acceptor feeds back a Prepare response to the promoter, wherein the Prepare response carries the self-approval proposal number of the Acceptor and the corresponding approval proposal value.
In the second stage, if the Proposer receives the Prepare response from more than half of the acceptors to the Prepare request with the number of Mn sent by the acceptors, the Proposer broadcasts an Accept request for the Mn, Vn proposal to all the acceptors, wherein the value of Vn is the approved proposal value corresponding to the largest approved proposal number in the received responses, and if the received responses do not contain the approved proposal value, the value of Vn is the value of the target operation request.
If the promoter receives no more than half of the preparer's response to the Prepare request it issued with the number Mn, then the promoter returns to the first stage, selects a new proposal number Mn ', and broadcasts the Prepare request with the number Mn ' to all the acceptors.
After the Acceptor receives the Accept request for the [ Mn, Vn ] proposal, if the number Mn is greater than or equal to the maximum proposal number of the Accept response made by the Acceptor, then it can feed back the Accept response for the [ Mn, Vn ] proposal to the promoter through the proposal, and at the same time, the number of the approval proposal itself is updated to Mn, and the corresponding value of the approval proposal is updated to Vn.
If the Proposer receives the Accept response from more than half of the Acceptors to the Accept request sent by the Acceptor for the [ Mn, Vn ] proposal, the nodes in the distributed system already achieve consensus, and Vn is the value of the operation request corresponding to the current target serial number.
If the promoter receives no more than half of the Accept responses from the Acceptors to the Accept requests sent by the promoter for the [ Mn, Vn ] proposal, the promoter returns to the first stage, selects a new proposal number Mn ', and then sends a Prepare request with the number Mn' to all the acceptors.
In the above process, any node, as a promoter, may broadcast a Prepare request and an Accept request to an Acceptor, or, as an Acceptor, may receive the Prepare request and the Accept request broadcast by the promoter, and correspondingly feed back a Prepare response and an Accept response. The Prepare request, the Accept request, the Prepare response, and the Accept response may all be referred to as coherence messages, and each coherence message may carry a third sequence number max chosen index and a second sequence number max chosen config index of the sending node. And if the node receiving the consistency message finds that the third sequence number max chosen index of the node is smaller than the third sequence number max chosen index in the consistency message, the node updates the third sequence number max chosen index to the third sequence number max chosen index carried in the consistency message, and performs the same processing on the second sequence number max chosen config index.
Therefore, the consistency of the second serial number and the third serial number stored in each node in the distributed system is maintained as much as possible, the consistency algorithm failure caused by the error of a certain node is reduced, and the accuracy of the distributed system node dynamic change method provided by the application is higher.
In one implementation, if a node in the distributed system agrees on the sequence number corresponding to the change request of any node, the node may update the second sequence number.
S103: and sequentially executing corresponding operation requests according to the sequence number, wherein if the executed operation request is a data operation request, the node data is updated, and if the executed operation request is a node change request, the node list is updated.
In the application, each node also runs an execution operation thread, and the execution operation thread can continuously take out and execute the corresponding operation request from the operation request queue with the agreed sequence number from small to large. The execution operation thread and the consensus algorithm thread are two threads independent of each other.
If the executed operation request is a data operation request, the data stored in the node is updated, and if the executed operation request is a node change request, the node list stored in the node is updated, and meanwhile, the first sequence number max application index of the node can be updated.
In this step, the node change request may be divided into a node addition request or a node deletion request, and if the node change request is a node addition request, a change node is added to a node list stored in the node; and if the node change request is a node deletion request, deleting the changed node in the node list stored in the node.
For example, if a new node a is to be added to the distributed system, the operation and maintenance tool may be used to send a node addition request to any node of the distributed system, where the node addition request indicates that the new node a is to be added to the distributed system. When the node addition request is agreed upon by the nodes in the distributed system, each node performs the operation and updates its node list, and after the update is completed, the latest node list includes node a. For the node A, the latest node list of the distributed system can be input and stored, and then the node A is started and added into the distributed system. After node a joins the system, it will automatically catch up with other nodes and perform all operation requests in sequence.
If a node B is to be deleted within the distributed system, the operation and maintenance tool may be used to send a node delete request to any node of the distributed system, the node delete request indicating that the node B is to be deleted within the distributed system. When the node delete request is agreed upon by the nodes in the distributed system, each node will perform the operation and update its node list, and after the update is completed, the latest node list will not contain node B. For the node B, after it has performed this operation, it will find that it no longer contains itself in the node list, and then automatically quit the distributed system.
As can be seen from the above, before each operation request and its corresponding serial number are agreed, each node in the distributed system in the present application needs to determine whether the node is in the latest node list in the distributed system, that is, before the consistency algorithm is executed, each node considers that the node lists that will participate in the resolution are the same, so that the serial numbers of the operation requests at each node are agreed, and the data obtained by each node is consistent. That is to say, in the application, the consistency algorithm phase and the request execution phase are asynchronous, a leading step length does not need to be set, execution of the node change request does not need to be delayed, and the throughput rate of the system can be improved, so that the performance of the distributed system is improved, and the user experience is improved.
Referring to fig. 2, a schematic diagram of a distributed system node dynamic change method according to the present application is shown. The method comprises the steps that a service client side sends a data operation request, an operation and maintenance tool sends a member change operation request, a node A in the distributed system stores the received operation request into a queue, the operation request is taken out from the request operation queue in sequence, then, a Paxos algorithm is adopted to achieve consensus on the taken-out operation request in the distributed system comprising a plurality of nodes such as a node B and a node C, and further, corresponding operations are executed according to an execution serial number in sequence. And if the executed operation request is a data operation request, updating the data in the database DB, and if the operation request is a member change operation request, updating the node list in the node A.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders and concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are exemplary and that no action is necessarily required in this application.
Referring to fig. 3, a block diagram of a distributed system node dynamic change apparatus according to the present application is shown, where the apparatus may specifically include the following modules:
a judging module 201, configured to judge whether the node is in a latest node list in the distributed system;
a consistency module 202, configured to, if yes, obtain an operation request that does not reach a consensus in the distributed system, so that each node in the distributed system reaches a consensus on each operation request and a corresponding serial number thereof, where the operation request includes a data operation request and a node change request;
and the executing module 203 is configured to sequentially execute corresponding operation requests according to the serial numbers, wherein if the executed operation request is a data operation request, the node data is updated, and if the executed operation request is a node change request, the node list is updated.
In one implementation, the determining module 201 is specifically configured to:
judging whether the first sequence number is not less than a second sequence number, wherein the first sequence number is the maximum sequence number corresponding to the operation request executed by the node, and the second sequence number is the maximum sequence number of the node change request which has achieved consensus in the distributed system;
if not, acquiring a node list stored by the node as a latest node list in the distributed system;
and if the first sequence number is smaller than the second sequence number, executing corresponding operation requests in sequence according to the sequence numbers, and updating the first sequence number until the first sequence number is not smaller than the second sequence number.
In one implementation, the consistency module 202 is further configured to:
and if the sequence numbers corresponding to any node change request are agreed, updating the second sequence number.
In one implementation, the consistency module 202 is specifically configured to:
sequentially acquiring operation requests which do not reach a consensus in the nodes as target operation requests;
adding one to the third sequence number to serve as a target sequence number, wherein the third sequence number is the maximum sequence number of the operation request which has achieved consensus in the distributed system;
broadcasting a target operation request and a target serial number in the distributed system so that each node in the distributed system can achieve consensus on the operation request corresponding to the target serial number, and updating the third serial number;
and if the agreed operation request corresponding to the target sequence number is not the target operation request, returning to the step of adding one to the third sequence number as the target sequence number.
In one implementation, the consistency module 202 is specifically configured to:
and broadcasting a consistency message aiming at the target sequence number in the distributed system, wherein the consistency message carries a second sequence number and a third sequence number stored in the node, so that each node in the distributed system updates the second sequence number and the third sequence number.
In one implementation, the consistency module 202 is specifically configured to:
receiving consistency information of the operation requests which are not identified commonly and broadcast by other nodes in the distributed system, wherein the consistency information carries a second sequence number and a third sequence number which are stored by a sending end node;
and updating the second sequence number and the third sequence number stored in the node according to the received consistency message.
In one implementation, the executing module 203 is specifically configured to:
if the node change request is a node increase request, adding a corresponding node in the node list;
and if the node change request is a node deletion request, deleting the corresponding node in the node list.
As can be seen from the above, before each operation request and its corresponding serial number are agreed, each node in the distributed system in the present application needs to determine whether the node is in the latest node list in the distributed system, that is, before the consistency algorithm is executed, each node considers that the node lists that will participate in the resolution are the same, so that the serial numbers of the operation requests at each node are agreed, and the data obtained by each node is consistent. That is to say, in the application, the consistency algorithm phase and the request execution phase are asynchronous, a leading step length does not need to be set, execution of the node change request does not need to be delayed, and the throughput rate of the system can be improved, so that the performance of the distributed system is improved, and the user experience is improved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The dynamic node changing device of the distributed system provided by the embodiment of the invention has the corresponding functional module for executing the dynamic node changing method of the distributed system, can execute the dynamic node changing method of the distributed system provided by the embodiment of the invention, and can achieve the same beneficial effects.
In another embodiment provided by the present invention, there is also provided an electronic device, which may include: the processor executes the program, and realizes each process of the distributed system node dynamic change method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. For example, as shown in fig. 4, the electronic device may specifically include: a processor 301, a storage device 302, a display screen 303 with touch functionality, an input device 304, an output device 305, and a communication device 306. The number of the processors 301 in the electronic device may be one or more, and one processor 301 is taken as an example in fig. 4. The processor 301, the storage means 302, the display 303, the input means 304, the output means 305 and the communication means 306 of the electronic device may be connected by a bus or other means.
In another embodiment of the present invention, a computer-readable storage medium is further provided, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute the method for dynamically changing nodes of a distributed system according to any one of the foregoing embodiments.
In another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for dynamically changing nodes of a distributed system as described in any of the above embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A distributed system node dynamic change method is applied to any node in a distributed system, and comprises the following steps:
judging whether the node is in a latest node list in the distributed system;
if yes, obtaining operation requests which are not in consensus in the distributed system so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests;
and sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, the node data are updated, and if the executed operation requests are node change requests, the node list is updated.
2. The method of claim 1, wherein determining whether the node is in a most recent list of nodes in the distributed system comprises:
judging whether a first sequence number is not less than a second sequence number, wherein the first sequence number is the maximum sequence number corresponding to the operation request executed by the node, and the second sequence number is the maximum sequence number of the node change request which has achieved consensus in the distributed system;
if not, acquiring a node list stored by the node as a latest node list in the distributed system;
and if the serial number is smaller than the first serial number, executing corresponding operation requests in sequence according to the serial number, and updating the first serial number until the first serial number is not smaller than the second serial number.
3. The method of claim 2, wherein after obtaining the operation request that is not agreed upon within the distributed system, the method further comprises:
and if the sequence number corresponding to any node change request is agreed, updating the second sequence number.
4. The method of claim 1, wherein obtaining the operation requests that do not agree within the distributed system so that each node within the distributed system agrees on each operation request and its corresponding sequence number comprises:
sequentially acquiring operation requests which do not reach a consensus in the nodes as target operation requests;
adding one to a third sequence number as a target sequence number, wherein the third sequence number is the maximum sequence number of the operation request which has achieved consensus in the distributed system;
broadcasting the target operation request and the target serial number in the distributed system so that each node in the distributed system agrees with the operation request corresponding to the target serial number, and updating the third serial number;
and if the agreed operation request corresponding to the target sequence number is not the target operation request, returning to the step of adding one to the third sequence number as the target sequence number.
5. The method of claim 4, wherein broadcasting the target operation request and the target sequence number within the distributed system comprises:
broadcasting a consistency message aiming at the target sequence number in the distributed system, wherein the consistency message carries a second sequence number and a third sequence number stored in the nodes, so that each node in the distributed system updates the second sequence number and the third sequence number.
6. The method of claim 1, wherein obtaining the operation requests that do not agree within the distributed system so that each node within the distributed system agrees on a sequence number corresponding to each operation request comprises:
receiving consistency information of operation requests which are broadcast by other nodes in the distributed system and are not in consensus, wherein the consistency information carries a second sequence number and a third sequence number stored by a sending end node;
and updating the second sequence number and the third sequence number stored in the node according to the received consistency message.
7. The method of claim 1, wherein the updating the node list comprises:
if the node change request is a node increase request, adding a corresponding node in the node list;
and if the node change request is a node deletion request, deleting the corresponding node in the node list.
8. A distributed system node dynamic change apparatus, applied to any node in a distributed system, the apparatus comprising:
the judging module is used for judging whether the node is in a latest node list in the distributed system or not;
the consistency module is used for acquiring the operation requests which are not in consensus in the distributed system if the operation requests are in consensus, so that each node in the distributed system can achieve consensus on each operation request and the corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests;
and the execution module is used for sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, the node data are updated, and if the executed operation requests are node change requests, the node list is updated.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the distributed system node dynamic change method according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of the distributed system node dynamic change method of any one of claims 1 to 7.
CN202110130843.3A 2021-01-29 2021-01-29 Distributed system node dynamic change method, device, equipment and storage medium Pending CN113157709A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110130843.3A CN113157709A (en) 2021-01-29 2021-01-29 Distributed system node dynamic change method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110130843.3A CN113157709A (en) 2021-01-29 2021-01-29 Distributed system node dynamic change method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113157709A true CN113157709A (en) 2021-07-23

Family

ID=76879073

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110130843.3A Pending CN113157709A (en) 2021-01-29 2021-01-29 Distributed system node dynamic change method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113157709A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726866A (en) * 2022-04-07 2022-07-08 网易(杭州)网络有限公司 Method for maintaining consensus node of alliance chain, electronic device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104348906A (en) * 2014-09-16 2015-02-11 深圳市华为技术软件有限公司 Data consultation method and device in distributed type system
CN107040594A (en) * 2017-04-12 2017-08-11 山大地纬软件股份有限公司 The method and device of license block chain node access based on PBFT
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN109150972A (en) * 2018-07-17 2019-01-04 湖南宸瀚信息科技有限责任公司 A kind of the common recognition mechanism and its working method of the efficient block chain of bilayer fragment
WO2020011283A2 (en) * 2019-09-05 2020-01-16 Alibaba Group Holding Limited System and method for deleting node in blockchain network
CN111786812A (en) * 2020-05-27 2020-10-16 金蝶软件(中国)有限公司 Node management method, node management device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104348906A (en) * 2014-09-16 2015-02-11 深圳市华为技术软件有限公司 Data consultation method and device in distributed type system
CN107040594A (en) * 2017-04-12 2017-08-11 山大地纬软件股份有限公司 The method and device of license block chain node access based on PBFT
CN107579848A (en) * 2017-08-30 2018-01-12 上海保险交易所股份有限公司 The method that common recognition node is dynamically changed in practical Byzantine failure tolerance common recognition mechanism
CN109150972A (en) * 2018-07-17 2019-01-04 湖南宸瀚信息科技有限责任公司 A kind of the common recognition mechanism and its working method of the efficient block chain of bilayer fragment
WO2020011283A2 (en) * 2019-09-05 2020-01-16 Alibaba Group Holding Limited System and method for deleting node in blockchain network
CN111786812A (en) * 2020-05-27 2020-10-16 金蝶软件(中国)有限公司 Node management method, node management device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726866A (en) * 2022-04-07 2022-07-08 网易(杭州)网络有限公司 Method for maintaining consensus node of alliance chain, electronic device and storage medium

Similar Documents

Publication Publication Date Title
JP4612715B2 (en) Information processing system, data update method, and data update program
CN111586095B (en) Micro-service gray level publishing method and device, computer equipment and storage medium
US8639786B2 (en) Consistency domains for replication in distributed computing
CN110795503A (en) Multi-cluster data synchronization method and related device of distributed storage system
US10474185B2 (en) Timestamp alignment across a plurality of computing devices
US10091288B2 (en) Ordered execution of tasks
CN113434282A (en) Issuing and output control method and device for stream computing task
CN113157709A (en) Distributed system node dynamic change method, device, equipment and storage medium
US20170286483A1 (en) Standing queries in memory
US9137331B2 (en) Adaptive replication
CN110597808B (en) Distributed database table connection method, device, system, server and medium
CN112182328A (en) Method and device for expanding search engine, electronic equipment and storage medium
CN110071778B (en) Time synchronization method, device, equipment and medium
US20170286540A1 (en) Local and remote execution of standing queries
CN116540938A (en) Data reading method, device, distributed storage system, equipment and storage medium
CN116684416A (en) Mirror image distribution method, device and system in network element cluster
EP3961415B1 (en) Transaction confirmation methods and apparatuses in blockchain network
US8089987B2 (en) Synchronizing in-memory caches while being updated by a high rate data stream
CN109992447B (en) Data copying method, device and storage medium
CN114205354A (en) Event management system, event management method, server, and storage medium
CN112000885B (en) List service system, list generation method, server and storage medium
CN114143196A (en) Instance configuration update method, device, apparatus, storage medium, and program product
CN113918531A (en) Data synchronization method and device of distributed table system and server equipment
CN113037797A (en) Data processing method and device
CN111866133A (en) Multi-source large-batch client data synchronization method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination