CN109995835A - Host node electoral machinery, device and distributed memory system - Google Patents
Host node electoral machinery, device and distributed memory system Download PDFInfo
- Publication number
- CN109995835A CN109995835A CN201711498417.5A CN201711498417A CN109995835A CN 109995835 A CN109995835 A CN 109995835A CN 201711498417 A CN201711498417 A CN 201711498417A CN 109995835 A CN109995835 A CN 109995835A
- Authority
- CN
- China
- Prior art keywords
- node
- election
- message
- cluster
- nodes
- 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
- 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
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1044—Group management mechanisms
- H04L67/1051—Group master selection mechanisms
-
- 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
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
Abstract
The present invention provides a kind of host node electoral machinery, device and distributed memory systems, belong to technical field of network storage.Host node electoral machinery, device and distributed memory system provided in an embodiment of the present invention, each node in distributed memory system cluster has a unique corresponding digital number, when initiating election, according to the size of the digital number of each node, the host node of cluster is determined.This method does not need cluster file system and provides lock file, and independent of the stabilization of cluster file system, independence is strong.When the node for initiating election receives the election response message for reaching setting quantity, host node could be become.The phenomenon that when single device, which disconnects, to be connected to the network, single device can not become host node, be not in IP address conflict in cluster.
Description
Technical field
The present invention relates to network storage equipment technical field, in particular to a kind of host node electoral machinery, device and
Distributed memory system.
Background technique
Cluster (Cluster) is a kind of calculate node set for the loose couplings being made of multiple nodes, collaboration get up pair
Outer offer service.Cluster NAS (Network Attached Storage, network attached storage) refers to the multiple nodes of collaboration (i.e.
Commonly called nas head) high-performance, High Availabitity or the NAS (NFS/CIFS) of high load equilibrium service are provided.Cluster NAS is
A kind of (Scale-out) storage architecture extending transversely, the advantage extended with capacity and performance linear.
Cluster NAS system mainly includes cluster file system, High Availabitity NAS cluster and load three logical gates of cluster.
The agreements such as the measured NFS/CIFS/HTTP/FTP of cluster NAS system provide data access service.Multiple physical nodes
(physical host) is built into High Availabitity NAS cluster, alternatively referred to as CTDB cluster by CTDB.CTDB full name is samba CTDB,
It is a cluster TDB database, it can be by Samba or others using storing data is carried out, for example, including for storing
Temporary file needed for samba or other application.The database provides continuous data information for entire CTDB cluster, to protect
Hinder the business continuity of cluster.
It is connected, is born using software interfaces such as NFS/Samba/Httpd/vsftpd between above-mentioned physical node and load cluster
It carries cluster and realizes load using LVS system, externally provide service using single IP address.Fig. 1 shows cluster NAS system
System general frame, as shown in Figure 1, cluster NAS system is logically made of three independent logical groups, actual implementation
These three logical groups can be located on the same physical cluster in deployment.In this way, each physical node can be effectively improved
Utilization efficiency, more importantly cost can be greatlyd save.
In the CTDB cluster being made of multiple physical nodes, a host node (recmaster) can be elected.The main section
By all nodes in cluster by electing, the distribution for being responsible for IP address calculates point, notify it is each from node release IP
Location obtains IP address.
In existing host node electoral package, CTDB cluster provides one lock volumes as shared dependent on memory node
Storage, creation has a lock file (lockfile) in this lock volumes.All nodes attempt become recmaster it
Before, it requires first to carry out locking operation to the lockfile file, after locking successfully, can just enter the election stage, all
A node is elected in node, as recmaster.After recmaster arbitrates out, so that it may complete IP interior deficiency to cluster
Distribution situation carry out equilibrium assignment, guarantee the adapter tube that is balanced as far as possible and realizing void IP of cluster internal void IP distribution, guarantee
Client traffic continuity and the business of each node are balanced as far as possible.
Since above scheme needs to complete recmaster arbitration by the way of file locking using lock volumes of distribution,
Therefore need to rely on the stabilization of rear end distributed file system.In addition, since the shared storage that memory node provides is usually pair
The volume of this type, it is easy to construct the case where splitting brain when the single device suspension in CTDB cluster.
For example, comprising there are three node, node A, node B and node C, lock volumes provides the volume of three copies, so in cluster
Three node (three equipment in other words) composition CTDB clusters are likely to occur if node A is disconnected with other nodes afterwards
The memory space of the only node A of node A access, then also locks successfully, node A becomes recmaster, node B and node C
Also a recmaster is arbitrated out.At this point, forming a small cluster by node A, another small collection is formed by node B and node C
Group, so as to cause IP address conflict occur between two small clusters, commonly referred to as splits brain.
Summary of the invention
For above-mentioned problems of the prior art, the present invention provides a kind of host node electoral machinery, device and divide
Cloth storage system.
In a first aspect, the embodiment of the invention provides a kind of host node electoral machinery, applied to the first node in cluster;
Each node of the cluster has a unique corresponding digital number;The described method includes:
Other nodes into cluster in addition to first node send election and propose message;Message offers are proposed in the election
First node carries the digital number of first node as host node, so that other nodes are according to the first node
The comparison result of digital number and the digital number of itself, it is determined whether message is proposed in the response election;
The election response message that other nodes return is received, and the election response message received is counted;
When the quantity of the election response message received reaches the quantity of setting, determine that first node is the main section of cluster
Point sends election success message to other nodes.
With reference to first aspect, the embodiment of the invention provides the first possible embodiments of first aspect, wherein institute
State the election response message received quantity reach setting quantity include: receive all other node election response disappear
Breath;Alternatively, the quantity of the election response message received reaches the half of all nodes in cluster in the first preset time;
The quantity of the election response message received includes the first node.
With reference to first aspect, the embodiment of the invention provides second of possible embodiments of first aspect, wherein institute
State method further include:
When message is proposed in the election for receiving second node, the second node that the election proposes that message carries is extracted
Digital number;
Message is proposed in the election for judging whether to respond other nodes in addition to first node and second node;
If so, the size of the digital number of the digital number and second node for the third node crossed according to response,
Determine whether that message is proposed in the election for responding the second node;
If not, being determined according to the size of the digital number of the second node and the digital number of the first node
Message is proposed in the election for whether responding the second node.
The third possible embodiment with reference to first aspect, the embodiment of the invention provides the 4th kind of first aspect
Possible embodiment, wherein the method also includes: the digital number for the third node crossed according to response and second section
The size of the digital number of point, it is determined whether the step of responding the election proposal message of the second node, comprising:
Judge whether the digital number of the third node is greater than the digital number of the second node;
If so, sending election response message to the second node;
According to the size of the digital number of the second node and the digital number of the first node, it is determined whether response
The step of message, is proposed in the election of the second node, comprising:
Judge whether the digital number of the second node is greater than the digital number of the first node;
If so, the other nodes executed into cluster in addition to first node send the step of message is proposed in election;
If not, sending election response message to the second node.
The possible embodiment of second with reference to first aspect, the embodiment of the invention provides the third of first aspect
Possible embodiment, wherein after Xiang Suoshu second node sends election response message, the method also includes:
Judge in the second preset time, if receive the election success message that the second node returns;
If so, the other nodes executed into cluster in addition to first node send the step of message is proposed in election.
The possible embodiment of second with reference to first aspect, the embodiment of the invention provides the 5th kind of first aspect
Possible embodiment, wherein the election of the second node is proposed to carry the version for indicating election wheel number in message
Number;The method also includes:
When message is proposed in the election for receiving second node, the version number and described the of message is proposed in the election
The size of the local version number of one node;
If the election proposes that the version number of message is equal to the local version number of the first node, execute described in extracting
The step of digital number for the second node that message carries, is proposed in election;
If the election proposes that the version number of message is greater than the local version number of the first node, according to the choosing
The version number for proposing message is lifted, the local version number of the first node is updated, the extraction election is executed and proposes that message carries
Second node digital number the step of;
If the election proposes that the version number of message is less than the local version number of the first node, described the is judged
Whether the local version number of one node is even number;
If so, whether judging in the local node list of first node comprising the second node;
If not including the second node in the local node list of first node, local version number is promoted, is executed
Other nodes into cluster in addition to first node send the step of message is proposed in election, re-initiate election.
The 5th kind of possible embodiment with reference to first aspect, the embodiment of the invention provides the 6th kind of first aspect
Possible embodiment, wherein the method also includes:
When receiving the election response message of other nodes, judge whether the version number of the election response message is greater than
The local version number of the first node;
If so, updating local version number according to the version number of the election response message, execute into cluster except first
Other nodes except node send the step of message is proposed in election, re-initiate election;
If not, executing the step of counting to the election response message received.
The 5th kind of possible embodiment with reference to first aspect, the embodiment of the invention provides the 7th kind of first aspect
Possible embodiment, wherein the method also includes:
When receiving the election success message of other nodes, judge whether the version number of the election success message is equal to
The local version number of the first node plus one;
If so, updating local version number according to the version number of the election success message;
If not, the other nodes executed into cluster in addition to first node send the step of message is proposed in election, weight
It is new to initiate election.
Second aspect, the embodiment of the invention also provides a kind of host node voting devices, applied to the first segment in cluster
Point;Each node of the cluster has a unique corresponding digital number;Described device includes:
Propose message transmission module, sends election for other nodes into cluster in addition to first node and propose to disappear
Breath;The election proposal message offers first node carries the digital number of first node as host node, so that other
Node is according to the digital number of the first node and the comparison result of the digital number of itself, it is determined whether responds the election
Propose message;
Response message receiving module, the election response message returned for receiving other nodes, and the election to receiving
Response message is counted;
Success message sending module, for when the quantity of the election response message received reaches the quantity of setting, really
Determine the host node that first node is cluster, sends election success message to other nodes.
The third aspect, the embodiment of the invention also provides a kind of distributed memory systems, including multiple sections interconnected
Point, the node include:
Propose message transmission module, sends election for other nodes into cluster in addition to first node and propose to disappear
Breath;The election proposal message offers first node carries the digital number of first node as host node, so that other
Node is according to the digital number of the first node and the comparison result of the digital number of itself, it is determined whether responds the election
Propose message;
Response message receiving module, the election response message returned for receiving other nodes, and the election to receiving
Response message is counted;
Success message sending module, for when the quantity of the election response message received reaches the quantity of setting, really
Determine the host node that first node is cluster, sends election success message to other nodes.
The embodiment of the present invention bring it is following the utility model has the advantages that
Host node electoral machinery, device and distributed memory system provided in an embodiment of the present invention, distributed memory system
Each node in cluster has a unique corresponding digital number, when initiating election, according to the digital number of each node
Size, determine the host node of cluster.This method does not need cluster file system and provides lock file, independent of group document
The stabilization of system, independence are strong.When the node for initiating election receives the election response message for reaching setting quantity, Cai Nengcheng
For host node.When single device, which disconnects, to be connected to the network, it is not in IP address in cluster that single device, which can not become host node,
The phenomenon that conflict.
Other features and advantages of the present invention will illustrate in the following description, also, partly become from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention are in specification, claims
And specifically noted structure is achieved and obtained in attached drawing.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate
Appended attached drawing, is described in detail below.
Detailed description of the invention
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art
Embodiment or attached drawing needed to be used in the description of the prior art be briefly described, it should be apparent that, it is described below
Attached drawing is some embodiments of the present invention, for those of ordinary skill in the art, before not making the creative labor
It puts, is also possible to obtain other drawings based on these drawings.
Fig. 1 is the overall system architecture of cluster NAS system;
Fig. 2 is a kind of flow chart of host node electoral machinery provided by present pre-ferred embodiments;
Fig. 3 is another flow chart of host node electoral machinery provided by present pre-ferred embodiments;
Fig. 4 is another flow chart of host node electoral machinery provided by present pre-ferred embodiments;
Fig. 5 is a kind of structural block diagram of host node voting device provided by present pre-ferred embodiments;
Fig. 6 is another structural block diagram of host node voting device provided by present pre-ferred embodiments.
Icon:
51- proposes message transmission module;52- response message receiving module;53- success message sending module;61- proposal disappears
Cease processing module;62- timed events module;63- success message processing module.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with attached drawing to the present invention
Technical solution be clearly and completely described, it is clear that described embodiments are some of the embodiments of the present invention, rather than
Whole embodiments.The component of embodiments of the present invention, which are generally described and illustrated herein in the accompanying drawings can be matched with a variety of different
It sets to arrange and design.Therefore, the detailed description of the embodiment of the present invention provided in the accompanying drawings is not intended to limit below
The range of claimed invention, but it is merely representative of selected embodiment of the invention.Based on the embodiments of the present invention, originally
Field those of ordinary skill every other embodiment obtained without making creative work, belongs to the present invention
The range of protection.
For the mode for electing host node to generally use file locking in existing cluster, need to rely on distributed type assemblies text
The stabilization of part system, and the problem of be easy to happen IP address conflict, the embodiment of the invention provides a kind of host node electoral machinery,
Device and distributed memory system determine the host node of cluster, are not required to according to the size of the digital number of node each in cluster
Cluster file system is wanted to provide lock file, independent of the stabilization of cluster file system, independence is strong;And when single device is disconnected
When opening network connection, the phenomenon that being not in IP address conflict in cluster.
Fig. 2 shows the flow charts for the host node electoral machinery that present pre-ferred embodiments provide.The host node election side
Method can be applied to any node equipment in cluster.It distinguishes for ease of description and with other nodes, hereinafter referred to as first
Node.The cluster may be, but not limited to, cluster NAS system as shown in Figure 1.In cluster NAS system, multiple storage sections
Point or physical node form CTDB cluster.Cluster includes all nodes loaded in nodes file.Each usual root of node
It is loaded into memory according to configuration file/etc/ctdb/nodes configuration file, the corresponding digital number (pnn) of each node.
For example, the pnn of node can since 0, then 1,2,3,4 ....
When electing the host node of cluster, it can conduct an election only in accordance with the digital number of node, each node can be sent out
It rises and proposes, it is proposed that oneself be host node, when receiving the proposal of other nodes, if being in the election stage, can also receive from number
Word numbers the proposal of smaller or larger node, so as to fast convergence, achievees the purpose that quickly to elect.
As shown in Fig. 2, being applied to the host node electoral machinery of first node, include the following steps:
Step S202, other nodes into cluster in addition to first node send election and propose message.
Host node or host node exception are not present in cluster when first node detects, or needs to send out again there are other
When the case where playing election, according to the record in local memory, all nodes that election can be participated in current cluster are found.To collection
Other nodes in group in addition to first node send election and propose message.The election proposes message offers first node as master
Node, and the digital number of first node is carried, so that digital number and itself number of other nodes according to first node
The comparison result of word number, it is determined whether respond the election and propose message.
When message is proposed in the election that other nodes receive first node transmission, compare the digital number of first node with from
The size of the digital number of body, according to preset rules, it is determined whether respond the election and propose message.For example, preset rules can be with
It is in response to the proposal from the smaller node of digital number, or is in response to the proposal from the bigger node of digital number.With
It is illustrated so that preset rules are proposal of the response from the smaller node of digital number as an example down.It is sent out when other nodes determine
When election proposes that the digital number of the first node of message is less than the digital number of itself out, the election can be responded and propose message,
Election response message is sent to first node.
Step S204 receives the election response message that other nodes return, and carries out to the election response message received
It counts.
Step S206 determines that first node is when the quantity of the election response message received reaches the quantity of setting
The host node of cluster sends election success message to other nodes.
Wherein, the quantity of setting can be adjusted according to actual needs, and the quantity of the election response message received reaches
To the quantity of setting, the following two kinds situation can be, but not limited to, receive the election response message of all other node, alternatively,
The quantity of the election response message received reaches the half of all nodes in cluster;In the election response message that statistics receives
Quantity when, default first node agree to itself election propose, the quantity of the election response message received includes first segment
Point.
For example, the election received responds when first node receives the election response message of all other node
The quantity of message, equal in the cluster recorded in local memory when the sum of all other node, then it is assumed that elect successfully, Xiang Qi
Its node sends election success message, and updates the record in corresponding local memory.Alternatively, being connect in the first preset time
The quantity of the election response message received reaches the half of all nodes in cluster.First preset time can be according to actual needs
It is adjusted, if not receiving the response of all other node in the first preset time, then judges the election received
Whether the quantity of response message has been above the half of all number of nodes in cluster;The quantity of the election response message received
Including first node.If it is not, then a retriggered new round is elected.If it is, thinking to elect successfully, sent to other nodes
Success message is elected, other nodes is notified to elect successfully, so that other nodes stop the ongoing election stage.
It should be understood that all number of nodes in cluster can also be reached in the quantity of the election response message received
Half when, it is believed that elect successfully, stop timing and counting, send election success message to other nodes, with stop into
The capable election stage.
If elected successfully, first node becomes the host node of cluster, can normally start adapter tube process, with being responsible for IP
The business such as the equilibrium assignment of location.
The host node electoral machinery determines the host node of cluster, does not need according to the size of the digital number of each node
Cluster file system provides lock file, and independent of the stabilization of cluster file system, independence is strong.Due to when initiation election
When node receives the election response message for reaching setting quantity, host node could be become, therefore, when single device disconnects network
The phenomenon that when connection, single device can not become host node, be not in IP address conflict in cluster is not in split brain to show
As.
On the basis of method illustrated in the above embodiments, if first node receives the election from other nodes
Propose that message, treatment process are as shown in Figure 3, comprising:
Step S302 extracts election and proposes message carries second when message is proposed in the election for receiving second node
The digital number of node.
Step S304, the election proposal for judging whether to respond other nodes in addition to first node and second node disappear
Breath;If so, step S306 is executed,;If not, executing step S308.
Step S306, the size of the digital number of the digital number and second node for the third node crossed according to response, really
Message is proposed in the fixed election for whether responding second node.
If the digital number of third node is greater than the digital number of second node, smaller number is numbered according to response
The preset rules of node send election response message to second node.If the digital number of third node is less than second node
Digital number, then according to preset rules, abandon the election propose message, be not responding to second node election propose message.
Step S308, according to the size of the digital number of second node and the digital number of the first node, determination is
Message is proposed in the election of the no response second node.
If the digital number of second node is greater than the digital number of first node, the election for being not responding to second node is proposed
Message executes other nodes into cluster in addition to first node and sends the step of message is proposed in election, re-initiates election,
It is referred to step S202 to step S206 in Fig. 2 later to execute, details are not described herein.If the digital number of second node is small
In the digital number of first node, then election response message is sent to second node.
After sending election response message to second node, judge in the second preset time, if receive second
The election success message that node returns.If it is, electing successfully, second node becomes the host node of cluster.If not, executing
Other nodes into cluster in addition to first node send election and propose message, re-initiate election.
Wherein, the second preset time can be adjusted according to actual needs, and the second preset time can be with above-mentioned first
Preset time is consistent.Can also the second preset time be set and be greater than the first preset time, to avoid in node according to actual needs
Offline or in the case where other Network Abnormals, time-out when electing successfully is waited after may cause vote by ballot and then is sent out repeatedly
Election is played, the case where can not electing host node always in a few minutes even longer time generation is eventually led to.
When starting election, i.e., node needs to cancel pervious timed events, restarts when sending election proposal message
New timed events, to execute the processing after time-out when electing time-out.After sending election response message, it is also desirable to which cancellation can
The timed events of energy, restart new timed task, to re-initiate choosing when time-out does not receive election success message
It lifts.When sending election success message and receiving election success message, corresponding timed events will be cancelled, avoid causing new
Re-elect.
In order to guarantee that each node in the election of same wheel, can also increase version in election message when transmitting message
This number, version number can also indicate stable state using number, even number, and odd number is indicated in election state.Each node is being sent
When message, election response message and election success message are proposed in election, the version number for indicating election wheel number is all carried.
It in the present embodiment, can be using such as Fig. 4 institute when message is proposed in the election that first node receives second node
The method shown executes, comprising:
Message is proposed in step S402, the election for receiving second node.
Step S404 compares the size that the version number of message and the local version number of first node are proposed in election;If choosing
The local version number for proposing that the version number of message is greater than first node is lifted, step S406 is executed;If the version of message is proposed in election
This number local version number for being equal to first node, executes step S408;If election proposes that the version number of message is less than first segment
The local version number of point executes step S412.
Step S406 updates the local version number of first node.
Step S408 extracts the digital number for the second node that election proposes that message carries.
Step S410, according to the size of the digital number of second node, it is determined whether the election for responding second node is proposed
Message.Specifically can be by executing step S302~step S308 the step of, to determine whether that the election for responding second node mentions
Discuss message.
Step S412 judges whether the local version number of first node is even number;If so, executing step S414;If
It is no, execute step S416.
Whether step S414 judges in the local node list of first node comprising second node;If so, executing step
S416;If not, executing step S418.
Step S416 ignores the election and proposes message.
Step S418 promotes local version number, executes other nodes into cluster in addition to first node and sends election
The step of proposing message, re-initiates election.
If election proposes that the version number of message is less than the local version number of first node, and the local version of first node
When number being odd number, illustrates that first node is in the election stage, version number's lower election proposal message can be ignored.
If election proposes that the version number of message is less than the local version number of first node, when the local version of first node
It number is even number, and when second node is not in the local node list that the memory of first node records, then explanation is likely to be new
Node joined cluster, re-initiate election.When the local version number of first node is even number, and second node has existed
When in the local node list that the memory of first node records, then illustrate that the election proposes that message is Geju City message, Ke Yizhi
It connects and ignores.
Similarly, when first node receives the election response message of other nodes, judge the version for electing response message
Number whether be greater than first node local version number;If so, updating local version according to the version number of election response message
Number, it executes other nodes into cluster in addition to first node and sends the step of message is proposed in election, re-initiate election;Such as
The step of fruit is no, and execution counts the election response message received.After electing successfully, if first node becomes cluster
Host node, then then local version number plus one is sent election success message to other nodes by first node.
When first node receives the election success message of other nodes, judge elect success message version number whether
Equal to the local version number of first node plus one;
If so, updating local version number according to the version number of the election success message;
If not, the other nodes executed into cluster in addition to first node send the step of message is proposed in election, weight
It is new to initiate election.
The embodiment of the present invention is based on paxos algorithm, and the node for obtaining the ballot paper more than half becomes the host node of cluster, bears
The distribution of IP address and adapter tube in entire cluster are blamed, so that entire cluster be kept reliably to run, the read-write of user is unaffected.
Due to needing the ballot paper more than half that could arbitrate the host node for cluster, so would not also occur when single device suspension
The case where splitting brain.
Further, since the distributed cluster file system independent of rear end, that is, the cluster can be completely self-contained
As a distributed head cluster, user can flexibly be disposed according to practical application and environment, and business is accepted in rear end
NAS the IP SAN application that can be single machine, is also possible to the storage system of distributed file system composition, is also possible to point
The storage of cloth block.If environmental permission, head and storage equipment unification can also be disposed more flexible.
With above method embodiment correspondingly, the embodiment of the invention also provides a kind of host node voting device, application
First node in cluster.Each node of cluster has a unique corresponding digital number.As shown in figure 5, the device
Include:
Propose message transmission module 51, sends election for other nodes into cluster in addition to first node and propose to disappear
Breath;Election proposal message offers first node carries the digital number of first node as host node, so that other sections
Point is according to the digital number of first node and the comparison result of the digital number of itself, it is determined whether message is proposed in response election;
Response message receiving module 52, the election response message returned for receiving other nodes, and the choosing to receiving
Response message is lifted to be counted;
Success message sending module 53, for when the quantity of the election response message received reaches the quantity of setting,
It determines that first node is the host node of cluster, sends election success message to other nodes.
Wherein, success message sending module 53, can be also used for: when the election response message for receiving all other node
When;Alternatively, the quantity of the election response message received reaches the half of all nodes in cluster in the first preset time;
The quantity of the election response message received includes the first node.
In an optional embodiment, as shown in fig. 6, described device can also include:
Propose message processing module 61, for election being extracted and being proposed when message is proposed in the election for receiving second node
The digital number for the second node that message carries;Judge whether to respond other nodes in addition to first node and second node
Election propose message;If so, the digital number for the third node crossed according to response and the digital number of the second node
Size, it is determined whether respond second node election propose message;If not, according to the digital number of second node with it is described
The size of the digital number of first node, it is determined whether message is proposed in the election for responding second node;
Timed events module 62, for judging in the second preset time, if receive the election of second node return
Success message;If not, the other nodes executed into cluster in addition to first node send the step of message is proposed in election.
Wherein, it is proposed that message processing module 61 can be also used for: when message is proposed in the election for receiving second node,
Compare the size that the version number of message and the local version number of first node are proposed in election;If the version number of message is proposed in election
Equal to the local version number of first node, executes and extract the step of digital number of second node of message carrying is proposed in election;
If election proposes that the version number of message is greater than the local version number of first node, propose the version number of message according to election,
The step of updating the local version number of first node, executing the digital number for extracting the second node that election proposes that message carries;
If election proposes that the version number of message is less than the local version number of first node, judge that the local version number of first node is
No is even number;If so, whether judging in the local node list of first node comprising second node;If the sheet of first node
Do not include second node in node list, then promotes local version number, execute other in addition to first node into cluster
Node sends the step of message is proposed in election, re-initiates election.
Response message receiving module 52 can be also used for judging to select when receiving the election response message of other nodes
Whether the version number for lifting response message is greater than the local version number of first node;If so, according to the version of election response message
Number, local version number is updated, other nodes into cluster in addition to first node is executed and sends the step of message is proposed in election,
Re-initiate election;If not, executing the step of counting to the election response message received.
Optionally, described device can also include:
Success message processing module 63, for judging to elect successfully when receiving the election success message of other nodes
Whether the version number of message is equal to the local version number plus one of the first node;If so, according to the version of election success message
This number, update local version number;If not, the other nodes transmission election executed into cluster in addition to first node is proposed to disappear
The step of breath, re-initiates election.
Host node voting device provided in an embodiment of the present invention, when initiating election, according to the digital number of each node
Size determines the host node of cluster.This method does not need cluster file system and provides lock file, independent of group document system
The stabilization of system, independence are strong.When the node for initiating election receives the election response message for reaching setting quantity, could become
Host node.When single device, which disconnects, to be connected to the network, single device can not become host node, be not in IP address punching in cluster
Prominent phenomenon.
The embodiment of the invention also provides a kind of distributed memory system, including multiple nodes interconnected, Mei Gejie
Point is a storage equipment, and all storage equipment form CTDB cluster.Above-mentioned host node election dress is provided in storage equipment
It sets.Each node of distributed memory system determines the host node of cluster, is responsible for by executing above-mentioned host node electoral machinery
The distribution of IP address and adapter tube, keep the reliability service of entire cluster in entire cluster.Other nodes be used as from node, provide with
The identical data access capabilities of host node.
Host node electoral machinery, host node voting device and distributed memory system provided in an embodiment of the present invention have phase
Same technical characteristic reaches identical technical effect so also can solve identical technical problem.
It should be noted that in embodiment provided by the present invention, it should be understood that disclosed system and method, it can
To realize by another way.The apparatus embodiments described above are merely exemplary, for example, the unit is drawn
Point, only a kind of logical function partition, there may be another division manner in actual implementation, in another example, multiple units or group
Part can be combined or can be integrated into another system, or some features can be ignored or not executed.It is described to be used as separation unit
The unit that part illustrates may or may not be physically separated, and component shown as a unit can be or can also
Not to be physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to reality
Needs some or all of the units may be selected to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in embodiment provided by the invention can integrate in one processing unit, it can also
To be that each unit physically exists alone, can also be integrated in one unit with two or more units.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a
People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.
In addition, term " first ", " second ", " third " are used for description purposes only, it is not understood to indicate or imply phase
To importance.
Finally, it should be noted that embodiment described above, only a specific embodiment of the invention, to illustrate the present invention
Technical solution, rather than its limitations, scope of protection of the present invention is not limited thereto, although with reference to the foregoing embodiments to this hair
It is bright to be described in detail, those skilled in the art should understand that: anyone skilled in the art
In the technical scope disclosed by the present invention, it can still modify to technical solution documented by previous embodiment or can be light
It is readily conceivable that variation or equivalent replacement of some of the technical features;And these modifications, variation or replacement, do not make
The essence of corresponding technical solution is detached from the spirit and scope of technical solution of the embodiment of the present invention, should all cover in protection of the invention
Within the scope of.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. a kind of host node electoral machinery, which is characterized in that applied to the first node in cluster;Each node of the cluster
With a unique corresponding digital number;The described method includes:
Other nodes into cluster in addition to first node send election and propose message;Message offers first are proposed in the election
Node carries the digital number of first node as host node, so that number of other nodes according to the first node
The comparison result of number and the digital number of itself, it is determined whether message is proposed in the response election;
The election response message that other nodes return is received, and the election response message received is counted;
When the quantity of the election response message received reaches the quantity of setting, determine that first node is the host node of cluster,
Election success message is sent to other nodes.
2. being set the method according to claim 1, wherein the quantity of the election response message received reaches
Fixed quantity includes: the election response message for receiving all other node;Alternatively, being received in the first preset time
The quantity of election response message reaches the half of all nodes in cluster;The quantity of the election response message received includes
The first node.
3. the method according to claim 1, wherein the method also includes:
When message is proposed in the election for receiving second node, the number for the second node that the election proposes that message carries is extracted
Number;
Message is proposed in the election for judging whether to respond other nodes in addition to first node and second node;
If so, the size of the digital number of the digital number and second node for the third node crossed according to response, determines
Message is proposed in the election for whether responding the second node;
If not, according to the size of the digital number of the second node and the digital number of the first node, it is determined whether
Message is proposed in the election for responding the second node.
4. according to the method described in claim 3, it is characterized in that, according to response cross third node digital number with it is described
The size of the digital number of second node, it is determined whether the step of responding the election proposal message of the second node, comprising:
Judge whether the digital number of the third node is greater than the digital number of the second node;
If so, sending election response message to the second node;
According to the size of the digital number of the second node and the digital number of the first node, it is determined whether described in response
The step of message, is proposed in the election of second node, comprising:
Judge whether the digital number of the second node is greater than the digital number of the first node;
If so, the other nodes executed into cluster in addition to first node send the step of message is proposed in election;
If not, sending election response message to the second node.
5. according to the method described in claim 4, it is characterized in that, to the second node send election response message after,
The method also includes:
Judge in the second preset time, if receive the election success message that the second node returns;
If not, the other nodes executed into cluster in addition to first node send the step of message is proposed in election.
6. according to the method described in claim 3, it is characterized in that, being carried in the election proposal message of the second node useful
The version number of wheel number is elected in mark;The method also includes:
When message is proposed in the election for receiving second node, the version number of the election proposal message and the first segment
The size of the local version number of point;
If the election proposes that the version number of message is equal to the local version number of the first node, executes and extract the election
The step of proposing the digital number for the second node that message carries;
If the election proposes that the version number of message is greater than the local version number of the first node, mentioned according to the election
The version number for discussing message, updates the local version number of the first node, executes extract that the election proposes that message carries the
The step of digital number of two nodes;
If the election proposes that the version number of message is less than the local version number of the first node, the first segment is judged
Whether the local version number of point is even number;
If so, whether judging in the local node list of first node comprising the second node;
If not including the second node in the local node list of first node, local version number is promoted, is executed to collection
Other nodes in group in addition to first node send the step of message is proposed in election, re-initiate election.
7. according to the method described in claim 6, it is characterized in that, the method also includes:
When receiving the election response message of other nodes, it is described to judge whether the version number of the election response message is greater than
The local version number of first node;
If so, updating local version number according to the version number of the election response message, execute into cluster except first node
Except other nodes send election propose message the step of, re-initiate election;
If not, executing the step of counting to the election response message received.
8. according to the method described in claim 6, it is characterized in that, the method also includes:
When receiving the election success message of other nodes, it is described to judge whether the version number of the election success message is equal to
The local version number of first node plus one;
If so, updating local version number according to the version number of the election success message;
If not, the other nodes executed into cluster in addition to first node send the step of message is proposed in election, send out again
Play election.
9. a kind of host node voting device, which is characterized in that applied to the first node in cluster;Each node of the cluster
With a unique corresponding digital number;Described device includes:
Propose message transmission module, sends election for other nodes into cluster in addition to first node and propose message;Institute
Election proposal message offers first node is stated as host node, and carries the digital number of first node, so that other nodes
According to the comparison result of the digital number of the first node and the digital number of itself, it is determined whether the response election is proposed
Message;
Response message receiving module, the election response message returned for receiving other nodes, and the election received is responded
Message is counted;
Success message sending module, for when the quantity of the election response message received reaches the quantity of setting, determining
One node is the host node of cluster, sends election success message to other nodes.
10. a kind of distributed memory system, which is characterized in that including multiple nodes interconnected, the node includes:
Propose message transmission module, sends election for other nodes into cluster in addition to first node and propose message;Institute
Election proposal message offers first node is stated as host node, and carries the digital number of first node, so that other nodes
According to the comparison result of the digital number of the first node and the digital number of itself, it is determined whether the response election is proposed
Message;
Response message receiving module, the election response message returned for receiving other nodes, and the election received is responded
Message is counted;
Success message sending module, for when the quantity of the election response message received reaches the quantity of setting, determining
One node is the host node of cluster, sends election success message to other nodes.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711498417.5A CN109995835A (en) | 2017-12-29 | 2017-12-29 | Host node electoral machinery, device and distributed memory system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711498417.5A CN109995835A (en) | 2017-12-29 | 2017-12-29 | Host node electoral machinery, device and distributed memory system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109995835A true CN109995835A (en) | 2019-07-09 |
Family
ID=67111716
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711498417.5A Pending CN109995835A (en) | 2017-12-29 | 2017-12-29 | Host node electoral machinery, device and distributed memory system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109995835A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110417882A (en) * | 2019-07-22 | 2019-11-05 | 卓尔智联(武汉)研究院有限公司 | The determination method, apparatus and storage medium of host node |
CN110545224A (en) * | 2019-09-06 | 2019-12-06 | 杭州涂鸦信息技术有限公司 | Device group synchronization control method, readable storage medium and computer device |
CN111162942A (en) * | 2019-12-27 | 2020-05-15 | 杭州涂鸦信息技术有限公司 | Cluster election method and system |
CN111538763A (en) * | 2020-04-24 | 2020-08-14 | 咪咕文化科技有限公司 | Method for determining main node in cluster, electronic equipment and storage medium |
CN113242296A (en) * | 2021-05-08 | 2021-08-10 | 山东英信计算机技术有限公司 | Method, system and medium for electing master node in cluster |
CN113297236A (en) * | 2020-11-10 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Method, device and system for electing main node in distributed consistency system |
CN113572820A (en) * | 2021-07-01 | 2021-10-29 | 西安震有信通科技有限公司 | Cluster construction method and device, terminal equipment and storage medium |
CN113641692A (en) * | 2021-08-18 | 2021-11-12 | 福建天晴数码有限公司 | Scheme and system for realizing distributed cluster node participation |
WO2022033290A1 (en) * | 2020-08-12 | 2022-02-17 | 百果园技术(新加坡)有限公司 | Strong consistency storage system, strong consistency data storage method, server, and medium |
CN114448866A (en) * | 2021-12-23 | 2022-05-06 | 东莞市李群自动化技术有限公司 | Network domain management and control method, network system, equipment and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7697490B2 (en) * | 2004-12-01 | 2010-04-13 | Telefonaktiebolaget L M Ericsson (Publ) | Cluster of terminals and ad-hoc network for cluster-based multi-party conferencing |
CN102929696A (en) * | 2012-09-28 | 2013-02-13 | 北京搜狐新媒体信息技术有限公司 | Method and apparatus for constructing, submitting and monitoring center node of distributed system |
CN103118084A (en) * | 2013-01-21 | 2013-05-22 | 浪潮(北京)电子信息产业有限公司 | Host node election method and node |
CN103491168A (en) * | 2013-09-24 | 2014-01-01 | 浪潮电子信息产业股份有限公司 | Cluster election design method |
CN103780615A (en) * | 2014-01-20 | 2014-05-07 | 五八同城信息技术有限公司 | Sharing method of client conversation data among multiple servers |
CN105338028A (en) * | 2014-07-30 | 2016-02-17 | 浙江宇视科技有限公司 | Method and device for selecting master and slave nodes in distributed server cluster |
CN106331098A (en) * | 2016-08-23 | 2017-01-11 | 东方网力科技股份有限公司 | Server cluster system |
CN107046474A (en) * | 2016-12-20 | 2017-08-15 | 东软集团股份有限公司 | A kind of service cluster |
CN107404511A (en) * | 2016-03-31 | 2017-11-28 | 阿里巴巴集团控股有限公司 | The replacement method and equipment of server in cluster |
-
2017
- 2017-12-29 CN CN201711498417.5A patent/CN109995835A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7697490B2 (en) * | 2004-12-01 | 2010-04-13 | Telefonaktiebolaget L M Ericsson (Publ) | Cluster of terminals and ad-hoc network for cluster-based multi-party conferencing |
CN102929696A (en) * | 2012-09-28 | 2013-02-13 | 北京搜狐新媒体信息技术有限公司 | Method and apparatus for constructing, submitting and monitoring center node of distributed system |
CN103118084A (en) * | 2013-01-21 | 2013-05-22 | 浪潮(北京)电子信息产业有限公司 | Host node election method and node |
CN103491168A (en) * | 2013-09-24 | 2014-01-01 | 浪潮电子信息产业股份有限公司 | Cluster election design method |
CN103780615A (en) * | 2014-01-20 | 2014-05-07 | 五八同城信息技术有限公司 | Sharing method of client conversation data among multiple servers |
CN105338028A (en) * | 2014-07-30 | 2016-02-17 | 浙江宇视科技有限公司 | Method and device for selecting master and slave nodes in distributed server cluster |
CN107404511A (en) * | 2016-03-31 | 2017-11-28 | 阿里巴巴集团控股有限公司 | The replacement method and equipment of server in cluster |
CN106331098A (en) * | 2016-08-23 | 2017-01-11 | 东方网力科技股份有限公司 | Server cluster system |
CN107046474A (en) * | 2016-12-20 | 2017-08-15 | 东软集团股份有限公司 | A kind of service cluster |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110417882B (en) * | 2019-07-22 | 2022-04-08 | 卓尔智联(武汉)研究院有限公司 | Method and device for determining main node and storage medium |
CN110417882A (en) * | 2019-07-22 | 2019-11-05 | 卓尔智联(武汉)研究院有限公司 | The determination method, apparatus and storage medium of host node |
CN110545224A (en) * | 2019-09-06 | 2019-12-06 | 杭州涂鸦信息技术有限公司 | Device group synchronization control method, readable storage medium and computer device |
CN111162942A (en) * | 2019-12-27 | 2020-05-15 | 杭州涂鸦信息技术有限公司 | Cluster election method and system |
CN111538763A (en) * | 2020-04-24 | 2020-08-14 | 咪咕文化科技有限公司 | Method for determining main node in cluster, electronic equipment and storage medium |
CN111538763B (en) * | 2020-04-24 | 2023-08-15 | 咪咕文化科技有限公司 | Method for determining master node in cluster, electronic equipment and storage medium |
WO2022033290A1 (en) * | 2020-08-12 | 2022-02-17 | 百果园技术(新加坡)有限公司 | Strong consistency storage system, strong consistency data storage method, server, and medium |
CN113297236A (en) * | 2020-11-10 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Method, device and system for electing main node in distributed consistency system |
CN113242296A (en) * | 2021-05-08 | 2021-08-10 | 山东英信计算机技术有限公司 | Method, system and medium for electing master node in cluster |
CN113242296B (en) * | 2021-05-08 | 2023-05-26 | 山东英信计算机技术有限公司 | Method, system and medium for electing master node in cluster |
CN113572820A (en) * | 2021-07-01 | 2021-10-29 | 西安震有信通科技有限公司 | Cluster construction method and device, terminal equipment and storage medium |
CN113572820B (en) * | 2021-07-01 | 2024-02-02 | 西安震有信通科技有限公司 | Cluster construction method and device, terminal equipment and storage medium |
CN113641692A (en) * | 2021-08-18 | 2021-11-12 | 福建天晴数码有限公司 | Scheme and system for realizing distributed cluster node participation |
CN114448866A (en) * | 2021-12-23 | 2022-05-06 | 东莞市李群自动化技术有限公司 | Network domain management and control method, network system, equipment and storage medium |
CN114448866B (en) * | 2021-12-23 | 2024-04-12 | 东莞市李群自动化技术有限公司 | Network domain management and control method, network system, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109995835A (en) | Host node electoral machinery, device and distributed memory system | |
CN106878473A (en) | A kind of message treatment method, server cluster and system | |
CN105933376B (en) | A kind of data manipulation method, server and storage system | |
CN107430603B (en) | System and method for massively parallel processing of databases | |
WO2016150066A1 (en) | Master node election method and apparatus, and storage system | |
EP2919130A1 (en) | Method and system for synchronizing distributed database | |
CN104243527A (en) | Data synchronization method and device and distributed system | |
CN105376277B (en) | A kind of method of data synchronization and device | |
CN105187464B (en) | Method of data synchronization, apparatus and system in a kind of distributed memory system | |
CN106843745A (en) | Capacity expansion method and device | |
CN109218100A (en) | Distributed objects storage cluster and its request responding method, system and storage medium | |
CN105518641B (en) | Point-to-Point Data clone method, equipment and system and host node switching method, equipment and system | |
CN102609446B (en) | Distributed Bloom filter system and application method thereof | |
CN101673289B (en) | Method and device for constructing distributed file storage framework | |
CN103118084A (en) | Host node election method and node | |
CN107451013B (en) | Data recovery method, device and system based on distributed system | |
CN104023246B (en) | A kind of video data private cloud storage system and video data private cloud storage method | |
CN106777164B (en) | Data migration cluster and data migration method | |
EP3125501A1 (en) | File synchronization method, server, and terminal | |
CN107357688A (en) | Distributed system and its fault recovery method and device | |
CN104679796A (en) | Selecting method, selecting device and database mirror image cluster node | |
CN103229480B (en) | Data processing method and equipment, client in distributed memory system | |
CN106878388A (en) | Detection to slow node in distributed memory system | |
CN101344882B (en) | Data query method, insertion method and deletion method | |
CN110417882A (en) | The determination method, apparatus and storage medium of host node |
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: 20190709 |
|
RJ01 | Rejection of invention patent application after publication |