Distributed cluster node management method, system and equipment
By monitoring the master management node and electing a new master management node from candidate master management nodes, the problem of service unavailability in distributed cluster systems when the master management node fails is solved, achieving rapid recovery and seamless service availability improvement.
Patent Information
- Application Number
- CN202311713043.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2026-05-05
AI Technical Summary
When the master management node of an existing distributed cluster system fails, the entire cluster becomes unavailable, affecting service availability and reliability.
By monitoring the running status of the master management node, proposing a new master management node is initiated at a random delay time, and configuration information is broadcast to ensure rapid and seamless service recovery.
It enables the rapid election of a new master management node when the master management node fails, ensuring service availability and seamless operation, and improving the availability and reliability of the distributed cluster.
Smart Images

Figure CN121984844A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of distributed cluster management technology, and more specifically, to a distributed cluster node management method, system, and device. Background Technology
[0002] With the continuous development of technologies such as social networks, mobile internet, and e-commerce, internet users are contributing increasingly more content. To process this content, distributed cluster systems are now widely used for data storage, computation, and value extraction. Ensuring business availability places high demands on the reliability and availability of distributed cluster systems.
[0003] Currently, most distributed cluster products and software use a master-slave cluster architecture, typically with one master and one slave or one master and multiple slaves. There is also a typical single-master centralized cluster architecture. For these cluster architectures, if the master management node fails, the entire cluster will usually become unavailable, which poses a significant challenge to service availability.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] To address the problems in the existing technology, the present invention aims to provide a distributed cluster node management method, system, and device that can quickly elect a new master management node to replace the current master management node when it fails, thus ensuring service availability and seamless operation, thereby facilitating the availability and reliability of the distributed cluster.
[0006] To achieve the above objectives, the present invention provides a distributed cluster node management method, wherein the cluster includes a master management node and multiple candidate management nodes, and the method includes the following steps:
[0007] Obtain the running status of the main management node and monitor its running status;
[0008] In response to determining that the main management node has failed based on its operating status, a proposal is initiated for each of the candidate management nodes after a random delay, thus obtaining the proposal initiation time corresponding to each of the candidate management nodes;
[0009] Based on the proposal initiation time, a target management node is determined from the candidate management nodes, and the target management node is designated as the new primary management node.
[0010] Obtain the configuration information corresponding to the new master management node, and broadcast the configuration information to all nodes in the cluster.
[0011] Optionally, determining the target management node from the candidate management nodes based on the proposal initiation time includes:
[0012] The candidate management node with the earliest proposal initiation time is determined as the target management node.
[0013] Optionally, before determining the target management node from the candidate management nodes based on the proposal initiation time, the method further includes:
[0014] Based on the proposal initiation time, the proposal initiation behavior is triggered for each of the candidate management nodes, and a first proposal response corresponding to each proposal initiation behavior is received;
[0015] The step of determining the target management node from the candidate management nodes based on the proposal initiation time includes:
[0016] Based on the proposal initiation time and the first proposal response, the target management node is determined from the candidate management nodes.
[0017] Optionally, the type of the first proposal response is a positive response or a negative response; the step of determining the target management node from the candidate management nodes based on the proposal initiation time and the first proposal response includes:
[0018] The candidate management node with the earliest proposal initiation time will be designated as the first initial management node.
[0019] When the number of first proposal responses of type positive received by the first initial management node accounts for a proportion of all candidate management nodes greater than a first preset threshold, the first initial management node is determined as the target management node.
[0020] Optionally, determining the target management node from the candidate management nodes based on the proposal initiation time includes:
[0021] Based on the proposal initiation time, a second initial management node is determined from the candidate management nodes;
[0022] In response to the second initial management node sending a proposal preparation request to the other candidate management nodes, the second proposal responses made by the other candidate management nodes are counted; the type of the second proposal response is either a positive response or a negative response.
[0023] When the proportion of positive responses in the second proposal response to all candidate management nodes is greater than the second preset threshold, all candidate management nodes that have made positive responses are determined as intermediate management nodes.
[0024] The second initial management node sends a proposal reception request to the intermediate management node;
[0025] Obtain the third proposal response from the intermediate management node in response to the proposal acceptance request; the type of the third proposal response is either a positive response or a negative response;
[0026] The candidate management node that initiates the proposal earliest and whose number of positive responses in the corresponding third proposal response is greater than a third preset threshold among all intermediate management nodes is identified as the target management node.
[0027] Optionally, each proposal has an attribute value pair, the attribute value pair including a proposal number; determining the target management node from the candidate management nodes based on the proposal initiation time includes:
[0028] The candidate management node that initiates the proposal earliest and simultaneously meets the preset rules is determined as the target management node; the preset rules are that the value corresponding to the proposal number of the target management node is greater than or equal to the value corresponding to the proposal number of the other candidate management nodes.
[0029] Optionally, the cluster further includes multiple worker nodes; the management method further includes the steps of:
[0030] In response to the number of candidate management nodes being less than a fourth preset threshold, a target working node is determined from the working nodes according to a preset strategy, and the target working node is used as a new candidate management node.
[0031] Optionally, the preset strategy is to randomly select a working node as the target working node from among all working nodes located at different sites and in different racks from all candidate management nodes.
[0032] The present invention also provides a distributed cluster node management system for implementing the above-described distributed cluster node management method, the system comprising:
[0033] The first status monitoring module acquires the operating status of the main management node and monitors the operating status of the main management node.
[0034] The proposal initiation time processing module, in response to determining that the main management node has failed based on the running status of the main management node, initiates proposals for each of the candidate management nodes after a random delay, thereby obtaining the proposal initiation time corresponding to each of the candidate management nodes;
[0035] The master management node election module determines a target management node from the candidate management nodes based on the proposal initiation time, and designates the target management node as the new master management node; and
[0036] The cluster broadcast module obtains the configuration information corresponding to the new master management node and broadcasts the configuration information to all nodes in the cluster.
[0037] The present invention also provides a distributed cluster node management device, comprising:
[0038] processor;
[0039] A memory in which an executable program of the processor is stored;
[0040] The processor is configured to execute the steps of any of the above-described distributed cluster node management methods by executing the executable program.
[0041] Compared with the prior art, the present invention has the following advantages and outstanding effects:
[0042] The distributed cluster node management method, system, and device provided by this invention, when detecting a failure of the current master management node, quickly elects a new master management node from the current candidate management nodes according to a preset election strategy to replace it, and updates the configuration information and broadcasts it to all nodes; thus ensuring the availability and seamlessness of the service, thereby improving the availability and reliability of the distributed cluster. Attached Figure Description
[0043] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0044] Figure 1 This is a schematic diagram of a distributed cluster node management method disclosed in an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram of a distributed cluster deployment disclosed in an embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of a distributed cluster node management method disclosed in another embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram of a distributed cluster node management method disclosed in another embodiment of the present invention;
[0048] Figure 5 This is a schematic diagram of a distributed cluster node management method disclosed in another embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram of the structure of a distributed cluster node management system disclosed in an embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of the structure of a distributed cluster node management device disclosed in an embodiment of the present invention. Detailed Implementation
[0051] The following specific examples illustrate the implementation methods of this application. Those skilled in the art can easily understand the other advantages and effects of this application from the content disclosed herein. This application can also be implemented or applied through other different specific embodiments, and various details in this application can be modified or changed according to different viewpoints and application systems without departing from the spirit of this application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0052] The embodiments of this application will now be described in detail with reference to the accompanying drawings, so that those skilled in the art can easily implement the application. This application may be embodied in many different forms and is not limited to the embodiments described herein.
[0053] In this application, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics represented in connection with that embodiment or example, which are included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics represented may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate different embodiments or examples represented in this application, as well as features of different embodiments or examples.
[0054] Furthermore, the terms "first" and "second" are used for illustrative purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the representation of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0055] For the purpose of clearly describing this application, devices that are not relevant to the description are omitted, and the same or similar components throughout the specification are given the same reference numerals.
[0056] Throughout this specification, when it is said that a device is "connected" to another device, this includes not only "direct connection" but also "indirect connection" by placing other components in between. Furthermore, when it is said that a device "comprises" a certain constituent element, unless otherwise stated otherwise, this does not exclude other constituent elements, but rather implies that other constituent elements may be included.
[0057] When we say that a device is "above" another device, this can mean that it is directly above the other device, or it can mean that other devices are present in between. Conversely, when we say that a device is "directly" "above" another device, there are no other devices present in between.
[0058] Although the terms first, second, etc., are used in some instances herein to refer to various elements, these elements should not be limited by these terms. These terms are used only to distinguish one element from another. For example, first interface and second interface, etc., are used. Furthermore, as used herein, the singular forms “a,” “an,” and “the” are intended to also include the plural forms unless the context indicates otherwise. It should be further understood that the terms “comprising,” “including,” indicate the presence of features, steps, operations, elements, components, items, kinds, and / or groups, but do not exclude the presence, occurrence, or addition of one or more other features, steps, operations, elements, components, items, kinds, and / or groups. The terms “or” and “and / or” as used herein are interpreted as inclusive, or mean any one or any combination thereof. Thus, “A, B, or C” or “A, B, and / or C” means “any one of: A; B; C; A and B; A and C; B and C; A, B, and C.” Exceptions to this definition will only occur if the combination of elements, functions, steps, or operations is inherently mutually exclusive in some way.
[0059] The technical terms used herein are for reference only to specific embodiments and are not intended to limit the scope of this application. The singular form used herein includes the plural form unless the statement explicitly indicates otherwise. The word "comprising" as used in the specification means to specify a particular characteristic, region, integer, step, operation, element, and / or component, and does not exclude the presence or addition of other characteristics, regions, integers, steps, operations, elements, and / or components.
[0060] Although not explicitly defined, all terms, including technical and scientific terms used herein, shall have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. Terms defined in commonly used dictionaries shall be further interpreted as having a meaning consistent with the relevant technical literature and the content of this present application, and shall not be over-interpreted as having an ideal or overly formulaic meaning unless otherwise defined.
[0061] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that the invention will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore repeated descriptions of them will be omitted.
[0062] like Figure 1 As shown, one embodiment of the present invention discloses a distributed cluster node management method. When deploying the distributed cluster, at least one master management node and multiple candidate management nodes are deployed. In this embodiment, as... Figure 2 As shown, the distributed cluster is deployed with one master management node 21, multiple candidate management nodes 22 and multiple worker nodes 23, but this application is not limited to this.
[0063] In this embodiment, the master management node 21 does not manage other nodes but acts as a temporary data relay node. It is responsible for collecting and distributing lightweight cluster-wide data, i.e., first-level metadata, and also has ID allocation functionality. The master management node 21 is initially the first member in the node list. The master management node 21 maintains the root table and the group table. The root table of the master management node 21 is loaded into the memory of other nodes after system startup, thus not generating more load compared to other nodes. Each cluster has only one master management node 21, which is maintained by the system itself, and its data is persisted to disk.
[0064] Candidate management node 22 is responsible for backing up the data in the primary management node 21 and also has an election function. That is, if the current primary management node 21 fails, a new primary management node will be elected from among the candidate management nodes 22. If candidate management node 22 crashes, causing its number to fall below the preset requirement, the system will elect a worker node 23 as the new candidate management node 22. Candidate management node 22 is maintained by the system itself, and its data is also persisted to disk. The root table and category table of worker node 23 are not persisted to disk while their data is persisted normally.
[0065] The following is an example: For instance, if metadata (such as looking up words in an English dictionary) is designed with a two-level address, then worker node 23 only stores the second-level metadata (such as the second letter of a word to the entire word), while the main management node 21 and candidate management node 22 store both the first-level metadata (such as the first letter of a word) and the aforementioned second-level metadata (such as the second letter of a word to the entire word).
[0066] In this embodiment, the master management node 21, the candidate management node 22, and the worker node 23 all need to execute tasks. Compared to a scheme that only uses worker nodes to execute tasks, this application can avoid performance bottlenecks, allowing the cluster performance to grow linearly; on the other hand, it can enhance the availability and reliability of the cluster.
[0067] The aforementioned primary management node 21 is the leader node. The candidate management node 22 is the selector node. The worker node 23 is the worker node. Figure 2 The number of candidate management nodes shown is N, and the number of worker nodes is M, but this application is not limited to this. Wherein, N and M are both positive integers.
[0068] In this embodiment, the management method includes the following steps:
[0069] S110: Obtain the operating status of the main management node and monitor its operation. During execution, a heartbeat mechanism can be used to determine if the main management node's heartbeat can be received normally. If it can be received normally, for example, if the heartbeat is received consistently within a fixed time interval, then the main management node is considered to be functioning correctly and not down. If the heartbeat cannot be received normally, for example, if the duration of receiving heartbeat packets exceeds a preset time threshold, then the heartbeat is considered lost, the main management node has malfunctioned, down, and its operating status is abnormal.
[0070] S120, in response to determining that the main management node has failed based on its operating status, each candidate management node initiates a proposal after a random delay, thus obtaining the proposal initiation time for each candidate management node. That is, when the main management node fails (i.e., crashes) based on its operating status, each candidate management node initiates a proposal after a random delay, resulting in different proposal initiation times for each candidate node. Then, an election is conducted based on the proposals initiated by all candidate management nodes to generate a new main management node. For example, the election can be conducted using the PAXOS algorithm, but this application is not limited to this.
[0071] In this embodiment, during the election process, each candidate management node triggers a proposal initiation action and submits a proposal. Before submitting a proposal, the proposal initiation time for each candidate management node is randomly delayed. Each candidate management node's proposal can be represented as [S, node], where S represents the proposal number and node represents the node ID. The node value in each candidate management node's own proposal is its own node ID, meaning each node can elect itself.
[0072] Since the proposal initiation times of each candidate management node are different, for any two candidate management nodes, the proposal number of the candidate management node with a later proposal initiation time is no greater than the proposal number of the candidate management node with an earlier proposal initiation time. In some embodiments, based on the result of the consensus protocol, the proposal initiation times of each candidate management node can be the same.
[0073] S130, based on the proposal initiation time, a target management node is determined from the candidate management nodes, and this target management node is designated as the new primary management node. Specifically, in some optional embodiments, the candidate management node with the earliest proposal initiation time can be selected as the target management node. This enables the rapid replacement of the current primary management node with a new one after the current primary management node fails, ensuring the availability and reliability of the distributed cluster service.
[0074] In some alternative embodiments, the candidate management node that initiates the proposal earliest and simultaneously meets preset rules can be determined as the target management node. The preset rules could be that the value corresponding to the proposal number of the target management node is greater than or equal to the value corresponding to the proposal numbers of the other candidate management nodes. This helps ensure the functional reliability of the newly elected master management node and improves election efficiency, thereby improving the availability and reliability of the distributed cluster service. Each proposal has an attribute value pair, which includes the proposal number; for example, [S, node] is the attribute value pair where S is the proposal number.
[0075] And S140, obtain the configuration information corresponding to the new master management node, and broadcast the configuration information to all nodes in the cluster. Specifically, after the new master management node is determined, its configuration information needs to be broadcast to all nodes in the cluster, and the new master management node sends heartbeats to the candidate management nodes.
[0076] In another embodiment of this application, a different method for managing distributed cluster nodes is disclosed. For example... Figure 3 As shown, this management method is in the above Figure 1 Based on the corresponding embodiment, between step S120 and step S130, the following step is further included:
[0077] S150, based on the above proposal initiation time, trigger the execution of proposal initiation behavior for each candidate management node, and receive the first proposal response corresponding to each proposal initiation behavior.
[0078] Step S130 is replaced with step S131:
[0079] Based on the above proposal initiation time and the above first proposal response, the target management node is determined from the above candidate management nodes and is set as the new master management node.
[0080] Specifically, in this embodiment, the type of the first proposal response is either a positive response or a negative response.
[0081] The above step S131 includes:
[0082] The candidate management node that initiated the above proposal earliest will be designated as the first initial management node.
[0083] Furthermore, when the number of first proposal responses of type positive received by the first initial management node accounts for a proportion of all the candidate management nodes greater than a first preset threshold, the first initial management node is determined as the target management node.
[0084] When a candidate management node initiates a proposal to other candidate management nodes, the other candidate management nodes need to respond to the proposal corresponding to the candidate management node, that is, whether to approve the proposal. When other candidate management nodes approve the proposal, the corresponding first proposal response type is a positive response. When other candidate management nodes disapprove the proposal, the corresponding first proposal response type is a negative response. In step S131 above, if for a first initial management node, the proportion of the number of positive responses it receives to the total number of responses is greater than a first preset threshold, and its corresponding proposal was initiated earliest, then the first initial management node is determined as the target management node. For example, the above first preset threshold can be 0.5, but this application is not limited to this.
[0085] This embodiment helps ensure the functional reliability of the newly elected master management node and improves election efficiency, thereby improving the availability and reliability of the distributed cluster service.
[0086] In another embodiment of this application, a different method for managing distributed cluster nodes is disclosed. For example... Figure 4 As shown, the method described above Figure 1 Based on the corresponding embodiment, step S130 includes:
[0087] S132, Based on the proposal initiation time mentioned above, determine the second initial management node from the candidate management nodes. For example, the second initial management node can be the candidate management node with the earliest proposal initiation time. If the initially determined second initial management node cannot meet the conditions of subsequent steps S133 to S137, then re-determine the remaining candidate management nodes with the earliest proposal initiation time as the new second initial management node, and iterate.
[0088] S133, in response to the second initial management node sending a proposal preparation request to other candidate management nodes, the second proposal responses made by the other candidate management nodes are tallied. The type of the second proposal response is either a positive response or a negative response. The aforementioned second proposal response is the response made to the aforementioned proposal preparation request.
[0089] S134, when the proportion of positive responses in the second proposal response to all candidate management nodes is greater than the second preset threshold, all candidate management nodes that make positive responses are determined as intermediate management nodes.
[0090] S135, the aforementioned second initial management node sends a proposal acceptance request to the intermediate management node.
[0091] S136, Obtain the third proposal response from the intermediate management node in response to the proposal acceptance request. The type of the third proposal response is either a positive response or a negative response.
[0092] S137, the candidate management node that initiated the proposal earliest and whose number of positive responses in the corresponding third proposal response is greater than the third preset threshold among all intermediate management nodes is identified as the target management node, and the target management node is designated as the new master management node.
[0093] Specifically, for example, a candidate management node proposes a proposal [S, node] and sends a proposal preparation request. Other candidate management nodes respond to the proposal preparation request and determine whether to approve it. The ratio of the number of positive responses to the proposal preparation request to the total number of responses is counted to see if it exceeds a second preset threshold. If it does not exceed this threshold, the candidate management node with the earliest proposal initiation time is selected from the remaining candidate management nodes and the proposal is resubmitted. If it exceeds this threshold, step S135 is executed: the candidate management node sends a proposal acceptance request to the other candidate management nodes that have given positive responses.
[0094] The system checks whether the ratio of positive responses to proposal acceptance requests to all responses is greater than a third preset threshold. If it is not greater, the node with the earliest proposal initiation time among the remaining candidate management nodes is selected and the proposal is reissued. If it is greater, the proposal [S,node] issued by the aforementioned candidate management node is approved, and the target management node is designated as the new master management node.
[0095] For example, the second and third preset thresholds mentioned above can be 0.5, but this application is not limited thereto.
[0096] In another embodiment of this application, a different method for managing distributed cluster nodes is disclosed. This method is described above... Figure 1 Based on the corresponding embodiments, such as Figure 5 As shown, the method further includes the following steps:
[0097] S160, in response to the number of candidate management nodes being less than the fourth preset threshold, a target working node is determined from the working nodes according to the preset strategy, and the target working node is used as a new candidate management node.
[0098] This embodiment can quickly elect a new candidate management node from all worker nodes when the number of candidate management nodes is below a threshold, thereby ensuring the availability of the service functions of the candidate management node and improving the availability and reliability of the distributed cluster service.
[0099] In some optional embodiments, the aforementioned preset strategy randomly selects a target worker node from worker nodes located at different sites and in different racks than all candidate management nodes. Different sites refer to different sites, and different racks refer to different racks. This ensures the availability of service functions for all candidate management nodes, thereby improving the availability and reliability of the distributed cluster service. For example, the aforementioned fourth preset threshold could be 7, but this application is not limited to this.
[0100] It should be noted that all the embodiments disclosed in this application can be freely combined, and the resulting technical solutions are also within the protection scope of this application. In this embodiment, the method step numbers do not represent the order of execution. There is no relationship between the step numbers and the order of execution.
[0101] like Figure 6 As shown, an embodiment of the present invention also discloses a distributed cluster node management system 6, which includes:
[0102] The first status monitoring module 61 obtains the running status of the main management node and monitors the running status of the main management node.
[0103] The proposal initiation time processing module 62, in response to determining that the main management node has failed based on the running status of the main management node, initiates proposals for each candidate management node after a random delay, thereby obtaining the proposal initiation time corresponding to each candidate management node.
[0104] The master management node election module 63, based on the proposal initiation time, determines the target management node from the candidate management nodes and designates the target management node as the new master management node.
[0105] The cluster broadcast module 64 obtains the configuration information corresponding to the new master management node and broadcasts the configuration information to all nodes in the cluster.
[0106] It is understood that the distributed cluster node management system of the present invention also includes other existing functional modules that support the operation of the distributed cluster node management system. Figure 6 The distributed cluster node management system shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0107] The distributed cluster node management system in this embodiment is used to implement the above-described distributed cluster node management method. Therefore, the specific implementation steps of the distributed cluster node management system can be referred to the above description of the distributed cluster node management method, and will not be repeated here.
[0108] An embodiment of the present invention also discloses a distributed cluster node management device, including a processor and a memory, wherein the memory stores an executable program of the processor; the processor is configured to execute the steps in the distributed cluster node management method by executing the executable program. Figure 7 This is a schematic diagram of the structure of the distributed cluster node management device disclosed in this invention. See below for reference. Figure 7 To describe an electronic device 600 according to this embodiment of the present invention. Figure 7 The electronic device 600 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0109] like Figure 7 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including storage unit 620 and processing unit 610), a display unit 640, etc.
[0110] The storage unit stores program code, which can be executed by the processing unit 610, causing the processing unit 610 to perform the steps described in the above-described distributed cluster node management method section of this specification, according to various exemplary embodiments of the present invention. For example, the processing unit 610 can perform, as follows: Figure 1 The steps are shown in the figure.
[0111] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.
[0112] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0113] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0114] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0115] The present invention also discloses a computer-readable storage medium for storing a program, which, when executed, implements the steps in the distributed cluster node management method described above. In some possible embodiments, various aspects of the present invention can also be implemented as a program product comprising program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the distributed cluster node management method of this specification according to various exemplary embodiments of the present invention.
[0116] As shown above, when the program on the computer-readable storage medium of this embodiment is executed, if a failure is detected in the current master management node, a new master management node is quickly elected from the current candidate management nodes to replace it according to a preset election strategy, and the configuration information is updated and broadcast to all nodes; this ensures the availability and seamlessness of the service, thereby improving the availability and reliability of the distributed cluster.
[0117] One embodiment of the present invention discloses a computer-readable storage medium. This storage medium is a program product implementing the above-described method, which may be a portable compact disc read-only memory (CD-ROM) and include program code, and can run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0118] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0119] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0120] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0121] The distributed cluster node management method, system, and device provided in this invention, when detecting a failure of the current master management node, quickly elects a new master management node from the current candidate management nodes according to a preset election strategy, updates configuration information, and broadcasts it to all nodes; thus ensuring service availability and seamless operation, and improving the availability and reliability of the distributed cluster.
[0122] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A distributed cluster node management method, characterized in that, The cluster includes a master management node and multiple candidate management nodes, and the method includes the following steps: Obtain the running status of the main management node and monitor its running status; In response to determining that the main management node has failed based on its operating status, a proposal is initiated for each of the candidate management nodes after a random delay, thus obtaining the proposal initiation time corresponding to each of the candidate management nodes; Based on the proposal initiation time, a target management node is determined from the candidate management nodes, and the target management node is designated as the new primary management node. Obtain the configuration information corresponding to the new master management node, and broadcast the configuration information to all nodes in the cluster.
2. The distributed cluster node management method as described in claim 1, characterized in that, The step of determining the target management node from the candidate management nodes based on the proposal initiation time includes: The candidate management node with the earliest proposal initiation time is determined as the target management node.
3. The distributed cluster node management method as described in claim 1, characterized in that, Before determining the target management node from the candidate management nodes based on the proposal initiation time, the method further includes: Based on the proposal initiation time, the proposal initiation behavior is triggered for each of the candidate management nodes, and a first proposal response corresponding to each proposal initiation behavior is received; The step of determining the target management node from the candidate management nodes based on the proposal initiation time includes: Based on the proposal initiation time and the first proposal response, the target management node is determined from the candidate management nodes.
4. The distributed cluster node management method as described in claim 3, characterized in that, The first proposal response is either a positive or a negative response; the step of determining the target management node from the candidate management nodes based on the proposal initiation time and the first proposal response includes: The candidate management node with the earliest proposal initiation time will be designated as the first initial management node. When the number of first proposal responses of type positive received by the first initial management node accounts for a proportion of all candidate management nodes greater than a first preset threshold, the first initial management node is determined as the target management node.
5. The distributed cluster node management method as described in claim 1, characterized in that, The step of determining the target management node from the candidate management nodes based on the proposal initiation time includes: Based on the proposal initiation time, a second initial management node is determined from the candidate management nodes; In response to the second initial management node sending a proposal preparation request to the other candidate management nodes, the second proposal responses made by the other candidate management nodes are counted; the type of the second proposal response is either a positive response or a negative response. When the proportion of positive responses in the second proposal response to all candidate management nodes is greater than the second preset threshold, all candidate management nodes that have made positive responses are determined as intermediate management nodes. The second initial management node sends a proposal reception request to the intermediate management node; Obtain the third proposal response from the intermediate management node in response to the proposal acceptance request; the type of the third proposal response is either a positive response or a negative response; The candidate management node that initiates the proposal earliest and whose number of positive responses in the corresponding third proposal response is greater than a third preset threshold among all intermediate management nodes is identified as the target management node.
6. The distributed cluster node management method as described in claim 1, characterized in that, Each proposal has an attribute value pair, the attribute value pair including the proposal number; determining the target management node from the candidate management nodes based on the proposal initiation time includes: The candidate management node that initiates the proposal earliest and simultaneously meets the preset rules is determined as the target management node; the preset rules are that the value corresponding to the proposal number of the target management node is greater than or equal to the value corresponding to the proposal number of the other candidate management nodes.
7. The distributed cluster node management method as described in claim 1, characterized in that, The cluster also includes multiple worker nodes; the management method further includes the following steps: In response to the number of candidate management nodes being less than a fourth preset threshold, a target working node is determined from the working nodes according to a preset strategy, and the target working node is used as a new candidate management node.
8. The distributed cluster node management method as described in claim 7, characterized in that, The preset strategy is to randomly select a target working node from among all working nodes located at different sites and in different racks from all candidate management nodes.
9. A distributed cluster node management system, used to implement the distributed cluster node management method as described in claim 1, characterized in that, The system includes: The first status monitoring module acquires the operating status of the main management node and monitors the operating status of the main management node. The proposal initiation time processing module, in response to determining that the main management node has failed based on the running status of the main management node, initiates proposals for each of the candidate management nodes after a random delay, thereby obtaining the proposal initiation time corresponding to each of the candidate management nodes; The master management node election module determines a target management node from the candidate management nodes based on the proposal initiation time, and designates the target management node as the new master management node; and The cluster broadcast module obtains the configuration information corresponding to the new master management node and broadcasts the configuration information to all nodes in the cluster.
10. A distributed cluster node management device, characterized in that, include: processor; A memory in which an executable program of the processor is stored; The processor is configured to perform the steps of the distributed cluster node management method according to any one of claims 1 to 8 by executing the executable program.
