A cluster management method, device, host device and readable storage medium
By setting up consistency nodes in the cluster and using the distributed consistency protocol to update the status, it solves the high availability problem in large-scale cluster management, achieves convenient and reliable management and high availability of the cluster, and improves the user experience.
Patent Information
- Application Number
- CN202210591045.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing cluster management system lacks high availability in large-scale clusters. When the control plane has a single point of failure, the management plane is unavailable, making it difficult to achieve convenient and reliable management and high availability, affecting user experience.
By setting up a consistency node in the cluster, the host node sends node status information to the consistency node, uses the distributed consistency protocol to update the cluster status, ensures that each host node understands the online situation, and improves fault tolerance by electing leader nodes and replacing abnormal nodes. .
It realizes convenient and reliable management of large-scale clusters, ensures high availability, improves user experience, can quickly adjust cluster members, and tolerate a certain number of node failures.
Smart Images

Figure CN114844799B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer clusters, and in particular to a cluster management method, device, host equipment and readable storage medium. Background Art
[0002] With the rapid development of cloud computing technology, computer clusters are becoming larger and larger, and their management is becoming more and more complex, with higher and higher requirements for their functions. Taking the Kubernetes (K8s, a container orchestration engine) system as an example, the control plane needs to understand the online status of each host in the cluster, such as understanding the offline host in the cluster, so as to transfer the services running on this host to other available hosts.
[0003] At present, the existing cluster management systems tend to be biased towards resource management and scheduling, and do not have high availability. For example, the Kubernetes cluster itself is a one-master-multiple-slave architecture, which is not natively highly available and biased towards resource management and scheduling. In addition, the online status of the hosts in the cluster depends on the heartbeat mechanism, and when the control plane has a single point of failure, the entire management plane is unavailable. Therefore, how to manage large-scale clusters conveniently and reliably, ensure high availability, and improve user experience is an urgent problem to be solved. Summary of the invention
[0004] The purpose of the present invention is to provide a cluster management method, apparatus, host device and readable storage medium to conveniently and reliably manage large-scale clusters, ensure high availability and improve user experience.
[0005] In order to solve the above technical problems, the present invention provides a cluster management method, comprising:
[0006] The current host node sends node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of the consistency nodes is less than the number of the host nodes;
[0007] Receiving cluster status information sent by the consistency node;
[0008] According to the cluster status information, the current cluster status of the cluster is acquired; wherein the current cluster status includes online host node information.
[0009] Optionally, the method further includes:
[0010] If the current host node is the consistency node, the consistency component of the node is used to communicate and interact with the consistency components in other consistency nodes to update the current cluster state of the cluster; wherein the consistency component of the node is the consistency component in the current host node, and the other consistency nodes are consistency nodes other than the current host node in the cluster;
[0011] Correspondingly, the current host node sends node status information to the consistency node in the cluster, including:
[0012] The current host node uses the local node proxy component to send the node status information to the consistency component; wherein the local node proxy component is the proxy component in the current host node;
[0013] Optionally, the method further includes:
[0014] If the current host node is the consistency node, the proxy component of the node is used to communicate and interact with the proxy components in other consistency nodes to update the current cluster state of the cluster; wherein the proxy component of the node is the proxy component in the current host node, the proxy component is provided with a distributed consistency protocol, and the other consistency nodes are consistency nodes other than the current host node in the cluster;
[0015] Correspondingly, the current host node sends node status information to the consistency node in the cluster, including:
[0016] The current host node uses the local node agent component to obtain the node status information; wherein the local node agent component is an agent component in the current host node.
[0017] Optionally, the node status information includes heartbeat information.
[0018] Optionally, the number of consistency nodes is an odd number greater than or equal to 3.
[0019] Optionally, the method further includes:
[0020] If the current host node is the consistency node, it communicates and interacts with other consistency nodes, selects a leader node from all the host nodes, and uses the leader node to manage the host nodes; wherein the other consistency nodes are consistency nodes other than the current host node in the cluster, and the leader node is any of the host nodes.
[0021] Optionally, the method further includes:
[0022] If the current host node is the leader node, when an abnormal node exists in the consistency nodes, a host node corresponding to the abnormal node is selected from the target node as the consistency node to replace the abnormal node.
[0023] The present invention also provides a cluster management device, which is applied to a host node in a cluster, comprising:
[0024] An information reporting module, used to send node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of the consistency nodes is less than the number of the host nodes;
[0025] A receiving module, used to receive cluster status information sent by the consistency node;
[0026] The acquisition module is used to acquire the current cluster state of the cluster according to the cluster state information; wherein the current cluster state includes online host node information.
[0027] The present invention also provides a host device, comprising:
[0028] Memory for storing computer programs;
[0029] A processor is used to implement the steps of the cluster management method as described above when executing the computer program.
[0030] In addition, the present invention further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the cluster management method as described above are implemented.
[0031] A cluster management method provided by the present invention includes: a current host node sends node status information to a consistency node in a cluster; wherein the current host node is any host node in the cluster, and the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of consistency nodes is less than the number of host nodes; receiving cluster status information sent by the consistency node; obtaining the current cluster status of the cluster according to the cluster status information; wherein the current cluster status includes online host node information.
[0032] It can be seen that the present invention sends node status information to the consistency node in the cluster through the current host node, and can use the consistency node in the cluster to update the online status of the host in the cluster, so that each host node can timely understand the online status of the host in the cluster; and through the setting of the consistency node in the cluster, it is possible to quickly and conveniently adjust the cluster members, realize convenient and reliable management of large-scale clusters, ensure high availability, and improve user experience. In addition, the present invention also provides a cluster management device, a host device and a readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0034] Figure 1 A flow chart of a cluster management method provided by an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of the structure of a cluster provided by an embodiment of the present invention;
[0036] Figure 3 A schematic diagram of the structure of an agent component provided by an embodiment of the present invention;
[0037] Figure 4 A structural block diagram of a cluster management device provided by an embodiment of the present invention;
[0038] Figure 5 A schematic diagram of the structure of a host device provided by an embodiment of the present invention;
[0039] Figure 6 A schematic diagram of a specific structure of a host device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] Please refer to Figure 1 , Figure 1A flow chart of a cluster management method provided by an embodiment of the present invention. The method may include:
[0042] Step 101: The current host node sends node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of consistency nodes is less than the number of host nodes.
[0043] It can be understood that the current host node in this embodiment can be any host node (i.e., host device) in the cluster (i.e., computer cluster); the consistency node in this embodiment can be a host node (e.g., Figure 2 The consistency component cluster in the cluster is used as the configuration center to provide cluster status information of the cluster corresponding to all host nodes, such as the online status of each host node.
[0044] Specifically, the node status information in this step may be information that the host node in the cluster needs to report to the consistency node. The specific content and reporting method of the node status information in this embodiment can be set by the designer according to practical scenarios and user needs. For example, the node status information can include heartbeat information, so that the consistency node can determine the online status of all host nodes in the cluster based on the heartbeat information sent by each host node; for example, the current host node can send heartbeat information to the consistency node at a preset time interval to regularly update the online status in the consistency node and maintain the node online. The node status information may also include host resource information, such as CPU (central processing unit) status information and memory status information, etc., to facilitate the management of host nodes in the cluster. As long as the current host node can report its own online status by sending node status information to the consistency node in the cluster, this embodiment does not impose any restrictions on this.
[0045] It should be noted that the specific method for the current host node in this step to send node status information to the consistency node in the cluster can be set by the designer, such as Figure 2 As shown, when the consistency nodes use their own consistency components based on the distributed consistency protocol to communicate and connect, the current host node can use the local node agent component to send node status information to the consistency component; wherein the local node agent component is the agent component (Agent) in the current host node; that is, each host node in the cluster can use its own corresponding agent component to report its own node status information to the agent component in its own corresponding consistency node, so that the consistency node can use the consistency component to update the current cluster status of the cluster; as shown Figure 3As shown, each host node can use the information reporting module in the consistency component to send node status information to the consistency component to maintain the node online; for example, when the current host node is any consistency node, in this step, the current host node can use the proxy component of this node to send node status information to the consistency component of this node; wherein, the consistency component of this node is the consistency component in the current host node. When the consistency nodes can also use their respective proxy components based on the distributed consistency protocol for communication connection, the current host node can use the proxy component in the consistency node corresponding to the proxy component of this node to send node status information, that is, the proxy component in the host node in the cluster can have a built-in distributed consistency protocol, so that the host node as a consistency node can directly use the proxy component for communication connection based on the distributed consistency protocol; for example, when the current host node is any consistency node, in this step, the current host node can directly use the proxy component of this node to obtain node status information; wherein, the proxy component of this node is the proxy component in the current host node.
[0046] Specifically, the specific type of the distributed consistency protocol adopted by the consistency nodes in this embodiment and the communication connection method between the consistency nodes can be set by the designer according to the practical scenario and user needs. For example, the distributed consistency protocol can adopt the Raft protocol (an easy-to-understand distributed consistency protocol), or other distributed consistency protocols such as ZAB (Zookeeper Atomic Broadcast, Zookeeper atomic broadcast protocol); Figure 2 As shown, the consistency nodes in this embodiment can communicate and connect using the channels between their respective consistency components based on the distributed consistency protocol, so as to use the consistency components for cluster management; for example, the consistency nodes can communicate and connect using the channels between Etcd components (a distributed consistency component) based on the Raft protocol, and the consistency nodes can also communicate and connect using the channels between Zookeeper components (a distributed consistency component) based on the ZAB protocol. This embodiment does not impose any restrictions on this.
[0047] Step 102: Receive cluster status information sent by the consistency node.
[0048] The cluster state information in this step may be information corresponding to the current cluster state sent by each consistency node to each host node, so that each host node can determine the current cluster state of the cluster using the cluster state information.
[0049] Specifically, the specific content of the cluster status information in this step can be set by the designer according to practical scenarios and user needs. For example, the cluster status information can include the information of online host nodes in the cluster (i.e., online host node information), so that each host node can understand all online hosts in the cluster based on the online host node information; the cluster status information can also include the information of changed host nodes in the cluster (i.e., changed host node information), such as newly added host node information and / or offline host node information. This embodiment does not impose any restrictions on this.
[0050] Correspondingly, in this embodiment, each consistency node in the cluster can communicate and interact with other consistency nodes to update the current cluster state of the entire cluster, thereby obtaining and sending corresponding cluster state information to the corresponding host nodes. That is to say, the method provided in this embodiment can also include communicating and interacting with other consistency nodes to update the current cluster state of the cluster when the current host node is any consistency node; wherein the other consistency nodes are consistency nodes other than the current host node in the cluster. That is to say, in this embodiment, the communication based on the distributed consistency protocol between consistency nodes can be used to record the node state information (such as online status and health status evaluation, etc.) of each host node in the cluster in real time. For example, if the current host node is a consistency node, the consistency component of this node is used to communicate and interact with the consistency components in other consistency nodes to update the current cluster state of the cluster; wherein the consistency component of this node is the consistency component in the current host node, and the other consistency nodes are consistency nodes other than the current host node in the cluster; accordingly, the current host node can also use the consistency component of this node to obtain and send cluster state information to the proxy component of the corresponding host node according to the current cluster state. If the current host node is a consistency node, the proxy component of this node is used to communicate and interact with the proxy components in other consistency nodes to update the current cluster status of the cluster; wherein, the proxy component of this node is the proxy component in the current host node, and a distributed consistency protocol is set in the proxy component, and other consistency nodes are consistency nodes other than the current host node in the cluster; accordingly, the current host node can also use the proxy component of this node to obtain and send cluster status information to the proxy component of the corresponding host node according to the current cluster status.
[0051] Step 103: According to the cluster status information, obtain the current cluster status of the cluster; wherein the current cluster status includes online host node information.
[0052] It can be understood that in this step, the current host node can use the received cluster status information to obtain the current cluster status of the cluster, so that each host node in the cluster can use the consistency node to understand the current status of each host node in the cluster (ie, the current cluster status).
[0053] Specifically, the specific content of the current cluster state of the cluster obtained by the current host node in this step can be set by the designer according to practical scenarios and user needs. For example, the current cluster state can include online host node information, that is, information about online host nodes in the cluster; the current cluster state can also include online host resource information, that is, resource information about online host nodes in the cluster, such as information about resources such as CPU and memory. This embodiment does not impose any restrictions on this.
[0054] Correspondingly, the method provided in this embodiment may also include the current host node acquiring and sending cluster information to the local cluster service according to the current cluster state; that is, in this embodiment, the current host node may send corresponding cluster information to the cluster-related service in the current host node (i.e., the local cluster service) according to the acquired current cluster state, so as to notify the local cluster service of the cluster changes. Figure 3 As shown, the current host node can utilize the notification management module in the proxy component to obtain and send cluster information to the local cluster service according to the current cluster status, such as online host node information, newly added host node information and / or offline host node information, to facilitate cluster expansion.
[0055] It should be noted that in order to improve the fault tolerance of the cluster, in this embodiment, each consistency node in the cluster can communicate and interact with other consistency nodes to select a host node from the host nodes in the cluster as a leader node (i.e., leader node), so that the host node can be responsible for cluster management (Cluster Management), that is, to manage each host node in the cluster.
[0056] Correspondingly, when the current host node is any consistency node, the current host node can communicate and interact with other consistency nodes, select a leader node from all host nodes, and use the leader node to manage the host node; wherein other consistency nodes are consistency nodes other than the current host node in the cluster, and the leader node is any host node. For example, when the leader node in the cluster is offline, the current host node can communicate and interact with other consistency nodes, select a leader node from all online host nodes in the cluster, or select a leader node from all online host nodes other than the consistency nodes in the cluster, and this embodiment does not impose any restrictions on this.
[0057] Specifically, the specific method for selecting a leader node from all host nodes for the current host node to communicate and interact with other consistency nodes can be set by the designer. For example, it can be implemented in the same or similar manner as the leader node selection method in the consistency protocol algorithm in the prior art. For example, the current host node can communicate and interact with other consistency nodes, and a leader node can be selected from all host nodes through a voting mechanism. This embodiment does not impose any restrictions on this.
[0058] It is understandable that the specific number of consistency nodes in the cluster in this embodiment can be set by the designer according to practical scenarios and user needs. For example, the number of consistency nodes in the cluster in this embodiment can be greater than or equal to 3, so as to tolerate the failure of at least one consistency node and improve the fault tolerance of the cluster; for example, in order to reduce resource waste, the number of consistency nodes in the cluster in this embodiment can be an odd number greater than or equal to 3, such as 3, 5 or 7; wherein, when the number of consistency nodes is 3, 5 or 7, 1, 2 and 3 consistency node failures can be tolerated respectively; the number of consistency nodes in the cluster in this embodiment can also be an even number greater than or equal to 4, such as 4, 6 or 8; wherein, when the number of consistency nodes is 4, 6 or 8, 1, 2 and 3 consistency node failures can be tolerated respectively. As long as the number of consistency nodes is less than the number of all host nodes in the cluster, this embodiment does not impose any restrictions on this.
[0059] Specifically, the leader node in this embodiment can also be used to manage the consistency nodes in the cluster. For example, the leader node can be responsible for the management of the consistency components in the consistency nodes; Figure 3 As shown, the election module in the proxy component can be used to elect a leader node based on the consistency component, which is responsible for the management of the consistency component and the management of the host nodes in the cluster.
[0060] Correspondingly, in this embodiment, when there is an abnormal node in the consistency node (such as a node offline), the leader node in the cluster can select the host node corresponding to the abnormal node from the target node as the consistency node to replace the abnormal node, thereby improving the fault tolerance of the cluster; that is, in this embodiment, if the current host node is the leader node, then when there is an abnormal node in the consistency node, the current host node can select the host node corresponding to the abnormal node from the target node as the consistency node to replace the abnormal node. Figure 3 As shown, the leader node is elected based on the consistency component. The consistency component management module in the proxy component is responsible for the health management of the consistency component. When a consistency node has an abnormality (such as node offline and consistency component abnormality), other host nodes are selected to replace the abnormal consistency node.
[0061] Furthermore, in this embodiment, the leader node or each host node in the cluster can select the optimal node corresponding to the cluster service from all host nodes according to the demand of the cluster service and the online host resource information, so as to use the optimal node to process the cluster service. For example, if the current host node is the leader node, the optimal node corresponding to the cluster service to be allocated is selected from all host nodes according to the online host resource information and the demand information of the cluster service to be allocated, and the optimal nodes are controlled to process the optimal nodes corresponding to each other.
[0062] In this embodiment, the embodiment of the present invention sends node status information to the consistency node in the cluster through the current host node, and can use the consistency node in the cluster to update the online status of the host in the cluster, so that each host node can timely understand the online status of the host in the cluster; and through the setting of the consistency node in the cluster, the cluster members can be adjusted quickly and conveniently, and convenient and reliable management of large-scale clusters can be achieved, ensuring high availability and improving user experience.
[0063] Corresponding to the above method embodiment, the embodiment of the present invention further provides a cluster management device. The cluster management device described below and the cluster management method described above can be referred to each other.
[0064] Please refer to Figure 4 , Figure 4 This is a structural block diagram of a cluster management device provided by an embodiment of the present invention. The data writing device is applied to the current host node and may include:
[0065] An information reporting module 10 is used to send node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of consistency nodes is less than the number of host nodes;
[0066] Receiving module 20, used to receive cluster status information sent by the consistency node;
[0067] The acquisition module 30 is used to acquire the current cluster state of the cluster according to the cluster state information; wherein the current cluster state includes online host node information.
[0068] Optionally, the device may further include:
[0069] An update module, which is used to communicate and interact with consistency components in other consistency nodes using the consistency component of this node to update the current cluster state of the cluster if the current host node is a consistency node; wherein the consistency component of this node is the consistency component in the current host node, and other consistency nodes are consistency nodes other than the current host node in the cluster;
[0070] Correspondingly, the information reporting module 10 can be specifically used to send node status information to the consistency component by using the node proxy component; wherein the node proxy component is the proxy component in the current host node;
[0071] Optionally, the device may further include:
[0072] The proxy update module is used to communicate and interact with the proxy components in other consistency nodes by using the proxy component of this node if the current host node is a consistency node, so as to update the current cluster state of the cluster; wherein the proxy component of this node is the proxy component in the current host node, the proxy component is provided with a distributed consistency protocol, and the other consistency nodes are consistency nodes other than the current host node in the cluster;
[0073] Correspondingly, the information reporting module 10 can be specifically used to obtain node status information by using the local node agent component; wherein the local node agent component is the agent component in the current host node.
[0074] Optionally, the node status information includes heartbeat information.
[0075] Optionally, the number of consistency nodes is an odd number greater than or equal to 3.
[0076] Optionally, the device may further include:
[0077] The leader selection module is used to communicate and interact with other consistency nodes if the current host node is a consistency node, and select a leader node from all host nodes to manage the host nodes using the leader node; among which, other consistency nodes are consistency nodes other than the current host node in the cluster, and the leader node is any host node.
[0078] Optionally, the device may further include:
[0079] The consistency management module is used to select the host node corresponding to the abnormal node from the target node as the consistency node to replace the abnormal node if the current host node is the leader node and there is an abnormal node in the consistency node.
[0080] In this embodiment, the embodiment of the present invention sends node status information to the consistency node in the cluster through the information reporting module 10, and the consistency node in the cluster can be used to update the online status of the host in the cluster, so that each host node can timely understand the online status of the host in the cluster; and through the setting of the consistency node in the cluster, the cluster members can be adjusted quickly and conveniently, and convenient and reliable management of large-scale clusters can be achieved, ensuring high availability and improving user experience.
[0081] Corresponding to the above method embodiment, the embodiment of the present invention further provides a host device. The host device described below and the cluster management method described above can refer to each other.
[0082] Please refer to Figure 5 , Figure 5 A schematic diagram of the structure of a host device provided by an embodiment of the present invention. The host device may include:
[0083] A memory D1, for storing computer programs;
[0084] The processor D2 is used to implement the steps of the cluster management method provided by the above method embodiment when executing a computer program.
[0085] For details, please refer to Figure 6 , Figure 6 A schematic diagram of the specific structure of a host device provided in an embodiment of the present invention. The host device 310 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the host device 310.
[0086] The host device 310 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341. For example, Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0087] The host device 310 may specifically be a computer device in a cluster.
[0088] The steps in the cluster management method described above may be implemented by the structure of the host device.
[0089] Corresponding to the above method embodiment, the embodiment of the present invention further provides a readable storage medium. The readable storage medium described below and the cluster management method described above can refer to each other.
[0090] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the cluster management method provided by the above method embodiment are implemented.
[0091] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0092] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device, host device and readable storage medium disclosed in the embodiment, since they correspond to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0093] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0094] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0095] The above is a detailed introduction to a cluster management method, device, host device and readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A cluster management method, characterized in that: include: The current host node sends node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of the consistency nodes is less than the number of the host nodes; each consistency node in the cluster can communicate and interact with other consistency nodes to update the current cluster status of the entire cluster, thereby obtaining and sending corresponding cluster status information to each corresponding host node; Receiving cluster status information sent by the consistency node; According to the cluster status information, the current cluster status of the cluster is obtained; wherein the current cluster status includes online host node information, so that each host node can understand all online hosts in the cluster according to the online host node information.
2. The cluster management method according to claim 1, characterized in that: Also includes: If the current host node is the consistency node, the consistency component of the node is used to communicate and interact with the consistency components in other consistency nodes to update the current cluster state of the cluster; wherein the consistency component of the node is the consistency component in the current host node, and the other consistency nodes are consistency nodes other than the current host node in the cluster; Correspondingly, the current host node sends node status information to the consistency node in the cluster, including: The current host node uses the local node agent component to send the node status information to the consistency component; wherein the local node agent component is the agent component in the current host node.
3. The cluster management method according to claim 1, characterized in that: Also includes: If the current host node is the consistency node, the proxy component of the node is used to communicate and interact with the proxy components in other consistency nodes to update the current cluster state of the cluster; wherein the proxy component of the node is the proxy component in the current host node, the proxy component is provided with a distributed consistency protocol, and the other consistency nodes are consistency nodes other than the current host node in the cluster; Correspondingly, the current host node sends node status information to the consistency node in the cluster, including: The current host node uses the local node agent component to obtain the node status information; wherein the local node agent component is an agent component in the current host node.
4. The cluster management method according to claim 1, characterized in that: The node status information includes heartbeat information.
5. The cluster management method according to claim 1, characterized in that: The number of the consistency nodes is an odd number greater than or equal to 3.
6. The cluster management method according to any one of claims 1 to 5, characterized in that: Also includes: If the current host node is the consistency node, it communicates and interacts with other consistency nodes, selects a leader node from all the host nodes, and uses the leader node to manage the host nodes; wherein the other consistency nodes are consistency nodes other than the current host node in the cluster, and the leader node is any of the host nodes.
7. The cluster management method according to claim 6, characterized in that: Also includes: If the current host node is the leader node, when an abnormal node exists in the consistency nodes, a host node corresponding to the abnormal node is selected from the target node as the consistency node to replace the abnormal node.
8. A cluster management device, characterized in that: Applied to the current host node, including: An information reporting module is used to send node status information to the consistency nodes in the cluster; wherein the current host node is any host node in the cluster, the consistency node is a host node in the cluster connected based on a distributed consistency protocol communication, and the number of the consistency nodes is less than the number of the host nodes; each consistency node in the cluster can communicate and interact with other consistency nodes to update the current cluster status of the entire cluster, thereby obtaining and sending corresponding cluster status information to the corresponding host nodes; A receiving module, used to receive cluster status information sent by the consistency node; The acquisition module is used to acquire the current cluster state of the cluster according to the cluster state information; wherein the current cluster state includes online host node information, so that each host node can understand all online hosts in the cluster according to the online host node information.
9. A host device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the cluster management method according to any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the cluster management method according to any one of claims 1 to 7 are implemented.
