[go: up one dir, main page]

CN113157709B - Dynamic change method, device, equipment and storage medium for distributed system nodes - Google Patents

Dynamic change method, device, equipment and storage medium for distributed system nodes Download PDF

Info

Publication number
CN113157709B
CN113157709B CN202110130843.3A CN202110130843A CN113157709B CN 113157709 B CN113157709 B CN 113157709B CN 202110130843 A CN202110130843 A CN 202110130843A CN 113157709 B CN113157709 B CN 113157709B
Authority
CN
China
Prior art keywords
node
distributed system
serial 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.)
Active
Application number
CN202110130843.3A
Other languages
Chinese (zh)
Other versions
CN113157709A (en
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 Pte Ltd
Original Assignee
Bigo Technology 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 Pte Ltd filed Critical Bigo Technology Pte Ltd
Priority to CN202110130843.3A priority Critical patent/CN113157709B/en
Publication of CN113157709A publication Critical patent/CN113157709A/en
Application granted granted Critical
Publication of CN113157709B publication Critical patent/CN113157709B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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)
  • Multi Processors (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 or not; if yes, acquiring operation requests which are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and the corresponding serial number, 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, updating the node data, and if the executed operation requests are node change requests, updating the node list. In this way, the consistency algorithm stage and the request execution stage are asynchronous, the leading step length is not required to be set, and the execution of the node change request is not required to be delayed, so that the throughput rate of the system can be improved, and the performance of the distributed system is improved.

Description

Dynamic change method, device, equipment and storage medium for distributed system nodes
Technical Field
The present application relates to the field of distributed systems, 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 service availability, 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 operations in the same order, so that the data of each node remains consistent.
Wherein a paxos algorithm may be employed to determine the order of execution of each operation within the distributed system to ensure that the order in which each node performs each operation is consistent. The paxos algorithm is a consistency algorithm with high fault tolerance property proposed by rice Lilan bert (Leslie Lamport) in 1990. Specifically, each node may broadcast an operation request, and each node in the distributed system determines the execution sequence of the operation request, so that each operation request and its serial number agree on all nodes in the distributed system, and after the agreement, each node may execute each operation request in sequence according to the serial number of each operation request, so that finally, the data states obtained by each node will agree.
In some cases, a node in the distributed system may change, for example, a new node may be added to the distributed system, or a node may be deleted from the distributed system. However, in the distributed system, the time of each node executing each operation request may not be synchronous, and when the node is changed, the time of each node updating its node list may also be asynchronous, in this case, in the process of using paxos algorithm to agree on the operation request, each node may confirm that the node list participating in resolution is different, so that error occurs in paxos algorithm, and the execution sequence of each operation request in each node cannot agree.
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 paxos algorithm must not be performed first by a step of executing operation phase L, for example, assuming that the sequence number of the operation request currently executed by the latest operation request is i, the sequence number of the operation request running paxos algorithm must not exceed i+l, and the member change operation is performed later by a step of L, for example, assuming that the sequence number of a member change operation of one incremental node is j, then the node list is not updated immediately when the operation request is executed, but a new node is not added to the node list until j+l-1 operation is executed.
In the node changing method, if the L setting is too small, the serial number of the running paxos algorithm stage can only lead the smaller step length of the execution stage, so that the throughput efficiency of the distributed system is reduced, and if the L setting is too large, the node list can be updated after a longer time, so that the complexity of the system is increased, and the performance of the distributed system is reduced, so that the user experience is influenced.
Disclosure of Invention
In order to solve the technical problems, the application discloses a distributed system node dynamic change method, a device, equipment and a storage medium.
In a first aspect, the present application shows a method for dynamically changing nodes of a distributed system, applied to any node in the distributed system, where the method includes:
judging whether the node is in the latest node list in the distributed system or not;
If yes, acquiring operation requests which are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and a 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, updating the node data, and if the executed operation requests are node change requests, updating the node list.
In a second aspect, the present application shows a distributed system node dynamic change device, applied to any node in a distributed system, the device includes:
the judging module is used for judging whether the node is in the latest node list in the distributed system or not;
The consistency module is used for acquiring operation requests which are not agreed in the distributed system if the operation requests are yes, so that each node in the distributed system agrees with each operation request and the corresponding serial numbers thereof, and 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 application shows an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the distributed system node dynamic change method as claimed in any one of the preceding claims when the program is executed.
In a fourth aspect, the present application shows a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the distributed system node dynamic change method of any of the above.
Compared with the prior art, the application 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, acquiring operation requests which are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and the corresponding serial number, 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, updating the node data, and if the executed operation requests are node change requests, updating the node list.
Thus, each node in the distributed system needs to determine whether the node is in the latest node list in the distributed system before the consensus is reached for each operation request and its corresponding serial number, that is, before the consistency algorithm is executed, each node considers the node list that will participate in the resolution to be the same, so that the operation request reaches the consensus at the serial number of each node, and the data obtained by each node is consistent. That is, in the application, the consistency algorithm stage and the request execution stage are asynchronous, the leading step length is not required to be set, and the execution of the node change request is not required to be delayed, so that the throughput rate of the system can be improved, 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 designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of steps of a distributed system node dynamic change method of the present application;
FIG. 2 is a schematic diagram of a dynamic change method of nodes in a distributed system according to the present application;
FIG. 3 is a block diagram of a distributed system node dynamic change device according to the present application;
Fig. 4 is a block diagram of an electronic device of 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 present invention are shown in the drawings, it should be understood that the present invention may 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 method for dynamically changing the distributed system node provided by the embodiment of the invention is described in detail below through specific embodiments.
Referring to fig. 1, a step flow diagram of a distributed system node dynamic change method of the present application is shown, and 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, S102 is executed.
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 other agreed operation requests in the distributed system can be continuously executed. Otherwise, if the node is not in the latest node list, the node is indicated to be disconnected from the distributed system, the node can be stopped, and subsequent operation requests do not need to be executed.
In one implementation, 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 serial number is the maximum serial number corresponding to the operation request executed by the node, and the second serial number is the maximum serial number of the node change request which achieves consensus in the distributed system.
If the first serial number is not less than the second serial number, the node in the node is the latest node list in the distributed system after the node has executed the latest node change request which has reached consensus in the distributed system.
If the first sequence number is smaller than the second sequence number, which means that the node has not executed the latest node change request which has reached agreement in the distributed system, then the node list in the node is not the latest node list in the distributed system, then the node can 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 application, each node maintains a first serial number, a second serial number and a node list of the node. Wherein 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. In the node list, all online nodes in the distributed system are recorded, and when node change occurs in the distributed system, the node list is updated accordingly.
S102: and acquiring operation requests which are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and the corresponding serial number, wherein the operation requests comprise data operation requests and node change requests.
In the application, each node runs a consensus algorithm thread, and the consensus algorithm thread can acquire operation requests which are not agreed in the distributed system so as to ensure that each node in the distributed system agrees with each operation request and the corresponding serial number.
Wherein the operation request can be divided into two types: data operation requests and node change requests.
A data operation refers to an operation of data stored in a node of a distributed system, and any node may change the data state of the node after performing the data operation, for example, if a distributed sql system is to be built, the data operation may be an sql command.
And the node change request refers to a change operation of a node in the distributed system, which is used for adding and 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 performs a node change request, the node list will change. Typically, data manipulation requests come from clients of the distributed service; and the node change request comes from an operation and maintenance tool, and an operation and maintenance personnel initiates the operation of adding, deleting and changing the node to the system through the operation and maintenance tool.
In one implementation, the acquiring the operation request without consensus in the distributed system so that each node in the distributed system agrees with the serial number corresponding to each operation request may include the following steps:
First, operation requests which are not agreed in the node are sequentially acquired as target operation requests. Each node of the distributed system can receive and store operation requests input by a user, the operation requests which are not agreed in the distributed system can be stored in a request queue according to the corresponding receiving time, the operation requests in the request queue are all operation requests which are not agreed, and only the operation requests which are agreed are executed by each node in the distributed system, so that the data in each node are consistent.
Then, the third sequence number is incremented by one as the target sequence number. A third sequence number may also be maintained within the nodes of the distributed system, the third sequence number being the maximum sequence number of the operational request that the distributed system has agreed upon, and may be denoted by max chosen index, the target sequence number being max chosen index +1. The operation request corresponding to the third sequence number may be a data operation request or a node change request, which is not limited specifically.
Further, the target operation request and the target sequence number thereof are broadcast in the distributed system, so that each node in the distributed system can agree on the operation request corresponding to the target sequence number, and the third sequence number is updated.
If the operation request with consensus corresponding to the target sequence number is not the target operation request, it means that other operation requests with consensus corresponding to the target sequence number are already in the distributed system, at this time, the maximum sequence number of the operation request with consensus in the distributed system, that is, the third sequence number, will also change, then after updating the third sequence number, a step of adding one to the third sequence number is returned to obtain a new target sequence number.
If the operation request with the consensus corresponding to the target sequence number is the target operation request, which means that each node has the consensus corresponding to the target sequence number in the distributed system, the next operation request without the consensus in the node can be obtained as a new target operation request.
In one implementation, each node may use a Paxos algorithm to agree on the operation request corresponding to the target sequence number. According to the Paxos algorithm, nodes in the distributed system can be divided into two participation roles, namely Proposer (proposer) and Acceptor (receiver), and each node can only take on one role in the process of agreeing with an operation request corresponding to the same target serial number.
Wherein if there is an operation request that is not agreed within the present node, the node may further calculate a target sequence number equal to max chosen index +1 as Proposer of the target sequence number, and if there is no operation request that is not agreed within the present node, the node may act as Acceptor of the target sequence number.
The Paxos algorithm specifically includes two phases:
In the first stage Proposer selects one proposal number Mn and then broadcasts a Prewire request number Mn to all Acceptor. In the Paxos algorithm, the proposal numbers selected by each Proposer are not repeated, and the new proposal number selected each time is greater than the last proposal number for each Proposer.
Acceptor upon receipt of a request for a number Mn, if the number Mn is greater than the maximum proposal number received by Acceptor, the Acceptor feeds back a request response to Proposer, wherein the request response carries the Acceptor own approval proposal number and the corresponding approval proposal value.
In the second stage, if Proposer receives more than half of the preparation responses from Acceptor to which a preparation request with the number Mn was issued, then the Proposer will broadcast an Accept request for the [ Mn, vn ] proposal to all Acceptor, where the value of Vn is the approval proposal value corresponding to the largest approval proposal number in the received response, and if no approval proposal value is included in the received response, then the value of Vn is the value of the target operation request.
If Proposer receives no more than half of the Acceptor's preparation responses to the Mn-numbered preparation requests it issues, proposer returns to the first stage to select a new proposal number Mn ' and then broadcast Mn's preparation requests to all Acceptor.
Acceptor upon receipt of an Accept request for the [ Mn, vn ] proposal, if the number Mn is greater than or equal to the Acceptor proposal number for which the largest Accept response has been made, it can then feed back the Accept response for the [ Mn, vn ] proposal to Proposer via this proposal, while updating its own approval proposal number to Mn and the corresponding approval proposal value to Vn.
If Proposer receives more than half of Accept responses from Acceptor to the Accept requests for [ Mn, vn ] proposals sent by the nodes, the nodes in the distributed system have reached consensus, and Vn is the value of the operation request corresponding to the current target sequence number.
If Proposer receives no more than half of the Accept responses Acceptor to which an Accept request for a [ Mn, vn ] proposal was issued, proposer returns to the first stage, selects a new proposal number Mn ', and then sends a Prewire request number Mn' to all Acceptor.
In the above procedure, either node may broadcast the preparation request and the Accept request as Proposer to Acceptor, or may receive the preparation request and the Accept request broadcast as Proposer as Acceptor, and feed back the preparation response and the Accept response correspondingly. The preparation request, the Accept request, the preparation response, and the Accept response may be referred to as consistency messages, where each consistency message may carry the third sequence number max chosen index and the second sequence number max chosen config index of the sending node. 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 of the node to the third sequence number max chosen index carried in the consistency message, and the same process is performed on the second sequence number max chosen config index.
Therefore, the consistency of the second serial number and the third serial number stored by each node in the distributed system is maintained as much as possible, and the consistency algorithm failure caused by the error of one node is reduced, so that 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 with a sequence number corresponding to a change request of any node, the node may update the second sequence number.
S103: and sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, updating the node data, and if the executed operation requests are node change requests, updating the node list.
In the application, each node is also operated with an execution operation thread, and the execution operation thread can continuously fetch and execute the corresponding operation requests from the agreed operation request queue according to the sequence from small to large in sequence number. The execution operation thread and the consensus algorithm thread are two threads independent of each other.
If the executed operation request is a node change request, a node list stored in the node is updated, and meanwhile, the first serial number max application index of the node can be updated.
In this step, the node change request may be divided into a node add request or a node delete request, and if the node change request is a node add request, the change node is added in the node list stored in the node; if the node change request is a node deletion request, deleting the changed node from the node list stored in the node.
For example, if a new node A is to be added within the distributed system, then the operation and maintenance tool may be used to send a node addition request to any one of the nodes of the distributed system, the node addition request indicating that the new node A is to be added within the distributed system. When the node adding request is agreed to by the nodes in the distributed system, each node will execute the operation and update its node list, and after the update is completed, the latest node list will contain the A node. For node a, the current latest node list of the distributed system can be input and stored, and then node a is started to be added into the distributed system. After node a joins the system, it will automatically catch up with other nodes and perform all the operation requests in sequence.
If node B is to be deleted within the distributed system, then the operation and maintenance tool can be used to send a node delete request to any node of the distributed system, the node delete request indicating that node B is deleted within the distributed system. When the node deletion request is agreed to by the nodes in the distributed system, each node will execute the operation and update its node list, and after the update is completed, the latest node list will not contain node B. For a node B, when it has performed this operation, it will find that the node list no longer contains itself, and then automatically exit the distributed system.
From the foregoing, it can be seen that, before each operation request and its corresponding serial number reach consensus, 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 the node list that will participate in resolution to be the same, so that the serial numbers of the operation requests reach consensus at each node, and the data obtained by each node are consistent. That is, in the application, the consistency algorithm stage and the request execution stage are asynchronous, the leading step length is not required to be set, and the execution of the node change request is not required to be delayed, so that the throughput rate of the system can be improved, the performance of the distributed system is improved, and the user experience is improved.
Referring to fig. 2, a schematic diagram of a dynamic change method of a distributed system node according to the present application is shown. The method comprises the steps that a service client sends a data operation request, an operation tool sends a member change operation request, a node A in a distributed system stores the received operation request into a queue, the operation request is sequentially fetched from the request operation queue, then the fetched operation request is agreed in the distributed system comprising a plurality of nodes such as a node B and a node C by adopting a Paxos algorithm, and further corresponding operation is sequentially executed according to an execution sequence number. If the performed operation request is a data operation request, the data in the database DB is updated, if the operation request is a member change operation request, updating a node list in the node A.
It should be noted that, for simplicity of explanation, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the application. Further, those skilled in the art will appreciate that the embodiments described in the specification are all alternative embodiments and that the actions involved are not necessarily required for the present application.
Referring to fig. 3, a block diagram of a distributed system node dynamic change device according to the present application is shown, where the device 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 operation requests that are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and a corresponding serial number thereof, where the operation requests include a data operation request and a node change request;
And an execution module 203, configured to sequentially execute corresponding operation requests according to the sequence number, wherein if the executed operation request is a data operation request, update the node data, and if the executed operation request is a node change request, update the node list.
In one implementation, the determining module 201 is specifically configured to:
Judging whether the first serial number is not smaller than the second serial number, wherein the first serial number is the maximum serial number corresponding to the operation request executed by the node, and the second serial number is the maximum serial number of the node change request which is agreed in the distributed system;
if not, acquiring a node list stored by the node as the latest node list in the distributed system;
If the first sequence number is smaller than the second sequence number, the corresponding operation requests are sequentially executed according to the sequence numbers, and the first sequence number is updated 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 the change requests of any node 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 consensus in the nodes, and taking the operation requests as target operation requests;
Adding one to the third serial number which is the maximum serial number of the operation request which has reached consensus in the distributed system and is used as the target serial number;
broadcasting a target operation request and a target sequence number in the distributed system so that each node in the distributed system can agree on the operation request corresponding to the target sequence number and update the third sequence number;
And if the operation request which is corresponding to the target serial number and achieves consensus is not the target operation request, returning to the step of adding one to the third serial number as the target serial number.
In one implementation, the consistency module 202 is specifically configured to:
and broadcasting a consistency message aiming at the target serial number in the distributed system, wherein the consistency message carries a second serial number and a third serial number stored in the node so that each node in the distributed system updates the second serial number and the third serial number.
In one implementation, the consistency module 202 is specifically configured to:
Receiving consistency information of operation requests which are broadcast by other nodes in the distributed system and do not reach consensus, wherein the consistency information carries a second serial number and a third serial number stored by a transmitting end node;
And updating the second serial number and the third serial number stored in the node according to the received consistency message.
In one implementation, the execution module 203 is specifically configured to:
If the node change request is a node addition request, adding a corresponding node in the node list;
if the node change request is a node deletion request, deleting the corresponding node in the node list.
From the foregoing, it can be seen that, before each operation request and its corresponding serial number reach consensus, 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 the node list that will participate in resolution to be the same, so that the serial numbers of the operation requests reach consensus at each node, and the data obtained by each node are consistent. That is, in the application, the consistency algorithm stage and the request execution stage are asynchronous, the leading step length is not required to be set, and the execution of the node change request is not required to be delayed, so that the throughput rate of the system can be improved, the performance of the distributed system is improved, and the user experience is improved.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
The distributed system node dynamic change device provided by the embodiment of the invention is provided with the corresponding functional module for executing the distributed system node dynamic change method, can execute the distributed system node dynamic change method provided by the embodiment of the invention, and can achieve the same beneficial effects.
In still another embodiment of the present invention, there is also provided an electronic device, which may include: the system comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the processes of the distributed system node dynamic change method embodiment when executing the program, and can achieve the same technical effect, and the repetition is avoided, and the description is omitted here. As illustrated in fig. 4, the electronic device may specifically include: a processor 301, a memory device 302, a display screen 303 with touch function, an input device 304, an output device 305, and a communication device 306. The number of processors 301 in the electronic device may be one or more, one processor 301 being exemplified in fig. 4. The processor 301, the storage device 302, the display 303, the input device 304, the output device 305, and the communication device 306 of the electronic apparatus may be connected by a bus or other means.
In yet another embodiment of the present invention, a computer readable storage medium is provided, where instructions are stored, which when executed on a computer, cause the computer to perform the distributed system node dynamic change method according to any one of the above embodiments.
In yet another embodiment of the present invention, a computer program product comprising instructions that, when run on a computer, cause the computer to perform the distributed system node dynamic change method of any of the above embodiments is also provided.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (9)

1. A method for dynamically changing nodes of a distributed system, wherein the method is applied to any node in the distributed system, and each node in the distributed system needs to execute the same operation according to the same sequence, so that data of each node is kept consistent, the method comprises:
judging whether the node is in the latest node list in the distributed system or not;
If yes, acquiring operation requests which are not agreed in the distributed system, so that each node in the distributed system agrees with each operation request and a corresponding serial number thereof, wherein the operation requests comprise data operation requests and node change requests;
Sequentially executing corresponding operation requests according to the serial numbers, wherein if the executed operation requests are data operation requests, updating node data, and if the executed operation requests are node change requests, updating the node list;
Wherein the determining whether the node is in the latest node list in the distributed system includes:
judging whether the first serial number is not smaller than the second serial number, wherein the first serial number is the maximum serial number corresponding to the operation request executed by the node, and the second serial number is the maximum serial number of the node change request which achieves consensus in the distributed system;
if not, acquiring a node list stored by the node as the latest node list in the distributed system;
And if the first sequence number is smaller than the second sequence number, sequentially executing corresponding operation requests according to the sequence numbers, and updating the first sequence number until the first sequence number is not smaller than the second sequence number.
2. The method of claim 1, wherein after the obtaining of the operation request within the distributed system that is not agreed upon, the method further comprises:
and if the sequence numbers corresponding to the change requests of any node are agreed, updating the second sequence numbers.
3. The method of claim 1, wherein the obtaining, within the distributed system, the operation request that is not agreed upon such that each node within the distributed system agrees upon each operation request and its corresponding sequence number, comprises:
sequentially acquiring operation requests which do not reach consensus in the nodes, and taking the operation requests as target operation requests;
Adding one to a third serial number which is the maximum serial number of the operation requests which reach consensus in the distributed system and is used as a target serial number;
broadcasting the target operation request and the target sequence number in the distributed system so that each node in the distributed system can agree on the operation request corresponding to the target sequence number and update the third sequence number;
And if the operation request which is corresponding to the target serial number and achieves consensus is not the target operation request, returning to the step of adding one to the third serial number as the target serial number.
4. The method of claim 3, wherein broadcasting the target operation request and the target sequence number within the distributed system comprises:
And broadcasting a consistency message aiming at the target serial number in the distributed system, wherein the consistency message carries a second serial number and a third serial number stored in the node so that each node in the distributed system can update the second serial number and the third serial number.
5. The method of claim 1, wherein the obtaining, in the distributed system, the operation request that is not agreed to, so that each node in the distributed system agrees with the sequence number corresponding to each operation request, includes:
receiving a consistency message of an operation request which is broadcast by other nodes in the distributed system and does not reach consensus, wherein the consistency message carries a second serial number and a third serial number stored by a sending end node;
and updating the second serial number and the third serial number stored in the node according to the received consistency message.
6. The method of claim 1, wherein the updating the node list comprises:
if the node change request is a node addition 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.
7. A distributed system node dynamic change device, applied to any node in a distributed system, where each node in the distributed system needs to perform the same operations in the same order, so that data of each node remains consistent, the device includes:
the judging module is used for judging whether the node is in the latest node list in the distributed system or not;
The consistency module is used for acquiring operation requests which are not agreed in the distributed system if the operation requests are yes, so that each node in the distributed system agrees with each operation request and the corresponding serial numbers thereof, and the operation requests comprise data operation requests and node change requests;
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;
The judging module is specifically configured to:
Judging whether the first serial number is not smaller than the second serial number, wherein the first serial number is the maximum serial number corresponding to the operation request executed by the node, and the second serial number is the maximum serial number of the node change request which is agreed in the distributed system;
if not, acquiring a node list stored by the node as the latest node list in the distributed system;
If the first sequence number is smaller than the second sequence number, the corresponding operation requests are sequentially executed according to the sequence numbers, and the first sequence number is updated until the first sequence number is not smaller than the second sequence number.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the distributed system node dynamic change method according to any of claims 1 to 6 when the program is executed.
9. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the distributed system node dynamic change method according to any of claims 1 to 6.
CN202110130843.3A 2021-01-29 2021-01-29 Dynamic change method, device, equipment and storage medium for distributed system nodes Active CN113157709B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110130843.3A CN113157709B (en) 2021-01-29 2021-01-29 Dynamic change method, device, equipment and storage medium for distributed system nodes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110130843.3A CN113157709B (en) 2021-01-29 2021-01-29 Dynamic change method, device, equipment and storage medium for distributed system nodes

Publications (2)

Publication Number Publication Date
CN113157709A CN113157709A (en) 2021-07-23
CN113157709B true CN113157709B (en) 2024-09-13

Family

ID=76879073

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110130843.3A Active CN113157709B (en) 2021-01-29 2021-01-29 Dynamic change method, device, equipment and storage medium for distributed system nodes

Country Status (1)

Country Link
CN (1) CN113157709B (en)

Families Citing this family (1)

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

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006260430A (en) * 2005-03-18 2006-09-28 Brother Ind Ltd Node device, node information replication program, replication node information storage program, and node information replication method
CN104348906B (en) * 2014-09-16 2018-05-04 华为技术有限公司 Data agreement method and device in a kind of distributed system
CN107040594B (en) * 2017-04-12 2020-04-10 山大地纬软件股份有限公司 Method and device for allowing block chain node to be admitted based on PBFT
CN109150972B (en) * 2018-07-17 2021-07-23 湖南宸瀚信息科技有限责任公司 Working method of consensus mechanism of double-layer partitioned efficient block chain
CN110730204B (en) * 2019-09-05 2022-09-02 创新先进技术有限公司 Method for deleting nodes in block chain network and block chain system
CN111786812B (en) * 2020-05-27 2023-06-20 金蝶软件(中国)有限公司 Node management method, device, computer equipment and storage medium
CN111522683B (en) * 2020-07-03 2020-10-02 支付宝(杭州)信息技术有限公司 Consensus node changing method and related device for badger Byzantine fault-tolerant consensus mechanism

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN113157709A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
JP4612715B2 (en) Information processing system, data update method, and data update program
US8676914B2 (en) Synchronizing services across network nodes
US20180367610A1 (en) Data storage method and server applicable to distributed server cluster
CN111277639B (en) Method and device for maintaining data consistency
EP2378718B1 (en) Method, node and system for controlling version in distributed system
CN110795503A (en) Multi-cluster data synchronization method and related device of distributed storage system
US20090049172A1 (en) Concurrent Node Self-Start in a Peer Cluster
CN112015595B (en) Master-slave database switching method, computing device and storage medium
EP3961415B1 (en) Transaction confirmation methods and apparatuses in blockchain network
CN113157709B (en) Dynamic change method, device, equipment and storage medium for distributed system nodes
CN117633108A (en) Time stamp generation method and device, electronic equipment and nonvolatile storage medium
CN116166300B (en) Upgrade management method and device for intellectual property system
CN110597808B (en) Distributed database table connection method, device, system, server and medium
CN110071778B (en) Time synchronization method, device, equipment and medium
US20170286540A1 (en) Local and remote execution of standing queries
CN113761052A (en) Database synchronization method and device
US8089987B2 (en) Synchronizing in-memory caches while being updated by a high rate data stream
CN117319330A (en) Method, system, equipment, medium and working node for distributing file synchronization tasks
US20140156714A1 (en) Distributed file system processing apparatus and method, and storage media storing the same
CN113761075B (en) Method, device, apparatus and computer-readable medium for switching database
US8437983B2 (en) Method for determining definite clock and node apparatus
CN107678840B (en) System, method and device for running tasks
CN116414579B (en) Method for realizing data consistency among multiple copies based on distributed group communication
US11556512B2 (en) Systems and methods for artifact peering within a multi-master collaborative environment
CN113407123B (en) Distributed transaction node information storage method, device, equipment and medium

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
GR01 Patent grant
GR01 Patent grant