Server cluster asset management method, server and client
By receiving the heartbeat information of the client node, the node tree is solved, and the server cluster is efficient, automated management and resource monitoring are realized.
Patent Information
- Application Number
- CN202411917761.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
As the number of servers increases, it is difficult for administrators to effectively manage and monitor complex network environments, resulting in inefficient bandwidth usage, waste of resources, difficulty in location of faults, increased security vulnerabilities and uneven resource allocation.
By receiving the heartbeat information of the client node, a node tree is built, and the server cluster is managed based on the node tree, including task allocation, resource monitoring, fault detection and automatic alarms.
It realizes efficient, automated management and resource monitoring of server clusters, and solves the problems of increased management difficulties and uneven resource allocation caused by the affiliation between complex network environments and servers.
Smart Images

Figure CN119814651A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of server clusters, and in particular to a server cluster asset management method, a server end, and a client end. Background Art
[0002] As the business continues to grow, more computing resources are needed to support the increasing number of users and data processing needs; due to the diversity of services, each service may require an independent server or server cluster to ensure performance and security; as the number of servers continues to increase and the company attaches great importance to network security, the difficulty and complexity of administrators managing and monitoring servers has also increased exponentially. Management problems also arise:
[0003] 1. Due to the complexity of the actual network environment between servers, administrators cannot intuitively understand the relationship between them. Improper management may lead to inefficient bandwidth use and unnecessary waste of resources. When a network failure occurs, the complex network structure makes fault location and diagnosis more difficult; the inconvenience of unified management also increases the possibility of human error, which may lead to service interruption or performance degradation. There may also be unnoticed security vulnerabilities, increasing the risk of being attacked; complex networks may also lead to uneven resource allocation. Some servers or services may not have enough resources, while others may have excess resources, and it is impossible to ensure that all servers are running in the best state. In this case, conventional manual monitoring and management are particularly difficult and require a lot of manpower costs, but the effectiveness of management cannot be guaranteed.
[0004] 2. During the operation and maintenance process, there is often a need to customize some of the servers. Faced with a large number of servers under their jurisdiction, administrators are unable to quickly locate them, nor can they uniformly batch issue command tasks and uniformly collect command execution results, which increases the difficulty of unified management.
[0005] 3. For problems that have occurred or may occur during the operation of individual servers, administrators cannot be notified in a timely manner and cannot respond and take countermeasures quickly, which increases the operating risks of the server.
[0006] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0007] The embodiments of the present invention provide a server cluster asset management method, a server and a client, so as to at least solve the technical problem of management difficulties caused by the increase in the number of servers.
[0008] According to one aspect of an embodiment of the present invention, a server cluster asset management method is provided, comprising: receiving heartbeat information of a client node, wherein the heartbeat information is used to characterize the status of the client node; constructing a node tree based on the heartbeat information; and managing the server cluster according to the node tree.
[0009] Optionally, managing the server cluster includes: creating tasks according to task types, wherein tasks include: ordinary tasks and scheduled tasks; selecting a target node in a node tree, and assigning the task to the target node, wherein the target node is used to represent a client node; and the target node processes the task.
[0010] Optionally, the server cluster is managed according to the node tree, including: receiving heartbeat information corresponding to the target node reported by the client node; in response to the heartbeat information corresponding to the target node meeting an abnormal condition, generating an alarm instruction, the alarm instruction being used to issue an alarm to the target device.
[0011] Optionally, a target node is selected in the node tree and a task is assigned to the target node, including: determining whether the target node is an illegal node, wherein an illegal node is used to represent a node that does not exist in the node tree; in response to the target node not being an illegal node, determining whether the target node has the same task, wherein the same task is used to represent that the same task is executed multiple times; in response to the target node not having the same task, assembling the target node information corresponding to the target node and the task information corresponding to the task, and notifying the child nodes below the target node to pull the task.
[0012] Optionally, based on the heartbeat information, a node tree is constructed, including: in response to the first node corresponding to the heartbeat information being a new node, determining the parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree; and adding the first node to the node tree according to the parent node information of the parent node.
[0013] Optionally, based on the heartbeat information, a node tree is constructed, including: in response to the first node corresponding to the heartbeat information being a non-new node, determining whether the parent node corresponding to the first node has changed; in response to the parent node changing, adjusting the position of the node and updating the operation time; or, in response to the parent node not changing, updating the last operation time of the node tree.
[0014] According to another aspect of an embodiment of the present invention, a server cluster asset management method is also provided, including: obtaining parent node information from a server; sending heartbeat information of a client node to the server based on the parent node information, wherein the heartbeat information is used to characterize the status of the client node; pulling tasks from the server based on the parent node information; and in response to pulling the tasks, executing the tasks and obtaining execution results.
[0015] Optionally, in response to pulling the task, executing the task and obtaining the execution result, including: in response to obtaining the task, performing target verification on the task, wherein the target verification includes at least: whether it is repeated verification, whether it has been tampered with verification, and whether there is a sub-node task verification; in response to the task being repeated or tampered with, ending the task; or, in response to the task having a sub-node task, asynchronously notifying the sub-node of the corresponding sub-node task to pull the task.
[0016] Optionally, the method further includes: reporting the execution result to the server; in response to the execution result being a failure state, re-putting the task into a task queue, wherein the task queue is used to indicate that the tasks are executed in this order.
[0017] Optionally, it also includes: obtaining the storage time of the task, the storage time is used to represent the pending time in the task queue; judging whether the storage time of the task exceeds the preset configuration time; in response to the storage time exceeding the configuration time, deleting the task.
[0018] According to another aspect of an embodiment of the present invention, a server is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing the following program instructions: receiving heartbeat information of a client node, wherein the heartbeat information is used to characterize the status of the client node; constructing a node tree based on the heartbeat information; and managing a server cluster according to the node tree.
[0019] According to another aspect of an embodiment of the present invention, a client is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing the following program instructions: obtaining parent node information from a server; sending heartbeat information of the client node to the server based on the parent node information, wherein the heartbeat information is used to characterize the status of the client node; pulling tasks from the server based on the parent node information; and executing the tasks in response to pulling the tasks to obtain execution results.
[0020] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided. The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method of the above embodiment by running the computer program.
[0021] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method of the above embodiment is implemented.
[0022] In an embodiment of the present invention, the heartbeat information of the client node is received, wherein the heartbeat information is used to characterize the state of the client node; based on the heartbeat information, a node tree is constructed; and the server cluster is managed according to the node tree. The present invention achieves the purpose of automatic cluster management based on the node tree by receiving and analyzing the heartbeat information sent by the client node in real time, thereby achieving the technical effect of efficient and automatic management and resource monitoring of the server cluster, and further solving the technical problems of increased management difficulty and uneven resource allocation caused by complex network environment and subordinate relationships between servers. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 is a flow chart of a first server cluster asset management method according to one embodiment of the present invention;
[0025] Figure 2 is a flow chart of a second server cluster asset management method according to one embodiment of the present invention;
[0026] Figure 3 is a structural diagram of a server cluster asset management device according to one embodiment of the present invention;
[0027] Figure 4 is a flow chart of a server cluster asset management method according to one embodiment of the present invention;
[0028] Figure 5 is a flowchart of node tree construction according to one embodiment of the present invention;
[0029] Figure 6 is a flowchart of creating a task according to one embodiment of the present invention;
[0030] Figure 7 is a flow chart of a publishing task according to one embodiment of the present invention;
[0031] Figure 8 is a flowchart of a reporting task processing according to one embodiment of the present invention;
[0032] Fig. 9 This is an automatic alarm flow chart according to one embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 only 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 should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] According to an embodiment of the present invention, an embodiment of a data encryption transmission method is provided, and the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0036] The method embodiment may also be performed in an electronic device, a similar control device or an electronic device including a memory and a processor. Taking an electronic device as an example, the electronic device may include one or more processors and a memory for storing data. Optionally, the electronic device may also include a communication device and a display device for communication functions. It will be understood by those skilled in the art that the above structural description is only illustrative and does not limit the structure of the above electronic device. For example, the electronic device may also include more or fewer components than the above structural description, or have a configuration different from the above structural description.
[0037] The processor may include one or more processing units. For example, the processor may include a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field-programmable gate array (FPGA), a neural-network processing unit (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, and the like. Among them, different processing units may be independent components or integrated into one or more processors. In some instances, the electronic device may also include one or more processors.
[0038] The memory can be used to store computer programs, such as storing the computer program corresponding to the server cluster asset management method in the embodiment of the present invention. The processor implements the above-mentioned data encryption transmission method by running the computer program stored in the memory. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the electronic device via a grid. Examples of the above-mentioned grid include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0039] Figure 1 FIG. 1 is a flow chart of a first server cluster asset management method according to one embodiment of the present invention. Figure 1 As shown, the method may include the following steps:
[0040] Step S101: receiving heartbeat information of a client node, wherein the heartbeat information is used to represent the state of the client node.
[0041] In step S101, the heartbeat information is a signal that a node in a server cluster periodically sends to a management center (server end) to report information such as the operation status, resource usage, and health status of the current node.
[0042] The client node mentioned above does not simply represent one node, but multiple nodes with a hierarchical relationship. For example, the parent node of node A is AA, and the parent node of node AA is AAA. Here, A is the child node of AA, and AA is the child node of AAA.
[0043] Step S102: construct a node tree based on the heartbeat information.
[0044] In step S102, the nodes report heartbeat information to the parent node in turn, and finally reach the server for aggregation and analysis. The server returns the analysis results to the front end to form a visual tree structure diagram to show the online / offline status of each node.
[0045] The node tree is a data structure used to intuitively represent the relationship between nodes in a server cluster. Based on the received heartbeat information, a node tree reflecting the current cluster status can be constructed, including node levels, connection relationships, resource allocation and other information.
[0046] It should be noted that when building a node tree, it is necessary to analyze the metadata such as node ID, parent node ID, node type, node status, etc. contained in the heartbeat information. This information can help determine the position of the node in the tree. The node tree can be implemented using a variety of data structures, such as linked lists, arrays, hash tables combined with tree structures, etc. During the construction process, the node status needs to be updated in real time to reflect the dynamic changes of the cluster.
[0047] Step S103: managing the server cluster according to the node tree.
[0048] In step S103, the above-mentioned management of the server cluster at least includes: task publishing, resource allocation, performance monitoring, fault detection and automatic alarm. The server can identify which nodes have resource bottlenecks, which nodes may be offline, or which nodes have abnormal behavior through the node tree. This step enables the server to make intelligent decisions, such as reallocating tasks to nodes with sufficient resources, starting fault recovery mechanisms, or notifying administrators to deal with potential security threats. Through the node tree, the server can also visually manage the communication between nodes to ensure accurate information transmission and efficient execution of tasks.
[0049] Through the above steps, by real-time receiving and analyzing the heartbeat information sent by the client node, a node tree reflecting the cluster structure and status is constructed, thereby achieving the purpose of automatic management of the cluster based on the node tree, thereby realizing the technical effect of efficient and automatic management and resource monitoring of the server cluster, and further solving the technical problems of increased management difficulty and uneven resource allocation caused by complex network environment and subordinate relationships between servers.
[0050] Optionally, manage the server cluster, including:
[0051] Step S1031, creating a task according to the task type, wherein the task includes: a common task and a scheduled task;
[0052] In step S1031, it should be noted that the above-mentioned ordinary tasks are usually for immediate operations or one-time needs, such as software deployment, configuration updates, resource checks, etc. When creating an ordinary task, the server will define the detailed instructions and expected results of the task, as well as the conditions or triggering mechanisms for executing the task. The above-mentioned scheduled tasks are different from ordinary tasks. Scheduled tasks are periodic and are used for regularly executed monitoring, data collection, and maintenance operations. When creating a scheduled task, the server needs to specify parameters such as the execution frequency, start and end time of the task to ensure that the task can be automatically executed according to the preset schedule.
[0053] Step S1032 , selecting a target node in the node tree, and assigning the task to the target node, wherein the target node is used to represent the client node.
[0054] In step S1032, based on the hierarchical structure of the node tree, a node on a specific level or a specific path is determined as a target node. The above-mentioned target node can be understood as a specific server or a specific terminal device.
[0055] It should be noted that tasks can also be selected in batches, and the selected tasks can be assigned to target nodes, and the target nodes can then process the tasks.
[0056] Step S1033: the target node processes the task.
[0057] In step S1033, the target node's task processing process includes: Task reception and verification: After receiving the task instruction, the target node will first perform task verification to check the validity of the task (whether it has been tampered with), the repeatability of the task (especially the scheduled task), and whether it has the authority and conditions to execute the task. Task execution: After the verification is passed, the target node executes the task instruction and performs corresponding operations according to the task type, such as running monitoring scripts, updating configuration files, and performing data collection. Result reporting: After the task is executed, the target node will encrypt and compress the task results and report them to the server step by step according to the node hierarchy structure. After receiving the results, the server will decrypt, analyze and store them for subsequent management and decision-making.
[0058] Through the above steps, the server can create different types of automated tasks according to demand, which not only reduces the frequency of manual operations, but also improves the flexibility and response speed of task execution. By selecting the best target node to execute tasks, the server can optimize resource allocation, avoid resource waste, and ensure that each node operates efficiently within its capabilities.
[0059] Optionally, the server cluster is managed according to the node tree, including:
[0060] Step S1034, receiving the heartbeat information corresponding to the target node reported by the client node.
[0061] In step S1034, the client nodes are servers in the cluster, and the heartbeat information includes important indicators of the client node operation, such as CPU usage, memory usage, disk space, network connection status, service operation status, etc. The server receives and parses the heartbeat information in step S1034 to monitor the health status and resource usage of the target node in real time.
[0062] Step S1035, in response to the heartbeat information corresponding to the target node meeting the abnormal condition, an alarm instruction is generated, and the alarm instruction is used to issue an alarm to the target device.
[0063] In step S1035, the above-mentioned abnormal conditions may be: resource utilization exceeds a threshold, such as CPU utilization reaches more than 90%; network connection is unstable, such as network delay or packet loss rate exceeds the normal range; service status is abnormal, such as key services are not running or frequently restarted; hardware failure, such as disk read and write errors or memory errors; security events, such as detection of malware activity or abnormal login attempts.
[0064] The above alarm instructions can be issued in various forms, including but not limited to: sending email or SMS notifications; displaying alarm information on the management console; starting automatic recovery or fault isolation procedures; sending alarms to other systems or services so that joint measures can be taken. This mechanism ensures that abnormal situations can be discovered and responded to in a timely manner, reducing fault recovery time and avoiding business interruption and data loss.
[0065] Through the above steps, the server can continuously monitor the heartbeat information and detect anomalies in time, so as to take measures before the problem expands, avoiding potential system crashes or security threats. Once an anomaly is detected, the server immediately generates an alarm instruction and quickly notifies relevant personnel in a variety of ways, shortening the time for problem response and processing.
[0066] Optionally, select a target node in the node tree and assign a task to the target node, including:
[0067] Step S10321, determining whether the target node is an illegal node, wherein an illegal node is used to represent a node that does not exist in the node tree;
[0068] In step S10321, the illegal nodes are used to represent nodes that do not exist in the node tree, that is, nodes that are not registered or offline in the node tree, which may be caused by network failure, hardware failure or management error. By determining whether the target node is an illegal node, it is possible to avoid sending tasks to nodes that do not exist or cannot communicate, thereby saving system resources, preventing invalid network connection attempts and task execution instruction sending, and ensuring the efficiency and stability of cluster management.
[0069] Step S10322, in response to the target node not being an illegal node, determining whether the target node has an identical task, wherein the identical task is used to indicate that the same task is executed multiple times;
[0070] In step S10322, the above-mentioned identical tasks refer to those tasks with the same task name, instructions and parameters. If these tasks are executed repeatedly, it may not only cause a waste of resources, but also interfere with the normal operation of the node. For example, executing resource-intensive tasks multiple times in a short period of time may cause node overload. By determining whether there are identical tasks, the server can avoid repeating the same tasks and ensure that each task is executed only once, thereby optimizing resource allocation and avoiding unnecessary system pressure.
[0071] Step S10323, in response to the target node not having the same task, assemble the target node information corresponding to the target node and the task information corresponding to the task, and notify the child nodes under the target node to pull the task.
[0072] In step S10323, the target node information includes at least: node ID, IP address, status information, and the task information includes at least: task ID, task instruction, execution frequency, start time and end time. The task information is notified to the target node and its lower-level child nodes through the hierarchical relationship defined in the node tree. This notification mechanism allows child nodes to actively pull tasks from the server instead of passively receiving them, which improves the flexibility and efficiency of task allocation. Through this step, all relevant child nodes can receive new tasks in a timely manner and execute tasks according to the instructions of the server, ensuring the automation and consistency of cluster management. At the same time, since the child nodes actively pull tasks, the network load of the server can also be reduced, and the overall response speed of the system can be improved.
[0073] Through the above steps, by verifying the legitimacy of the target node, the server can accurately assign the task to the correct node, avoiding the task being assigned to an illegal node or a non-existent node, and ensuring the effectiveness of task execution.
[0074] Optionally, based on the heartbeat information, a node tree is constructed, including:
[0075] Step 1021, in response to the first node corresponding to the heartbeat information being a new node, determining a parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree;
[0076] In step S1021, the parent node is the direct superior node of the new node in the cluster architecture. Usually, the new node will send heartbeat information to its parent node when starting or joining the cluster, and the parent node will then send the information to the server.
[0077] Step 1022: Add the first node to the node tree according to the parent node information of the parent node.
[0078] In step S1022, when the parent node of the new node is determined, the server will use the hierarchical information of the parent node to correctly add the new node to the corresponding position in the node tree. The node tree is a tree-shaped data structure in which each non-root node has a parent node, and each parent node can have multiple child nodes. By adding the new node to the node tree, the server can build a complete network topology. The node tree provides the server with a network topology view of all nodes in the cluster, which can clearly show the hierarchical relationship and subordinate structure between the nodes.
[0079] Through the above steps, this asset management method can dynamically identify and integrate newly added nodes, build and maintain a complete and accurate node tree, which not only helps the server to monitor the cluster status in real time, but also can intelligently distribute tasks and manage resources, thereby improving the overall management efficiency of the server cluster and ensuring the rational use of resources and the stability of cluster operation.
[0080] Optionally, based on the heartbeat information, a node tree is constructed, including:
[0081] Step 1023, in response to the first node corresponding to the heartbeat information being not a new node, determining whether the parent node corresponding to the first node has changed;
[0082] In step S1023, when the first node is a known node (ie, not a new node), the server compares the parent node identifier in the heartbeat information with the parent node information of the node stored in the node tree to determine whether the parent node of the first node has changed.
[0083] It should be noted that the change of the parent node may be caused by a variety of factors, such as network reconfiguration, node migration, fault recovery, or deployment of new services. When the parent node changes, it means that the position or management link of the first node in the network topology has also changed, which requires the server to update the node tree structure in time to reflect the latest network status and management relationship.
[0084] Step 1024, in response to the parent node changing, adjusting the position of the node and updating the operation time; or, in response to the parent node not changing, updating the last operation time of the node tree.
[0085] In step S1024, when it is detected that the parent node of the first node has indeed changed, the server will adjust the position of the first node in the node tree to ensure that its position in the network hierarchy accurately reflects the current parent node relationship. At the same time, the relevant operation time of the first node, such as the heartbeat reporting time, the node status change time, etc., is updated to maintain the real-time and validity of the node tree.
[0086] When the parent node information in the heartbeat information is consistent with the information recorded in the node tree, that is, the parent node has not changed, the server only updates the last operation time of the node tree to indicate that the server has received and processed the latest heartbeat information, ensuring the real-time nature of the node status.
[0087] Through the above steps, the server can adjust the node tree structure in time according to the changes of the parent node in the heartbeat information to ensure the real-time and accuracy of the network topology. The dynamically updated node tree structure enables the server to intelligently allocate tasks and schedule resources based on the latest network relationships, avoiding task execution errors or uneven resource allocation due to changes in node relationships.
[0088] Figure 2 FIG. 1 is a flow chart of a second server cluster asset management method according to one embodiment of the present invention. Figure 2 As shown, the method may include the following steps:
[0089] Step S201, obtaining parent node information from the server;
[0090] In step S201, the above-mentioned parent node information includes at least: IP address, port number, and authentication information. The process of obtaining the parent node information ensures that the client can be correctly integrated into the cluster management framework and knows which node to send heartbeat information and task requests to, thereby avoiding network confusion or data loss.
[0091] Step S202: sending the heartbeat information of the client node to the server according to the parent node information, wherein the heartbeat information is used to represent the state of the client node.
[0092] In step S202, the above-mentioned heartbeat information is a status report sent periodically by the client node to the parent node (usually ultimately to the server), which is used to characterize the real-time operating status of the client node, such as CPU usage, memory usage, network connectivity, service operating status, etc. By sending heartbeat information to the parent node, the client can continuously inform it of its health status, so that the server can monitor the operating status of all nodes in the cluster in real time.
[0093] Step S203, pulling tasks from the server according to the parent node information.
[0094] In step S203, the client node sends a task request to the parent node or the server, and the request may contain the unique identifier of the client (such as node ID) and the current state information, so that the server can decide which tasks to assign according to the current state of the client. The sending frequency of the task request can be fixed (such as once every 5 minutes) or dynamically adjusted. After receiving the task request, the server will select a suitable task from the task pool and send it to the client according to the predefined task rules and policies. This process may involve the verification, encryption and encapsulation of the task to ensure the security and integrity of the task. After receiving the task, the client node will decrypt and verify it to confirm the legitimacy of the task, and then save the task in the local task queue or task list waiting for execution. After pulling the task, the client node will update the local task status information from "not pulled" to "pulled" or "pre-processed" state, which helps the client manage the process of task execution. At the same time, the client needs to record the detailed information of the task, such as task ID, task instruction, task type, execution frequency and start / end time, etc., for subsequent task processing and result reporting.
[0095] Step S204, in response to pulling the task, executing the task and obtaining the execution result.
[0096] In step S204, after the client node successfully pulls the task from the server, the client node performs corresponding operations according to the task instruction and records the execution result. The execution result may include the status of the task execution (success / failure), the start and end time of the execution.
[0097] Through the above steps, the regular sending of heartbeat information enables the server to monitor the operating status of the client node in real time. The client node pulls tasks from the server according to the parent node information and executes them automatically, reducing manual intervention, improving the efficiency and accuracy of task execution, and realizing the automation of resource management.
[0098] Optionally, in response to pulling the task, executing the task and obtaining the execution result include:
[0099] Step S2041, in response to obtaining the task, performing a target verification on the task, wherein the target verification at least includes: whether it is repeated verification, whether it has been tampered with verification, and whether there is a sub-node task verification;
[0100] In step S2041, it should be noted that in some cases, the client node may be a parent node and needs to further distribute the received task to its child nodes. In order to accurately handle the hierarchical transfer of such tasks, the client needs to verify whether the task contains child node tasks. If so, the client will identify the list of child nodes that need to be further notified and prepare to asynchronously distribute the task to these child nodes. This mechanism ensures the orderly delivery of tasks within the cluster and avoids the error propagation of tasks and the ineffective consumption of resources.
[0101] Step S2042, in response to the task being repeated or tampered with, ending the task; or, in response to the task having a sub-node task, asynchronously notifying the sub-node of the corresponding sub-node task to pull the task.
[0102] In step S2042, it should be noted that asynchronous notification is understood as the sender sending a request or message to the receiver, but does not wait for the receiver's response or processing result, but continues to execute subsequent logic or operations.
[0103] When the target verification confirms that the current task contains a subnode task, the client will asynchronously notify its subnode to pull the task. This process is usually achieved by sending a task pull request to the subnode. After receiving the request, the subnode will execute step S203, that is, pull the task from the server. The asynchronous notification mechanism reduces the delay of task processing, allowing the subnode to pull and execute tasks at the appropriate time, and improves the efficiency of task processing within the cluster.
[0104] Through the above steps, through task target verification and asynchronous notification of sub-node tasks, the server cluster asset management method can ensure the safe, accurate and efficient execution of tasks in the cluster, while optimizing the task transmission process between multi-level nodes and improving the overall efficiency of cluster management.
[0105] Optionally, the method further comprises:
[0106] Step S205, reporting the execution result to the server;
[0107] In step S205, when the client node completes the task execution, it generates the execution results, which may include the status of the task execution (success or failure), detailed logs during the execution process, resource usage, etc. The client node encrypts and compresses these execution results to protect the security of the data and reduce the consumption of transmission bandwidth, and then reports them to the server through the network. This process may involve multiple reports, such as reporting to each parent node step by step, to ultimately ensure that the execution results can reach the server.
[0108] Step S206, in response to the execution result being a failure state, the task is put back into the task queue, and the task queue is used to indicate that the tasks are executed in this order.
[0109] In step S205, when the server receives the execution result of the client node, if the result shows that the task execution fails, the server needs to take measures to ensure that the task can be re-executed. To this end, the server will put the task back into the task queue and wait for the next execution. The task queue is a first-in-first-out (FIFO) data structure, which is used to characterize the execution of tasks in this order, ensuring the orderliness and fairness of task execution.
[0110] Through the above steps, the real-time reporting mechanism of execution results enables the server to timely grasp the status of task execution, monitor resource usage, system performance and network conditions in real time, improve the transparency and response speed of cluster management, and automatically put failed tasks back into the task queue to ensure that the task can be tried again when conditions permit, avoiding permanent failure of the task and enhancing the system's fault tolerance and recovery capabilities in the face of abnormal situations.
[0111] Optionally, the method further comprises:
[0112] Step S207, obtaining the storage time of the task, where the storage time is used to represent the waiting time in the task queue;
[0113] In step S207, in the task queue, each task has a time point when it is placed in the queue. The storage time is used to characterize the pending time in the task queue, that is, the length of time the task waits in the queue to be processed. When the task is placed in the queue, the system will record a timestamp for each task, indicating the time when it enters the queue. This timestamp can be stored in the task data structure for subsequent query and processing. The storage time should be updated in real time and can be calculated regularly or when the task status changes to ensure the accuracy of the time.
[0114] Step S208, determining whether the storage time of the task exceeds the preset configuration time; in response to the storage time exceeding the configuration time, deleting the task.
[0115] In step S208, the system presets the maximum storage time of the task, i.e., the configuration time, in order to prevent waste of resources and avoid a backlog of too many unprocessed tasks in the queue. When the storage time of a task exceeds the preset configuration time, the server will determine that the task is in a timeout state and delete the timeout task.
[0116] Through the above steps, timed tasks are deleted regularly, avoiding unnecessary resource occupation in the queue, allowing the system to process new or more important tasks more efficiently. By managing the task queue and reducing redundant and expired tasks, the system load can be reduced, preventing the system from crashing or performance degradation due to improper resource management.
[0117] Figure 3 FIG. 1 is a structural diagram of a server cluster asset management device according to one embodiment of the present invention. Figure 3 As shown, the device includes: a client module and a server module.
[0118] The client modules include: heartbeat module, task pulling module, task processing module, task cleaning module, and offline mode processing module.
[0119] Among them, the task processing module includes: a task verification module, a task instruction execution module, a task result reporting module, and a scheduled task processing module.
[0120] Among them, the heartbeat module is used by the node to report heartbeat information to the server, build a node tree for the server, and provide basic data.
[0121] The task pull module is used to periodically pull tasks from the parent node, modify the task status, and put the tasks into the task execution queue.
[0122] The task processing module is mainly used for task processing related work. It includes the task verification module, the task instruction execution module, the task result reporting module and the scheduled task processing module. The task verification module is responsible for verifying whether the task has been tampered with and whether there is an identical task (mainly for scheduled tasks). The task instruction execution module is responsible for the execution and recording of task instructions, and encrypts and compresses the instruction execution results. The task result reporting module is responsible for reporting the results of the task instruction execution step by step. After the report is completed, the instruction execution results saved by the current node are deleted. The scheduled task processing module is responsible for the processing of scheduled tasks, including the scheduling of scheduled tasks, adding scheduled tasks and canceling scheduled tasks.
[0123] The task cleaning module is responsible for cleaning up timed scheduled tasks in the scheduled task scheduler and node task copies.
[0124] The offline mode processing module is responsible for processing the node entering and leaving offline mode.
[0125] The server-side modules include: node tree construction module, task creation module, task publishing module, task reporting processing module, and task cancellation module.
[0126] Among them, the node tree construction module is used to parse and sort out the heartbeat task result information reported in the client heartbeat module to complete the construction of the tree structure.
[0127] The create task module is mainly used for creating regular tasks and scheduled tasks.
[0128] The task publishing module is used to select and publish nodes and tasks, assemble node information and task information, and notify lower-level child nodes to pull tasks.
[0129] The reporting task processing module is used to receive tasks reported by client nodes and distribute them to corresponding task processors for processing according to task types. During the analysis and processing, if problems or risks are identified, the automatic alarm function will be triggered to notify relevant stakeholders.
[0130] The task cancellation module is mainly used to cancel scheduled tasks.
[0131] Based on this device, when a large number of server groups need to be managed, the preliminary preparation work is relatively cumbersome. It is necessary to sort out, split, design, develop and test the executable program requirements according to the actual application scenario to ensure the correctness, availability and security of the program; at the same time, it is also necessary to clarify the complex network relationship between each server, and the nodes should report heartbeat information in turn or check the node status regularly according to the hierarchy. It is necessary to customize the development of the return result parsing plug-in based on the return information of each instruction execution, and convert the instruction execution results into recognizable data on the server side to facilitate data analysis, anomalies and risk identification.
[0132] Figure 4 It is an overall design flow chart of a server cluster asset management method according to one embodiment of the present invention.
[0133] like Figure 4 As shown, the process method includes:
[0134] 1. Based on the scenario requirements, the requirement documents are organized, and the R&D team performs overall process design, outline design, prototype design, database table design, and detailed design according to the requirement documents; according to the process described in the design document, an application program that can execute instructions is developed using a suitable programming language (Java is used in this invention).
[0135] 2. The server enters the node information and the subordinate relationship between each node to form a tree structure, which is displayed on the front end; if the parent node changes during operation, the server can automatically adjust the position of the tree structure node through the received heartbeat information.
[0136] 3. The server publishes the application to the same directory of all nodes through instructions to facilitate unified management.
[0137] 4. The server starts the application in each node through instructions. It is necessary to ensure that the application in each node starts normally and the server can receive the heartbeat information reported by each node.
[0138] 5. According to the subordinate relationship entered in step 2 above, the nodes report heartbeat information to the parent node in turn, and finally reach the server for aggregation and analysis. The server returns the analysis results to the front end, forming a visual tree structure diagram to show the online / offline status of each node.
[0139] 6. After completing step 4 above, all instructions are executed. You can create tasks through the server and publish tasks to the node program for execution. The server can publish instruction tasks and corresponding task parsing methods to each child node periodically or once, collect resource usage of the server where the node is located, or other desired information.
[0140] 7. The server distributes the collected results to different task processors for analysis through the task distributor according to the established algorithms and rules, according to the task type. The alarm function will be automatically activated for the identified abnormal nodes. According to the server personnel information configured in the initialization, SMS or email will be sent to inform the system administrator and the corresponding responsible personnel to conduct timely problem troubleshooting.
[0141] Based on the above device, the client module performs the following steps:
[0142] Step 1: The client node sends a request to the parent node to obtain the parent node information, and so on, to build the heartbeat information, and put the heartbeat information into the task queue, waiting for reporting (the server side processes it through the task processor);
[0143] Step 2: Task pulling: The client node periodically pulls tasks from the parent node. If the task is successfully pulled, the task status is changed to pre-processing, and the task is placed in the queue, waiting for the server to process it.
[0144] Step 3: Task verification. After getting the task from the queue, you need to check whether the task is repeated (for scheduled tasks), whether it has been tampered with, and whether there are child node tasks. If the task is repeated or tampered with, log it and end the current process. If there is a child node task, asynchronously notify the child node to pull the task.
[0145] Step 4: Task execution, set up a temporary storage directory for execution results, and record the entire execution process of the task (including execution times, execution start / end time, and execution instructions), encrypt and compress the task execution results, and report them in sequence according to the node hierarchy structure.
[0146] Step 5: Report the task results, obtain the parent node information, request the parent node to report the task interface, report the task execution results, delete the results if the report is successful, otherwise record the log, put the task back into the queue, and automatically notify the relevant personnel with an alarm.
[0147] Step 6: Scheduled task processing: if the task execution time is after the current time, put the task into the scheduled task scheduler and wait for task execution; otherwise, change the task status to pending execution and put the task into the task queue.
[0148] Step 7: Cancel task execution. Get the scheduled task to be canceled from the task copy saved by the node, and delete the scheduled task from the scheduled task scheduler.
[0149] Step 8: Scheduled task scheduling: manage all scheduled tasks according to task requirements through the scheduled task scheduler, including adding and canceling scheduled tasks.
[0150] Step 9: Task cleanup: Scan and clean up tasks regularly through scheduled tasks; determine whether the task survival time exceeds the configured time, and delete the task if it exceeds the configured time.
[0151] Step 10: Enter offline mode and try to communicate with the parent node. If a network anomaly occurs between the parent node and the task queue, clear the task information in the node task copy information and the scheduled task scheduler, and set the node to the offline mode flag.
[0152] Step 11: Leave offline mode and try to communicate with the parent node. If the communication with the parent node is normal, pull the task from the parent node and put it into the scheduled task scheduler, and set the node to the online mode flag.
[0153] Based on the above device, the server module performs the following steps:
[0154] Step 1: Node entry. Enter the server node page, click Add Node, enter the IP port information of the parent node and child node respectively, click Test to test whether the network communication between nodes is smooth. The save operation can be performed only if the test is successful, otherwise a prompt will be given.
[0155] Step 2: Node tree construction, Figure 5 Construct a flow graph for the node tree, such as Figure 5 As shown in the figure, the server pre-enters the node information and receives the heartbeat task reported by the client, and constructs the node tree according to the hierarchical structure; if the heartbeat task is a new node, the node information is saved and the node is added to the node tree according to the parent node information. If the parent node changes, the position of the node in the tree structure is adjusted according to the new parent node information.
[0156] Step 3: Create a task. Figure 6 To create a task flow chart, such as Figure 6 As shown, the server creates a task and determines whether there is an identical task (only for scheduled tasks) through the task attributes, such as task name, task instruction, frequency, and start and end time; if the task requirements are met, it is saved in the task list. One-time tasks are saved directly.
[0157] Step 4: Release the task. Figure 7 To publish a task flow chart, such as Figure 7 As shown in the figure, select the node that needs to execute the task and the task that needs to be published (both nodes and tasks can be selected in batches), and determine whether the node is legal and whether the current task already exists. After verification, assemble the node information and task information and save them, place the node task information in the memory, notify the lower-level nodes to pull the tasks and execute the tasks according to the configuration requirements.
[0158] Step 5: Report task processing. Figure 8 The following is a flowchart for reporting task processing: Figure 8 As shown in the figure, the server will receive the tasks reported by the node and put them into the queue for processing. When processing tasks, it will also judge illegal tasks, decrypt the tasks that meet the requirements with the private key, modify the task steps (processed by the server), and put them back into the task queue for execution. The task distributor distributes tasks to different task processors according to the task type (heartbeat task, system task, one-time task, scheduled task), compresses and encrypts the task results and saves them to the disk, and parses the result data according to the selected parsing method. After completing the operation, for security reasons, the result table and the data packet on the local disk are finally deleted.
[0159] Step 6: Automatic alarm for abnormal identification, Fig. 9 This is the automatic alarm flow chart, such as Fig. 9 As shown, the server analyzes the information (heartbeat or scheduled task) reported by the client regularly, and judges according to the established abnormal rules. If the abnormal conditions are met, an automatic alarm is issued, and the corresponding personnel are notified by email or text message. If there is no heartbeat report for a long time, the update node is offline, and the corresponding personnel are also notified by email or text message.
[0160] According to another aspect of an embodiment of the present invention, a server is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing the following program instructions: receiving heartbeat information of a client node, wherein the heartbeat information is used to characterize the status of the client node; constructing a node tree based on the heartbeat information; and managing a server cluster according to the node tree.
[0161] Optionally, the processor in the above-mentioned server can also be set to execute program instructions for the following functions: create tasks according to task types, wherein tasks include: ordinary tasks and scheduled tasks; select a target node in the node tree and assign the task to the target node, wherein the target node is used to represent the client node; and the target node processes the task.
[0162] Optionally, the processor in the above-mentioned server can also be set to execute program instructions for the following functions: receiving heartbeat information corresponding to the target node reported by the client node; in response to the heartbeat information corresponding to the target node meeting an abnormal condition, generating an alarm instruction, and the alarm instruction is used to issue an alarm to the target device.
[0163] Optionally, the processor in the above-mentioned server can also be set to execute program instructions for the following functions: determine whether the target node is an illegal node, wherein the illegal node is used to represent a node that does not exist in the node tree; in response to the target node not being an illegal node, determine whether the target node has the same task, wherein the same task is used to represent that the same task is executed multiple times; in response to the target node not having the same task, assemble the target node information corresponding to the target node and the task information corresponding to the task, and notify the child nodes below the target node to pull the task.
[0164] Optionally, the processor in the above-mentioned server can also be set to execute program instructions for the following functions: in response to the first node corresponding to the heartbeat information being a new node, determining the parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree; and adding the first node to the node tree according to the parent node information of the parent node.
[0165] Optionally, the processor in the above-mentioned server can also be set to execute program instructions for the following functions: in response to the first node corresponding to the heartbeat information being a non-new node, determining whether the parent node corresponding to the first node has changed; in response to the parent node changing, adjusting the position of the node and updating the operation time; or, in response to the parent node not changing, updating the last operation time of the node tree.
[0166] According to another aspect of an embodiment of the present invention, a client is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing the following program instructions: obtaining parent node information from a server; sending heartbeat information of the client node to the server based on the parent node information, wherein the heartbeat information is used to characterize the status of the client node; pulling tasks from the server based on the parent node information; and executing the tasks in response to pulling the tasks to obtain execution results.
[0167] Optionally, the processor in the above-mentioned client can also be configured to execute program instructions for the following functions: in response to obtaining a task, performing a target verification on the task, wherein the target verification includes at least: whether it is repeated, whether it has been tampered with, and whether there is a sub-node task verification; in response to the existence of duplication or tampering of the task, ending the task; or, in response to the existence of a sub-node task in the task, asynchronously notifying the sub-node of the corresponding sub-node task to pull the task.
[0168] Optionally, the processor in the client may also be configured to execute program instructions for the following functions: in response to an execution result being a failure state, re-enter the task into a task queue, where the task queue is used to indicate that the tasks are executed in this order.
[0169] Optionally, the processor in the above-mentioned client can also be set to execute program instructions for the following functions: obtain the storage time of the task, the storage time is used to represent the pending time in the task queue; determine whether the storage time of the task exceeds the preset configuration time; in response to the storage time exceeding the configuration time, delete the task.
[0170] According to another aspect of an embodiment of the present invention, a non-volatile storage medium is provided. The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the server cluster asset management method of the above embodiment by running the computer program.
[0171] Optionally, in this embodiment, the above-mentioned computer program may be configured to store a computer program for performing the following steps:
[0172] Step S101, receiving heartbeat information of a client node, wherein the heartbeat information is used to represent the state of the client node;
[0173] Step S102, constructing a node tree based on the heartbeat information;
[0174] Step S103: managing the server cluster according to the node tree.
[0175] Optionally, the above-mentioned computer program can be configured to store a computer program for performing the following steps: creating a task according to the task type, wherein the tasks include: ordinary tasks and scheduled tasks; selecting a target node in the node tree and assigning the task to the target node, wherein the target node is used to represent the client node; and the target node processes the task.
[0176] Optionally, the above-mentioned computer program can be configured to store a computer program for executing the following steps: receiving heartbeat information corresponding to the target node reported by the client node; in response to the heartbeat information corresponding to the target node meeting an abnormal condition, generating an alarm instruction, the alarm instruction being used to issue an alarm to the target device.
[0177] Optionally, the above-mentioned computer program can be configured to store a computer program for performing the following steps: determining whether the target node is an illegal node, wherein an illegal node is used to characterize a node that does not exist in the node tree; in response to the target node not being an illegal node, determining whether the target node has the same task, wherein the same task is used to characterize that the same task is executed multiple times; in response to the target node not having the same task, assembling the target node information corresponding to the target node and the task information corresponding to the task, and notifying the child nodes below the target node to pull the task.
[0178] Optionally, the above-mentioned computer program can be configured to store a computer program for performing the following steps: in response to the first node corresponding to the heartbeat information being a new node, determining the parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree; and adding the first node to the node tree according to the parent node information of the parent node.
[0179] Optionally, the above-mentioned computer program can be configured to store a computer program for performing the following steps: in response to the first node corresponding to the heartbeat information being a non-new node, determining whether the parent node corresponding to the first node has changed; in response to the parent node changing, adjusting the position of the node and updating the operation time; or, in response to the parent node not changing, updating the last operation time of the node tree.
[0180] Optionally, in this embodiment, the above-mentioned computer program may be configured to store a computer program for performing the following steps:
[0181] Step S201, obtaining parent node information from the server;
[0182] Step S202, sending the heartbeat information of the client node to the server according to the parent node information, wherein the heartbeat information is used to represent the state of the client node;
[0183] Step S203, pulling tasks from the server according to the parent node information;
[0184] Step S204, in response to pulling the task, executing the task and obtaining the execution result.
[0185] Optionally, the above-mentioned computer program can be configured to store a computer program for executing the following steps: in response to obtaining a task, performing a target verification on the task, wherein the target verification includes at least: whether it is repeated, whether it has been tampered with, and whether there is a sub-node task verification; in response to the existence of duplication or tampering of the task, ending the task; or, in response to the existence of a sub-node task in the task, asynchronously notifying the sub-node of the corresponding sub-node task to pull the task.
[0186] Optionally, the computer program may be configured to store a computer program for executing the following steps: reporting the execution result to the server; in response to the execution result being a failure state, re-placing the task into a task queue, the task queue being used to indicate that the tasks are executed in this order.
[0187] Optionally, the above-mentioned computer program can be configured to store a computer program for executing the following steps: obtaining the storage time of the task, the storage time is used to characterize the pending time in the task queue; determining whether the storage time of the task exceeds a preset configuration time; in response to the storage time exceeding the configuration time, deleting the task.
[0188] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the server cluster asset management method of the above embodiment is implemented.
[0189] Optionally, in this embodiment, the above computer program implements the following steps when executed by a processor:
[0190] Step S101, receiving heartbeat information of a client node, wherein the heartbeat information is used to represent the state of the client node;
[0191] Step S102, constructing a node tree based on the heartbeat information;
[0192] Step S103: managing the server cluster according to the node tree.
[0193] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: create a task according to the task type, wherein the tasks include: ordinary tasks and scheduled tasks; select a target node in the node tree and assign the task to the target node, wherein the target node is used to represent the client node; the target node processes the task.
[0194] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: receiving heartbeat information corresponding to the target node reported by the client node; in response to the heartbeat information corresponding to the target node meeting an abnormal condition, generating an alarm instruction, and the alarm instruction is used to issue an alarm to the target device.
[0195] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: determine whether the target node is an illegal node, wherein the illegal node is used to represent a node that does not exist in the node tree; in response to the target node not being an illegal node, determine whether the target node has the same task, wherein the same task is used to represent that the same task is executed multiple times; in response to the target node not having the same task, assemble the target node information corresponding to the target node and the task information corresponding to the task, and notify the child nodes below the target node to pull the task.
[0196] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: in response to the first node corresponding to the heartbeat information being a new node, determining the parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree; and adding the first node to the node tree according to the parent node information of the parent node.
[0197] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: in response to the first node corresponding to the heartbeat information being a non-new node, determining whether the parent node corresponding to the first node has changed; in response to the parent node changing, adjusting the position of the node and updating the operation time; or, in response to the parent node not changing, updating the last operation time of the node tree.
[0198] Optionally, in this embodiment, the above computer program implements the following steps when executed by a processor:
[0199] Step S201, obtaining parent node information from the server;
[0200] Step S202, sending the heartbeat information of the client node to the server according to the parent node information, wherein the heartbeat information is used to represent the state of the client node;
[0201] Step S203, pulling tasks from the server according to the parent node information;
[0202] Step S204, in response to pulling the task, executing the task and obtaining the execution result.
[0203] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: in response to obtaining the task, performing target verification on the task, wherein the target verification at least includes: whether it is repeated verification, whether it has been tampered with verification, and whether there is a sub-node task verification; in response to the task being repeated or tampered with, ending the task; or, in response to the task having a sub-node task, asynchronously notifying the sub-node of the corresponding sub-node task to pull the task.
[0204] Optionally, the computer program implements the following steps when executed by the processor: reporting the execution result to the server; in response to the execution result being a failure state, putting the task back into the task queue, the task queue being used to indicate that the tasks are executed in this order.
[0205] Optionally, the above-mentioned computer program implements the following steps when executed by the processor: obtaining the storage time of the task, the storage time is used to characterize the pending time in the task queue; determining whether the storage time of the task exceeds the preset configuration time; in response to the storage time exceeding the configuration time, deleting the task.
[0206] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0207] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0208] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units can be a logical function division, and there can be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0209] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0210] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0211] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0212] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A server cluster asset management method, characterized in that: include: Receiving heartbeat information of a client node, wherein the heartbeat information is used to represent a state of the client node; Based on the heartbeat information, construct a node tree; The server cluster is managed according to the node tree.
2. The method according to claim 1, characterized in that According to the node tree, the server cluster is managed, including: Create tasks according to the task type, wherein the tasks include: ordinary tasks and scheduled tasks; Selecting a target node in the node tree and assigning the task to the target node, wherein the target node is used to represent a client node; The target node processes the task.
3. The method according to claim 2, characterized in that According to the node tree, the server cluster is managed, including: Receiving the heartbeat information corresponding to the target node reported by the client node; In response to the heartbeat information corresponding to the target node satisfying an abnormal condition, an alarm instruction is generated, where the alarm instruction is used to issue an alarm to the target device.
4. The method according to claim 2, characterized in that: Selecting a target node in the node tree and assigning the task to the target node includes: Determine whether the target node is an illegal node, wherein the illegal node is used to represent a node that does not exist in the node tree; In response to the target node not being an illegal node, determining whether the target node has an identical task, wherein the identical task is used to indicate that the same task is executed multiple times; In response to the same task not existing on the target node, the target node information corresponding to the target node and the task information corresponding to the task are assembled, and the child nodes under the target node are notified to pull the task.
5. The method according to claim 1, characterized in that Based on the heartbeat information, a node tree is constructed, including: In response to the first node corresponding to the heartbeat information being a new node, determining a parent node corresponding to the new node, wherein the new node is used to characterize as a node not included in the node tree; According to the parent node information of the parent node, the first node is added to the node tree.
6. The method according to claim 5, characterized in that Based on the heartbeat information, a node tree is constructed, including: In response to the first node corresponding to the heartbeat information being not a new node, determining whether a parent node corresponding to the first node has changed; In response to the parent node changing, the position of the node is adjusted and the operation time is updated; or, in response to the parent node not changing, the last operation time of the node tree is updated.
7. A server cluster asset management method, characterized in that: include: Get parent node information from the server; Sending heartbeat information of the client node to the server according to the parent node information, wherein the heartbeat information is used to represent the state of the client node; Pulling tasks from the server according to the parent node information; In response to pulling the task, the task is executed to obtain an execution result.
8. The method according to claim 7, characterized in that In response to pulling the task, executing the task and obtaining an execution result, including: In response to obtaining the task, performing a target verification on the task, wherein the target verification at least includes: a check on whether it is repeated, a check on whether it has been tampered with, and a check on whether there are sub-node tasks; In response to the task being repeated or tampered with, ending the task; or, In response to the existence of a sub-node task for the task, a sub-node corresponding to the sub-node task is asynchronously notified to pull the task.
9. The method according to claim 7, characterized in that: Also includes: Reporting the execution result to the server; In response to the execution result being a failure state, the task is put back into a task queue, wherein the task queue is used to indicate that the tasks are executed in this order.
10. The method according to claim 7, characterized in that Also includes: Obtaining the storage time of the task, where the storage time is used to represent the waiting time in the task queue; Determine whether the storage time of the task exceeds a preset configuration time; in response to the storage time exceeding the configuration time, delete the task.
11. A server, characterized in that: include: A memory for storing program instructions; A processor is connected to the memory and is used to execute program instructions for the following functions: receiving heartbeat information of a client node, wherein the heartbeat information is used to characterize the state of the client node; constructing a node tree based on the heartbeat information; and managing a server cluster according to the node tree.
12. A client, characterized in that: include: A memory for storing program instructions; A processor, connected to the memory, is used to execute program instructions for the following functions: obtaining parent node information from a server; Sending heartbeat information of the client node to the server according to the parent node information, wherein the heartbeat information is used to characterize the status of the client node; pulling tasks from the server according to the parent node information; and executing the tasks in response to pulling the tasks to obtain execution results.
13. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method according to any one of claims 1 to 10 by running the computer program.
14. A computer program product, characterized in that It comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Network topology building method
CN103763172A
Distributed task scheduling method, device and system
CN111381972A
Graphical deployment and state monitoring integrated system and method
CN114527995A
Task scheduling method and device, computer equipment and storage medium
CN116489230A
Cited By
Server cluster management system based on MCU
CN120223591A