CN106559263A - A kind of improved distributed consensus algorithm - Google Patents
A kind of improved distributed consensus algorithm Download PDFInfo
- Publication number
- CN106559263A CN106559263A CN201611010538.6A CN201611010538A CN106559263A CN 106559263 A CN106559263 A CN 106559263A CN 201611010538 A CN201611010538 A CN 201611010538A CN 106559263 A CN106559263 A CN 106559263A
- Authority
- CN
- China
- Prior art keywords
- node
- distributed
- host node
- cluster
- type assemblies
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0668—Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multi Processors (AREA)
Abstract
The present invention relates to computer realm, discloses a kind of improved distributed consensus algorithm, comprises the steps:(1) initialization of distributed type assemblies;(2) fault recovery of distributed type assemblies;(3) data syn-chronization of distributed type assemblies;The present invention is by improving distributed consensus algorithm, enable according to set rule, to adjust the selection course of cluster host node, the selection course of so whole cluster host node is more flexible and efficient, so that distributed type assemblies can be rapidly switched to most suitable new node when host node is in collapse and recover response, thus eliminating the need the unstability of whole distributed system, and the situation that the long-time that may exist is not responding to, and can at any time according to the timely regulation rule of specific node situation, distributed type assemblies are enable more flexibly to adjust migration.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of improved distributed consensus algorithm.
Background technology
In a distributed system, comprising many physically separate servers, they communicate by network connection, altogether
With one group system in logic of composition.Therefore certainly exist certain server and collapse because of various unexpected or state is different
Often, cannot thus ensure that they reach an agreement with other servers state.Cluster needs to ensure in this case again simultaneously
Stable external offer service is provided, and can continue to add cluster work when server recovers normal in this section
Make and be consistent with cluster state.
Distributed consensus algorithm, the algorithm of such issues that exactly solve.And Raft is then using extensive distributed one
Cause property algorithm, its cardinal principle are as follows:
Distributed cluster system wants hold mode consistent in normal state, be exactly first Servers-all node (with
Call in the following text:Node) in, one is selected as host node (Leader),, used as from node (Follower), host node continues fixed for other
When send messages to from node.Then host node is passed through to the service request of whole distributed type assemblies, then from host node to which
He issues request from node.After in cluster, more than half acknowledges receipt of simultaneously application request, host node has returned this request immediately
The message for completing, notifies that requesting party has completed.For the abnormal nodes that other minorities are not received or do not returned, host node meeting
Unacknowledged request is retransmitted persistently, until its recovery is normal and keeps up with host node.As long as this ensures that exceeding in the cluster
The normal whole cluster of the node of half just can normal work.
When host node surprisingly collapses or when Network Abnormal, cluster loses host node, is at this time put into " election
" state:All timed message that host node cannot be received from node, after the time-out time of a regulation, can all be converted into and treat
The person of choosing (Candidate), then initiates the ballot to oneself, and each person to be selected has a ballot paper, first vote after initiating ballot to
Oneself, then asks ballot paper to other persons to be selected again, and after the ballot paper more than node total number half is obtained, this person to be selected is immediately
New host node being converted into, then timed message being sent to other persons to be selected, distributed type assemblies enter next stable period.Such as
Fruit obtain ballot paper not enough, this person to be selected understands dormancy (such as 150-300 milliseconds) for a period of time, then initiates next round ballot.When
In this period of dormancy, receive that other persons to be selected send seeks ticket request (and his data volume is greater than this person to be selected),
It will be thrown the ballot paper of oneself to that person to be selected for seeking ticket, then again dormancy for a period of time (such as 150-300 milliseconds),
If this period of dormancy, new host node was selected again, oneself is reformed into from node, if not selecting new host node, is initiated
Next round is voted.
After new host node is selected, all submission states of cluster can be distributed to all sections of cluster by new host node again
Point, so that the state of distributed type assemblies recovers available again.
During wherein re-electing new host node after host node collapse, whole distributed type assemblies formula is in special shape
State, it is impossible to respond request, and it is all from node be all equality, all can be in one random time of dormancy (150-300 milliseconds)
Mutually lobbying afterwards, in a wheel ballot, obtains the ballot paper more than half if none of node, then can then dormancy one it is random
Time, and next round ballot is carried out, until selecting new host node.Can thus there is such case:If each node
Dormancy time very close to, may result in after dormancy terminates all to throw ballot paper immediately and give oneself, so as to host node cannot be selected, then
Dormancy is voted into next round, and dormancy is thrown ballot paper immediately after terminating again and gives oneself, does not so stop circulation, until many pollings
Lift, can just select new host node, cluster could recover, and this results in distributed type assemblies performance may be very unstable, or even
Under extreme case, long-time is unavailable.
The content of the invention
Shortcoming of the present invention for the poorly efficient unstable, underaction of whole distributed cluster system in prior art, there is provided
A kind of improved distributed consensus algorithm.
In order to solve above-mentioned technical problem, the present invention is addressed by following technical proposals.
A kind of improved distributed consensus algorithm, comprises the steps:
(1) initialization of distributed type assemblies:The code library of startup, load-on module including server and execution distributed
The initialization program of cause property algorithm;Meanwhile, by way of configuration file, according to the height of node server configuration, to node
Election weighted value be configured from high to low;
(2) fault recovery of distributed type assemblies:When suspension or crash reason cause host node to depart from whole cluster, collect mass-brain
The response for causing host node obtain more than half node is split, into the fault recovery stage;One is re-elected from whole cluster
Individual person to be selected, becomes host node, is conducted an election according to the election weighted value of setting node server in step (1), selects section
In point, weighted value highest node is used as new host node;
(3) data syn-chronization of distributed type assemblies:After node abnormal in cluster recovers normal, can be from host node synchronization
Data, are consistent with other node datas in cluster until reaching.
Preferably, in step (1), node server configuration includes internal memory, CPU and access bandwidth.
The present invention as a result of above technical scheme, with significant technique effect:The present invention is distributed by improving
Consistency algorithm, enables the selection course of cluster host node is adjusted according to set rule, the main section of so whole cluster
The selection course of point is more flexible and efficient, so that distributed type assemblies when host node is in collapse can be rapidly switched to most close
Suitable new node simultaneously recovers response, thus eliminating the need the unstability of whole distributed system, and the length that may exist
The situation that time is not responding to, and distributed type assemblies can be enable more at any time according to the timely regulation rule of specific node situation
Plus flexible adjustment migration.
Description of the drawings
Fig. 1 is a kind of election process schematic diagram of improved distributed consensus algorithm of the present invention;
Fig. 2 is a kind of schematic flow sheet of improved distributed consensus algorithm of the present invention.
Specific embodiment
The present invention is described in further detail with embodiment below in conjunction with the accompanying drawings.
As shown in Figure 1 to Figure 2, a kind of improved distributed consensus algorithm, comprises the steps:
(1) initialization of distributed type assemblies:The code library of startup, load-on module including server and execution distributed
The initialization program of cause property algorithm;Meanwhile, by way of configuration file, according to the height of node server configuration, to node
Election weighted value be configured from high to low;Node server configuration includes internal memory, CPU and access bandwidth, then whole to collect
Group's initialization is completed, and the process of host node is elected into first time, due to being provided with different weights before, each selected person,
According to weight dormancy different time, host node is just selected an election cycle substantially, and then other nodes become from section
Point, whole distributed type assemblies enter the normal state for providing service;
(2) fault recovery of distributed type assemblies:When suspension or crash reason cause host node to depart from whole cluster, collect mass-brain
The response for causing host node obtain more than half node is split, into the fault recovery stage;One is re-elected from whole cluster
Individual person to be selected, becomes host node, is conducted an election according to the election weighted value of setting node server in step (1), selects section
In point, used as new host node, election process is with before, basic wheel election can be selected surplus for weighted value highest node
In lower node, used as new host node, then cluster recovery normal work, therefore this process is to outside clothes for optimum node
Business affects can be minimum;
(3) data syn-chronization of distributed type assemblies:After node abnormal in cluster recovers normal, can be from host node synchronization
Data, are consistent with other node datas in cluster until reaching, because host node is optimum node all the time, recover
Process also can be rapider.
The present invention enables according to set rule, adjusts the main section of cluster by improving distributed consensus algorithm
The selection course of point, the selection course of so whole cluster host node is more flexible and efficient, so that distributed type assemblies are in main section
Point can be rapidly switched to most suitable new node when collapse and recover response, thus eliminating the need whole distributed system
Unstability, and the situation that the long-time that may exist is not responding to, and can at any time according to specific node situation and
When regulation rule, enable distributed type assemblies more flexibly to adjust migration.
Embodiment 1
(1) initialization of the startup of server, the code library for loading necessary module and execution distributed consensus algorithm
Program;Meanwhile, by way of configuration file, according to the height of node server configuration, to the election weighted value of node from height
Be configured to low, have in a distributed type assemblies 3 it is higher with server, 10 are relatively low with server, then often according to configuration
Height weight successively decreases 200 successively from 5000, and minimum is then 2600 with server;
(2) fault recovery of distributed type assemblies:When suspension or collapse or other reasonses cause host node to depart from whole cluster,
Cluster fissure causes host node obtain response more than half node, into the fault recovery stage;From whole cluster again
One person to be selected of election, becomes host node, is conducted an election according to the election weighted value of setting node server in step (1),
In selecting node, weighted value highest node is used as new host node;
(3) data syn-chronization of distributed type assemblies:After node abnormal in cluster recovers normal, can be from host node synchronization
Data, are consistent with other node datas in cluster until reaching.
In a word, presently preferred embodiments of the present invention, all equalizations made according to scope of the present invention patent be the foregoing is only
Change and modification, should all belong to the covering scope of patent of the present invention.
Claims (2)
1. a kind of improved distributed consensus algorithm, it is characterised in that comprise the steps:
(1) initialization of distributed type assemblies:The code library and execution distributed consensus of startup, load-on module including server
The initialization program of algorithm;Meanwhile, by way of configuration file, according to the height of node server configuration, the choosing to node
Lift weighted value to be configured from high to low;
(2) fault recovery of distributed type assemblies:When suspension or crash reason cause host node to depart from whole cluster, cluster fissure is led
Cause host node cannot obtain the response more than half node, into the fault recovery stage;One is re-elected from whole cluster to treat
The person of choosing, becomes host node, is conducted an election according to the election weighted value of setting node server in step (1), is selected in node
Weighted value highest node is used as new host node;
(3) data syn-chronization of distributed type assemblies:After node abnormal in cluster recovers normal, can be from the same step number of host node
According to being consistent with other node datas in cluster until reaching.
2. a kind of improved distributed consensus algorithm according to claim 1, it is characterised in that:In step (1), node
Server configuration includes internal memory, CPU and access bandwidth.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611010538.6A CN106559263A (en) | 2016-11-17 | 2016-11-17 | A kind of improved distributed consensus algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611010538.6A CN106559263A (en) | 2016-11-17 | 2016-11-17 | A kind of improved distributed consensus algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106559263A true CN106559263A (en) | 2017-04-05 |
Family
ID=58443263
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611010538.6A Pending CN106559263A (en) | 2016-11-17 | 2016-11-17 | A kind of improved distributed consensus algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106559263A (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107193695A (en) * | 2017-05-25 | 2017-09-22 | 北京计算机技术及应用研究所 | A kind of configuration and synchronization method of double control disk array |
CN107579860A (en) * | 2017-09-29 | 2018-01-12 | 新华三技术有限公司 | Node electoral machinery and device |
CN107634846A (en) * | 2017-07-24 | 2018-01-26 | 杭州沃趣科技股份有限公司 | A kind of implementation of the dual-active system based on consistency algorithm |
CN108063787A (en) * | 2017-06-26 | 2018-05-22 | 杭州沃趣科技股份有限公司 | The method that dual-active framework is realized based on distributed consensus state machine |
CN108111337A (en) * | 2017-12-06 | 2018-06-01 | 北京天融信网络安全技术有限公司 | Distributed system arbitrates the method and apparatus of host node |
CN108810115A (en) * | 2018-05-29 | 2018-11-13 | 电子科技大学 | A kind of load-balancing method, device and server suitable for distributed data base |
CN108810100A (en) * | 2018-05-22 | 2018-11-13 | 郑州云海信息技术有限公司 | A kind of electoral machinery of host node, device and equipment |
CN110661841A (en) * | 2019-08-06 | 2020-01-07 | 江阴逐日信息科技有限公司 | Data consistency method for distributed service discovery cluster in micro-service architecture |
CN110674215A (en) * | 2019-09-17 | 2020-01-10 | 郑州阿帕斯科技有限公司 | Master selection method and device for distributed system and distributed system |
CN111526186A (en) * | 2020-04-10 | 2020-08-11 | 河海大学 | Distributed server cluster configuration method based on Raft |
CN111586110A (en) * | 2020-04-22 | 2020-08-25 | 广州锦行网络科技有限公司 | Optimization processing method for raft in point-to-point fault |
CN111818152A (en) * | 2020-07-02 | 2020-10-23 | 电子科技大学 | Leader election consensus method based on distributed network |
CN112181305A (en) * | 2020-09-30 | 2021-01-05 | 北京人大金仓信息技术股份有限公司 | Database cluster network partition selection method and device |
CN112214466A (en) * | 2019-07-12 | 2021-01-12 | 海能达通信股份有限公司 | Distributed cluster system, data writing method, electronic equipment and storage device |
CN113535517A (en) * | 2021-07-23 | 2021-10-22 | 烽火通信科技股份有限公司 | Controller cluster node management method and device |
CN115002120A (en) * | 2022-08-02 | 2022-09-02 | 蒲惠智造科技股份有限公司 | Method for determining main node in cluster network based on data synchronization |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521388A (en) * | 2011-12-23 | 2012-06-27 | 国网电力科学研究院 | Low-coupling high-availability device for electric power information retrieval |
CN104320459A (en) * | 2014-10-24 | 2015-01-28 | 杭州华三通信技术有限公司 | Node management method and device |
CN104933132A (en) * | 2015-06-12 | 2015-09-23 | 广州巨杉软件开发有限公司 | Distributed database weighted voting method based on operating sequence number |
CN105208090A (en) * | 2015-08-19 | 2015-12-30 | 江苏农牧人电子商务股份有限公司 | Zookeeper-based Leader selection method |
-
2016
- 2016-11-17 CN CN201611010538.6A patent/CN106559263A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521388A (en) * | 2011-12-23 | 2012-06-27 | 国网电力科学研究院 | Low-coupling high-availability device for electric power information retrieval |
CN104320459A (en) * | 2014-10-24 | 2015-01-28 | 杭州华三通信技术有限公司 | Node management method and device |
CN104933132A (en) * | 2015-06-12 | 2015-09-23 | 广州巨杉软件开发有限公司 | Distributed database weighted voting method based on operating sequence number |
CN105208090A (en) * | 2015-08-19 | 2015-12-30 | 江苏农牧人电子商务股份有限公司 | Zookeeper-based Leader selection method |
Cited By (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107193695A (en) * | 2017-05-25 | 2017-09-22 | 北京计算机技术及应用研究所 | A kind of configuration and synchronization method of double control disk array |
CN108063787A (en) * | 2017-06-26 | 2018-05-22 | 杭州沃趣科技股份有限公司 | The method that dual-active framework is realized based on distributed consensus state machine |
CN107634846A (en) * | 2017-07-24 | 2018-01-26 | 杭州沃趣科技股份有限公司 | A kind of implementation of the dual-active system based on consistency algorithm |
CN107579860A (en) * | 2017-09-29 | 2018-01-12 | 新华三技术有限公司 | Node electoral machinery and device |
CN108111337A (en) * | 2017-12-06 | 2018-06-01 | 北京天融信网络安全技术有限公司 | Distributed system arbitrates the method and apparatus of host node |
CN108111337B (en) * | 2017-12-06 | 2021-04-06 | 北京天融信网络安全技术有限公司 | Method and equipment for arbitrating main nodes in distributed system |
CN108810100A (en) * | 2018-05-22 | 2018-11-13 | 郑州云海信息技术有限公司 | A kind of electoral machinery of host node, device and equipment |
CN108810115B (en) * | 2018-05-29 | 2020-12-01 | 电子科技大学 | Load balancing method and device suitable for distributed database and server |
CN108810115A (en) * | 2018-05-29 | 2018-11-13 | 电子科技大学 | A kind of load-balancing method, device and server suitable for distributed data base |
CN112214466A (en) * | 2019-07-12 | 2021-01-12 | 海能达通信股份有限公司 | Distributed cluster system, data writing method, electronic equipment and storage device |
CN112214466B (en) * | 2019-07-12 | 2024-05-14 | 海能达通信股份有限公司 | Distributed cluster system, data writing method, electronic equipment and storage device |
CN110661841A (en) * | 2019-08-06 | 2020-01-07 | 江阴逐日信息科技有限公司 | Data consistency method for distributed service discovery cluster in micro-service architecture |
CN110661841B (en) * | 2019-08-06 | 2022-05-20 | 江阴逐日信息科技有限公司 | Data consistency method for distributed service discovery cluster in micro-service architecture |
CN110674215A (en) * | 2019-09-17 | 2020-01-10 | 郑州阿帕斯科技有限公司 | Master selection method and device for distributed system and distributed system |
CN111526186A (en) * | 2020-04-10 | 2020-08-11 | 河海大学 | Distributed server cluster configuration method based on Raft |
CN111586110B (en) * | 2020-04-22 | 2021-03-19 | 广州锦行网络科技有限公司 | Optimization processing method for raft in point-to-point fault |
CN111586110A (en) * | 2020-04-22 | 2020-08-25 | 广州锦行网络科技有限公司 | Optimization processing method for raft in point-to-point fault |
CN111818152A (en) * | 2020-07-02 | 2020-10-23 | 电子科技大学 | Leader election consensus method based on distributed network |
CN111818152B (en) * | 2020-07-02 | 2021-04-30 | 电子科技大学 | Leader election consensus method based on distributed network |
CN112181305A (en) * | 2020-09-30 | 2021-01-05 | 北京人大金仓信息技术股份有限公司 | Database cluster network partition selection method and device |
CN112181305B (en) * | 2020-09-30 | 2024-06-07 | 北京人大金仓信息技术股份有限公司 | Database cluster network partition selection method and device |
CN113535517A (en) * | 2021-07-23 | 2021-10-22 | 烽火通信科技股份有限公司 | Controller cluster node management method and device |
CN113535517B (en) * | 2021-07-23 | 2022-04-12 | 烽火通信科技股份有限公司 | Controller cluster node management method and device |
CN115002120B (en) * | 2022-08-02 | 2022-10-25 | 蒲惠智造科技股份有限公司 | Method for determining main node in cluster network based on data synchronization |
CN115002120A (en) * | 2022-08-02 | 2022-09-02 | 蒲惠智造科技股份有限公司 | Method for determining main node in cluster network based on data synchronization |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106559263A (en) | A kind of improved distributed consensus algorithm | |
US20210203751A1 (en) | Methods, systems, and devices for electronic note identifier allocation and electronic note generation | |
US20210149737A1 (en) | Method for fast scheduling for balanced resource allocation in distributed and collaborative container platform environment | |
US20180329968A1 (en) | Creation of modular applications with corresponding twins in the cloud | |
US20200133793A1 (en) | Prioritized leadership for data replication groups | |
EP3671516A1 (en) | Hierarchical weighted consensus for permissioned blockchains | |
US8145938B2 (en) | Fencing management in clusters | |
Malek et al. | A decentralized redeployment algorithm for improving the availability of distributed systems | |
CN112596960B (en) | Distributed storage service switching method and device | |
CN105094997B (en) | Physical memory sharing method and system between a kind of cloud computing host node | |
CN106656682B (en) | Cluster heartbeat detecting method, system and device | |
CN107453929B (en) | Cluster system self-construction method and device and cluster system | |
US20070088703A1 (en) | Peer-to-peer auction based data distribution | |
CN110505319A (en) | A kind of RS485 is from device address auto-allocation method and system | |
CN106161495A (en) | A kind of host node electoral machinery, device and storage system | |
CN103621049A (en) | System and method for automatically addressing devices in multi-drop network | |
CN107666493B (en) | Database configuration method and equipment thereof | |
CN109173270B (en) | Game service system and implementation method | |
CN101753478A (en) | Distributed E-mail system and service method thereof | |
CN105847352B (en) | Expansion method, device and distributed cache system based on distributed cache system | |
US20210149745A1 (en) | Method for balanced scale out of resources in distributed and collaborative container platform environment | |
CN108616525A (en) | Website access method and device, electronic equipment and storage medium | |
US20020161902A1 (en) | Allocating computer resources for efficient use by a program | |
CN102932500A (en) | Method and system for taking over fault interface node | |
CN106603645A (en) | Large-scale cloud storage copy server consistency processing 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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170405 |
|
RJ01 | Rejection of invention patent application after publication |