Cluster operation and maintenance instruction execution method and device, electronic device, and storage medium

By using instruction metadata templates and routing strategies to break down batch instructions in cloud-native cluster operations and maintenance, generating and distributing atomic instructions, the problems of high cluster resource consumption and low execution efficiency are solved, thereby improving the efficiency and stability of cluster operations and maintenance.

CN120474915BActive Publication Date: 2025-11-18ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510978104.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-11-18
Estimated Expiration
2045-07-16

AI Technical Summary

Technical Problem

In large-scale cluster operations and maintenance in the cloud-native field, the batch execution of operation and maintenance commands leads to high cluster resource consumption and low command execution efficiency, affecting cluster performance and stability.

Method used

By receiving batch instruction information generated from a preset instruction metadata template, parameters are extracted and decomposed to generate atomic instructions. An initial instruction queue is created based on the routing strategy. The target instruction queue is matched with the index value for distribution and merging. The target configuration item is then generated and sent to the target device for execution.

Benefits of technology

It improves the efficiency of operation and maintenance in large-scale cluster environments, reduces resource consumption, ensures the stability and performance of the cluster, and enables the efficient execution of operation and maintenance commands.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120474915B_ABST
    Figure CN120474915B_ABST
Patent Text Reader

Abstract

The application relates to a cluster operation instruction execution method and device, an electronic device and a storage medium, wherein the cluster operation instruction execution method comprises the following steps: receiving batch instruction information; performing parameter extraction on the batch instruction information to obtain basic parameters, a target device group and a routing strategy; performing instruction decomposition on the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, the atomic instructions containing target device identifiers; creating an instruction queue; wherein each cluster device corresponds to a first index value of the instruction queue; calculating a second index value based on the routing strategy and the target device identifiers; in the instruction queue, searching for an instruction queue matched with the second index value based on the first index value, and distributing the atomic instructions into the instruction queue; generating target configuration items based on the atomic instructions, and delivering the target configuration items to target devices; and the target devices executing the atomic instructions. Through the application, the problems of large cluster resource consumption and low instruction execution efficiency are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the cloud-native field, and in particular to cluster operation and maintenance instruction execution methods, apparatus, electronic devices, and storage media. Background Technology

[0002] In cloud-native cluster operations and maintenance scenarios, as business scale expands, cluster size also grows increasingly large. Large-scale cluster operations and maintenance involve a large number of personnel, and batch execution of operational commands becomes commonplace. However, this drastically increases the load on cluster machines. Numerous commands are issued and executed simultaneously, and multiple operational functions may contain homogeneous atomic operations, severely consuming cluster resources, impacting overall cluster performance and stability, and potentially causing system lag, slow response times, and other problems, significantly reducing operational efficiency. Current technologies lack intelligent processing of operational commands, resulting in high cluster resource consumption and low command execution efficiency when facing batch operational needs for large-scale clusters.

[0003] Currently, no effective solution has been proposed for the problems of high cluster resource consumption and low command execution efficiency in cluster operation and maintenance. Summary of the Invention

[0004] This application provides a cluster operation and maintenance instruction execution method, apparatus, electronic device, and storage medium to at least solve the problem of low instruction execution efficiency when facing the batch operation and maintenance needs of large-scale clusters in related technologies.

[0005] In a first aspect, embodiments of this application provide a method for executing cluster operation and maintenance instructions, the method comprising:

[0006] Receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group, and routing policy; the target device group includes at least one target device in the cluster device;

[0007] Based on the basic parameters and the target device group, the batch instruction information is decomposed to obtain atomic instructions, and the atomic instructions carry the target device identifier;

[0008] An initial instruction queue is created; wherein each of the cluster devices corresponds to a first index value of the initial instruction queue;

[0009] A second index value is calculated based on the routing policy and the target device identifier; in the initial instruction queue, a target instruction queue matching the second index value is retrieved based on the first index value, and the atomic instruction is distributed to the target instruction queue;

[0010] A target configuration item is generated based on the atomic instructions in the target instruction queue, and the target configuration item is sent to the target device; the target device executes the atomic instructions based on the target configuration item.

[0011] In some embodiments, the batch instruction information further includes an instruction merging strategy; the generation of target configuration items based on the atomic instructions in the target instruction queue includes:

[0012] Based on the instruction merging strategy, atomic instructions in the target instruction queue are compressed to generate target configuration items.

[0013] In some embodiments, the atomic instructions further include instruction categories; the step of compressing the atomic instructions in the target instruction queue based on the instruction merging strategy to generate target configuration items includes:

[0014] Sequentially traverse the atomic instructions stored in the target instruction queue;

[0015] Detect whether there exists a target atomic instruction in the target instruction queue that was enqueued before the current atomic instruction, and whether it has the same instruction type and target device identifier as the current atomic instruction being traversed.

[0016] If so, then when the instruction merging strategy indicates instruction compression, the skip flag of the target atomic instruction is set to enabled until the atomic queue in the target instruction queue has been traversed.

[0017] The skip flag of each atomic instruction in the target instruction queue is detected, and the target configuration item is generated based on the atomic instructions whose skip flag is disabled.

[0018] In some embodiments, the step of retrieving a target instruction queue that matches the second index value based on the first index value in the initial instruction queue, and distributing the atomic instruction to the target instruction queue, includes:

[0019] If it fails to retrieve an instruction queue that matches the second index value, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.

[0020] In some embodiments, the batch instruction information further includes the execution result status; after sending the target configuration item to the target device, the method further includes:

[0021] The execution result of the target device is detected; the execution result is obtained by the target device generating executable instructions for the atomic instructions based on the target configuration items and executing the executable instructions.

[0022] In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.

[0023] In some embodiments, the atomic instruction further includes a parent instruction identifier; the parent instruction identifier refers to the identifier of the batch instruction information to which the atomic instruction belongs; updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device includes:

[0024] If the version identifier in the target configuration item is found to be consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.

[0025] In some embodiments, updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device further includes:

[0026] If the version identifier in the target configuration item is found to be inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time exceeds a preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time when the target configuration item is sent to the target device and the current time.

[0027] Secondly, embodiments of this application provide a cluster operation and maintenance instruction execution device, the device comprising:

[0028] The instruction receiving module is used to receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group and routing policy; the target device group includes at least one target device in the cluster device;

[0029] The instruction decomposition module is used to decompose the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, wherein the atomic instructions carry the target device identifier;

[0030] The instruction queue management module is used to create an initial instruction queue; wherein each of the cluster devices corresponds to a first index value of the initial instruction queue;

[0031] The instruction routing and distribution module is used to calculate a second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, it retrieves a target instruction queue that matches the second index value, and distributes the atomic instruction to the target instruction queue;

[0032] A configuration generation module is used to generate target configuration items based on the atomic instructions in the target instruction queue, and to send the target configuration items to the target device; the target device executes the atomic instructions based on the target configuration items.

[0033] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the cluster operation and maintenance instruction execution method as described in the first aspect above.

[0034] Fourthly, embodiments of this application provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the cluster operation and maintenance instruction execution method as described in the first aspect above.

[0035] Compared to related technologies, the cluster operation and maintenance instruction execution method, apparatus, electronic device, and storage medium provided in this application embodiment receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device groups, and routing policies; the target device group includes at least one target device in the cluster; based on the basic parameters and the target device group, the batch instruction information is decomposed into atomic instructions, each carrying a target device identifier; an initial instruction queue is created; each cluster device corresponds to a first index value of the initial instruction queue; a second index value is calculated based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, a target instruction queue matching the second index value is retrieved, and the atomic instructions are distributed to the target instruction queue; a target configuration item is generated based on the atomic instructions in the target instruction queue, and the target configuration item is sent to the target device; the target device executes the atomic instructions based on the target configuration item. This solves the problems of low instruction execution efficiency and excessive resource consumption in traditional cluster operation and maintenance, and achieves high efficiency in operation and maintenance operations in large-scale cluster environments.

[0036] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description

[0037] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0038] Figure 1 This is a hardware structure block diagram of a terminal for a cluster operation and maintenance instruction execution method according to an embodiment of this application;

[0039] Figure 2 This is a flowchart of a cluster operation and maintenance instruction execution method according to an embodiment of this application;

[0040] Figure 3 This is a flowchart of the lifecycle stages of batch instruction information according to an embodiment of this application;

[0041] Figure 4 This is a flowchart illustrating the lifecycle transformation of batch instruction information according to an embodiment of this application;

[0042] Figure 5 This is a flowchart of atomic instruction compression according to an embodiment of this application;

[0043] Figure 6 This is a schematic diagram of an instruction merging strategy according to an embodiment of this application;

[0044] Figure 7 This is a flowchart illustrating the creation of an instruction queue according to an embodiment of this application;

[0045] Figure 8 This is a flowchart illustrating the destruction of the instruction queue according to an embodiment of this application;

[0046] Figure 9 This is a flowchart of instruction processing according to an embodiment of this application;

[0047] Figure 10 This is a structural block diagram of a cluster operation and maintenance instruction execution device according to an embodiment of this application;

[0048] Figure 11 This is a schematic diagram of the overall system architecture according to an embodiment of this application;

[0049] Figure 12 This is a structural block diagram of the system architecture according to an embodiment of this application. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application. Furthermore, it is understood that although the efforts made in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, modifications to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.

[0051] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0052] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application means two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The terms “first,” “second,” “third,” etc., used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.

[0053] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. Taking running on a terminal as an example, Figure 1 This is a hardware structure block diagram of a terminal for a cluster operation and maintenance instruction execution method according to an embodiment of this application. For example... Figure 1 As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 12 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 14 for storing data are also shown. Optionally, the terminal may further include a transmission device 16 for communication functions and an input / output device 18. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0054] The memory 14 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the cluster operation and maintenance instruction execution method in this embodiment. The processor 12 executes various functional applications and data processing by running the computer program stored in the memory 14, thus implementing the above-described method. The memory 14 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 14 may further include memory remotely located relative to the processor 12, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0055] The transmission device 16 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the terminal's communication provider. In one example, the transmission device 16 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 16 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0056] This embodiment provides a method for executing cluster operation and maintenance commands. Figure 2 This is a flowchart of a cluster operation and maintenance instruction execution method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0057] Step S201: Receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group and routing policy; the target device group includes at least one target device in the cluster devices.

[0058] Here, the instruction metadata template can also be named TraitDef. TraitDef defines the types of operation and maintenance instructions supported by the system, the instruction name, description, and parameter definitions. The definition of operation and maintenance parameters mainly specifies the parsing rules for the parameters of the instruction. Batch instruction information can also be named Trait. Trait records user operation and maintenance instructions and their results, including the associated TraitDef, basic parameters, instruction merging strategy, routing strategy, target device group, and other information.

[0059] Specifically, upon receiving batch command information (Trait) from the user, the system first verifies the structure's validity by matching the corresponding TraitDef field. Then, based on the TraitDef's parameter parsing rules, it extracts and verifies information such as basic parameters, target device groups, and routing policies from the Trait. The target device group is the list of devices to be executed. After successful verification, the system encapsulates the Trait into a resource object conforming to the Kubernetes (an open-source container orchestration platform) standard. When a Trait resource is created or updated, a resource event queue based on the k8s informer (a resource monitoring mechanism) uses a list & watch (a query monitoring mechanism) mechanism to monitor its changes in real time. This queue can capture three types of events: added, updated, and deleted. Events are automatically enqueued after generation, and consumer processes consume queue elements. A consumer process is the component responsible for retrieving events from the event queue and executing the corresponding processing logic. Consumers retrieve events from the queue, parse the current state of the Trait (such as the Initial stage), execute the corresponding stage logic (such as parameter validation and instruction dispatch) according to the Trait lifecycle definition, update the status field of the Trait after processing, trigger a new round of Informer listening, and form a closed loop of state flow.

[0060] Figure 3 This is the lifecycle stage of the batch instruction information Trait in the embodiments of this application, such as Figure 3 As shown, the process includes the following steps:

[0061] Step S301, Initialization Phase: When the system receives the batch operation and maintenance command Trait input by the user, Trait enters the initialization phase.

[0062] Step S302, parameter verification phase; After the Trait completes the initialization phase, it automatically enters the parameter verification phase.

[0063] Step S303, Command Distribution Phase: After the parameter verification phase is successfully completed, the Trait enters the command distribution phase.

[0064] Step S304, Execution Phase: After the instruction dispatch phase is completed, the Trait enters the execution phase.

[0065] Step S305, Execution Success Phase: When all target devices have successfully completed the execution of the operation and maintenance instructions, and the system confirms that the execution results meet expectations, Trait enters the execution success phase.

[0066] Step S306, Execution Failure Phase; During the execution phase, if the execution of any maintenance command for a target device fails to achieve the expected results, such as error messages or execution results that do not meet requirements, the Trait will enter the execution failure phase.

[0067] Figure 4 This is the lifecycle conversion process for batch instruction information, such as... Figure 4 As shown, the process includes the following steps:

[0068] Step S401, Start the process; the process start point marks the start of the batch instruction information status processing process, and the initial state of the batch instruction information is initialization.

[0069] Step S402: Determine the status of the batch instruction information; based on the current status of the batch instruction information, determine the subsequent execution path, which corresponds to the initialization, configuration verification, instruction distribution and execution status branches respectively.

[0070] Step S403, Configuration Verification Phase: Verify the parameters of the batch instruction information according to the configuration item description information of the corresponding TraitDef. If the verification is successful, change the status of the batch instruction information to instruction distribution; otherwise, add a failure reason and change the status to execution failure.

[0071] Step S404, Instruction Distribution Stage: Add batch instruction information to the batch instruction information receiving queue of the instruction batch processing module. If the addition is successful, change the status of the batch instruction information to "executed" and re-enqueue the event for reprocessing later.

[0072] Step S405, Execution Phase: Obtain the execution result record of batch instruction information, determine whether the sum of failure records and success records is equal to the target number of nodes. If they are equal and there are no failure records, change the status of the batch instruction information to execution success; if they are equal and there are failure records, change the status of the batch instruction information to execution failure. No other processing is performed.

[0073] Step S406, the successful execution phase, dequeues the batch instruction information elements without any processing.

[0074] Step S407, the failure phase, dequeues the batch instruction information elements without any processing.

[0075] This mechanism ensures that batch instruction information Trait changes can be processed in a timely and reliable manner through the Kubernetes standard resource monitoring mode. At the same time, it utilizes the deduplication and asynchronous characteristics of queues to avoid resource contention in high-concurrency scenarios, and realizes full lifecycle traceability and manageability of operation and maintenance instructions.

[0076] Step S202: Based on the basic parameters and the target device group, the batch instruction information is decomposed to obtain atomic instructions, which carry the target device identifier.

[0077] Specifically, upon receiving the batch command information (Trait) from the user, the batch command information is broken down based on the extracted basic parameters and target device group information. According to the operational logic and the actual situation of the target devices, the original batch commands are divided into a series of minimal executable atomic commands targeting individual target devices. Each atomic command carries a corresponding target device identifier, ensuring accurate and error-free delivery of commands to the specific device for execution. Atomic commands can also be named Command elements.

[0078] Step S203: Create an initial instruction queue; wherein each cluster device corresponds to the first index value of the initial instruction queue.

[0079] Specifically, an initial command queue is created. This queue is used to store atomic commands in an orderly manner, establishing a correspondence between each cluster device and the first index value of the initial command queue according to specific rules. The command queue can also be named the Command queue. One Command queue can correspond to one or more cluster devices.

[0080] Step S204: Calculate the second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, retrieve the target instruction queue that matches the second index value, and distribute the atomic instruction to the target instruction queue.

[0081] Specifically, based on user-defined routing policies and the target device identifier carried by atomic commands, a second index value is calculated to locate the target command queue. The routing policy, in cluster operations, refers to the set of rules used to determine how atomic commands are accurately distributed from the command queue to the target device. Its core is to group and match devices based on preset conditions. For example, in a multi-datacenter server cluster, users can define routing policies based on device geographical location, grouping servers in datacenter A into one group and servers in datacenter B into another. After subsequent command decomposition, atomic commands carrying the datacenter A identifier will be distributed to the command queue corresponding to datacenter A, while commands with the datacenter B identifier will be distributed to the datacenter B queue. Then, in the created initial command queue, the target command queue matching the second index value is retrieved from the first index value, and the atomic command is accurately distributed to that queue. This process achieves intelligent command routing through index value matching, ensuring that commands from devices with the same characteristics are processed centrally, optimizing queue resource allocation and command execution efficiency, and avoiding uneven cluster load caused by disordered distribution. Here, the index value can also be named the key value.

[0082] Step S205: Generate a target configuration item based on the atomic instructions in the target instruction queue, and send the target configuration item to the target device; the target device executes the atomic instructions based on the target configuration item.

[0083] The target device deploys a Processor command execution module. This module primarily relies on two configuration files on the target device: a configuration item list and a node configuration real-state list. Each configuration item corresponds one-to-one with a Command type. Each element in the configuration item list contains the configuration item name, configuration item value, and version number. The node configuration real-state list records the actual state of the configuration items on the node, mainly including: configuration item name, configuration item value, version number, and execution result.

[0084] Specifically, after the atomic instructions are distributed to the target instruction queue, the consuming worker processes in the target queue generate corresponding target configuration items based on the atomic instructions in the queue. These configuration items contain the complete parameter information required by the target device to execute the instructions. Subsequently, the target configuration items are sent to the configuration list of the corresponding target device. After receiving the configuration items, the target device calls its local processor process to execute the atomic instructions according to the preset execution logic, thereby realizing automated operation and maintenance of the device.

[0085] Through steps S201 to S205, batch instruction information is decomposed and intelligently routed to the target device queue, where the target devices execute the specific instructions. This allows the master control node to focus on strategy formulation rather than specific execution, effectively reducing the pressure on the master control node, improving the execution efficiency and resource utilization of large-scale cluster batch operation and maintenance, and achieving full-process tracking of instruction execution status by combining Trait lifecycle management, thus realizing automated closed-loop and eventual consistency of operation and maintenance instructions from issuance to execution.

[0086] In some embodiments, the batch instruction information trait further includes an instruction merging strategy; generating target configuration items based on the atomic instructions in the target instruction queue includes the following steps:

[0087] Based on the instruction merging strategy, atomic instructions in the target instruction queue are compressed to generate target configuration items.

[0088] Specifically, when adding elements to the instruction queue, atomic instructions are compressed and optimized. If the queue is empty, the atomic instructions are directly enqueued; otherwise, the atomic instructions in the target instruction queue are compressed based on the instruction merging strategy (such as overwrite, accumulation, or prohibition of merging) in the batch instruction information trait.

[0089] Through the above steps, atomic instructions in the target instruction queue are compressed using instruction merging strategies (overwrite, accumulation, and prohibit merging), redundant instructions are automatically identified and skipped, and invalid execution is reduced. By eliminating duplicate instructions, the processing load and resource consumption of cluster devices are reduced, instruction execution efficiency is improved, and the high efficiency of cluster operation and maintenance is ensured.

[0090] In some embodiments, atomic instructions further include instruction categories; based on an instruction merging strategy, atomic instructions in the target instruction queue are compressed to generate target configuration items, including the following steps:

[0091] Sequentially traverse the atomic instructions stored in the target instruction queue;

[0092] Check if there is a target atomic instruction in the target instruction queue that was enqueued before the current atomic instruction, and if so, that the same target atomic instruction has the same instruction type and target device identifier as the current atomic instruction being traversed.

[0093] If so, then if the instruction merging strategy indicates instruction compression, the skip flag of the target atomic instruction is set to enabled until the atomic queue in the target instruction queue has been traversed.

[0094] Detect the skip flag of each atomic instruction in the target instruction queue, and generate the target configuration item based on the atomic instructions whose skip flag is disabled.

[0095] Specifically, the atomic instructions in the target instruction queue are traversed sequentially. For each current atomic instruction, it is checked whether there is a target atomic instruction with the same instruction category and target device identifier among the instructions that were enqueued earlier. If a matching target atomic instruction exists, and the instruction merging strategy allows compression (such as overwrite or accumulation strategies), the skip flag of the target atomic instruction is set to enabled (skip=true), so that it is skipped during execution. The parent instruction identifier of the target atomic instruction is added to the newly enqueued atomic instructions until the entire queue has been traversed. Here, the parent instruction identifier refers to the identifier of the batch instruction information Trait to which the atomic instruction belongs. Finally, all instructions with the skip flag enabled are filtered out, and target configuration items are generated only based on atomic instructions with the skip flag disabled. This can be understood as consuming Command elements in the Command queue, with each queue being consumed cyclically by the consumption thread started at creation. If the skip attribute of the Command element is true, the execution of the instruction is skipped; otherwise, the parameters in the Command instruction need to be parsed first, and the instruction is refreshed into the configuration item list on the node to which the target device belongs. This process avoids repeated operations on the same device by forward merging redundant instructions, reduces the transmission and execution of invalid instructions, lowers cluster resource consumption, ensures that the target configuration item contains only necessary operations, and improves the efficiency and accuracy of operation and maintenance instruction execution.

[0096] Figure 5 This is a flowchart of atomic instruction compression according to an embodiment of this application, such as... Figure 5 As shown, the process includes the following steps:

[0097] Step S501, Start the process; the start of the process marks the initiation of the atomic instruction processing flow in the instruction queue.

[0098] Step S502: Match the instruction queue to which the atomic instruction belongs; determine the target instruction queue to which the current atomic instruction should belong, thus limiting the scope for subsequent operations.

[0099] Step S503: Determine if the queue is empty; check if the instruction queue has any elements. If it is empty, proceed directly to add an element to the queue; if it is not empty, continue with the subsequent steps.

[0100] Step S504: The pointer is positioned at the head of the queue; positioning the pointer at the head of the queue prepares for sequential traversal of the queue elements.

[0101] Step S505: Determine if there is a next element; check if there are any other queue elements after the current pointer position. If there are, continue the process; if not, it means the traversal has ended, and proceed to the operation of adding an element to the queue.

[0102] Step S506: Determine if the instruction type and target device are consistent; check if the atomic instruction pointed to by the current pointer is the same as the instruction type and target device identifier of the previous element. If they are the same, proceed to determine if there is an instruction compression strategy; if they are different, return to the step of determining if there is a next element and continue traversing.

[0103] Step S507: Determine if there is an instruction compression strategy; if the instruction type and target device identifier are the same, determine if there is an instruction merging strategy that allows compression (such as overwrite or accumulation strategy). If there is, continue with subsequent operations; if not, return to the step of determining if there is a next element and continue traversing.

[0104] Step S508: Set the skip flag of the old element to enabled; when there is an instruction compression strategy, set the skip flag of the target atomic instruction (old element) that is enqueued first and matched in the queue to enabled, so that it is skipped during execution.

[0105] Step S509: Merge parent instruction identifiers; add the parent instruction identifier of the target atomic instruction (old element) to the newly enqueued atomic instruction and integrate relevant information.

[0106] Step S510: Perform instruction compression; compress instructions according to the instruction merging strategy to reduce redundant instructions.

[0107] Step S511: Add an element to the queue; when the queue has been traversed or the queue is empty, add the current atomic instruction to the target instruction queue.

[0108] Step S512, End; The process ends. Subsequently, based on the queue processed in this way, instructions marked as skipped are filtered out and target configuration items are generated.

[0109] Figure 6 This is a schematic diagram of an instruction merging strategy according to an embodiment of this application. The diagram illustrates three instruction queue element merging strategies:

[0110] Strategy 1: Coverage;

[0111] The diagram illustrates the enqueueing of elements in "on" and "off" states. When a new element is enqueued, its value remains unchanged; it simply overwrites any existing element of the same type in the queue. For example, an element in the "off" state will directly replace the previous element, maintaining its "off" state.

[0112] Strategy 2: Accumulation;

[0113] Taking numeric commands as an example, the elements in the diagram are labeled with values ​​such as "1" and "2". When a new element is enqueued, it is added to the values ​​of commands of the same type in the queue. For example, when an element labeled "2" is enqueued, it is added to the previous element of the same type labeled "1", making the value "3".

[0114] Strategy 3: Prohibit mergers;

[0115] When a new element is enqueued, it is not merged with any element in the queue; each element maintains its independent state. Each enqueued element retains its original state and value, without interfering with others.

[0116] Through the above steps, optimized processing of atomic instructions in the instruction queue is achieved. During sequential traversal, the instruction category and target device identifier are accurately compared. Combined with the instruction merging strategy, redundant instructions are effectively compressed, a skip flag is set, and the parent instruction identifier is merged, avoiding the repeated execution of similar instructions on the same device. Finally, the target configuration item is generated based on the non-skipped atomic instructions, significantly reducing the transmission and execution of invalid instructions, reducing unnecessary consumption of cluster resources, ensuring that the configuration item contains only necessary operations, significantly improving the efficiency and accuracy of operation and maintenance instruction execution, and ensuring the smooth and stable operation and maintenance of the cluster.

[0117] In some embodiments, in the initial instruction queue, based on a first index value, a target instruction queue matching a second index value is retrieved, and atomic instructions are distributed to the target instruction queue, further comprising the following steps:

[0118] If it fails to retrieve an instruction queue that matches the second index value, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.

[0119] Specifically, in the initial instruction queue, when searching for a target instruction queue that matches the second index value (calculated based on the routing policy and the target device identifier) ​​according to the first index value (the index value of the initial instruction queue), if the search operation fails, i.e., no existing instruction queue matching the second index value is found, a new instruction queue will be created based on the second index value. After the new queue is created, atomic instructions are distributed to this newly generated instruction queue, ensuring that atomic instructions are properly arranged into the corresponding queues according to the predetermined routing policy and target device identifier.

[0120] This can be understood as follows: when routing a newly added Command element, first, the queue identifier is checked based on the calculated key value. If a corresponding queue exists and has not been recycled, the queue to which the Command element belongs is matched; otherwise, an empty queue is created, and a worker thread is started to add the mapping relationship between the queue key value and the queue to the cache.

[0121] Figure 7 This is a flowchart illustrating the creation of an instruction queue according to an embodiment of this application, such as... Figure 7 As shown, the process includes the following steps:

[0122] Step S701, Start the process; the starting point of the process marks the start of the entire operation process.

[0123] Step S702: Execute the routing process for the newly added batch instruction information; Execute the routing process for the newly added batch instruction information, calculate the relevant index value according to the routing policy and target device identifier, etc., to prepare for subsequent search or creation of instruction queue.

[0124] Step S703: Determine if a queue identifier exists; determine if there is an instruction queue identifier that matches the calculated index value, thereby determining if there is a corresponding existing instruction queue.

[0125] Step S704: Determine if the queue is already in a reclaimed state; if a queue identifier exists, further determine if the queue is already in a reclaimed state. If it is in a reclaimed state, it means the queue exists but is unusable and needs to be reprocessed. If it is not in a reclaimed state, match the associated instruction queue.

[0126] Step S705: Create an empty queue; if there is no corresponding queue identifier, or the queue is in a recycling state, create a new empty instruction queue.

[0127] Step S706: Start worker threads; After creating the new queue, start the relevant worker threads for subsequent processing and execution of atomic instructions in the queue.

[0128] Step S707: Add queue identifier to cache; Add the identifier of the newly created queue to the cache to facilitate quick search and identification of the queue in the future, and also to facilitate management and maintenance of instruction queue related information.

[0129] Figure 8 This is a flowchart illustrating the destruction of the instruction queue according to an embodiment of this application, such as... Figure 8 As shown, the process includes the following steps:

[0130] Step S801, Start the process; the starting point of the process marks the start of the entire queue management process.

[0131] Step S802: Periodically perform queue health checks; according to the set time cycle, the system automatically and repeatedly checks the health status of the instruction queue in order to promptly detect any problems in the queue.

[0132] Step S803: Determine if the queue is empty; check if there are atomic instructions in the instruction queue. If the queue contains content, it means the queue is in normal use; if the queue is empty, further determination of its vacancy status is required.

[0133] Step S804: Determine if the idle time exceeds the maximum idle time; for queues that are already determined to be empty, check if the duration of their idle state exceeds the preset maximum allowable idle time. This step is to distinguish between queues that are normally idle for short periods and queues that are idle for long periods, so as to handle them accordingly.

[0134] Step S805: Queue Destruction. When the idle time of a queue exceeds the maximum idle time, the queue is deleted from the system, releasing the resources it occupies (such as memory, storage, etc.). This operation optimizes system resource management, avoids invalid queues occupying resources for a long time, and improves the overall system operating efficiency.

[0135] Through the above steps, dynamic management and flexible adaptation of the instruction queue are achieved. When failing to retrieve the target instruction queue, a new queue can be generated promptly based on the second index value, and atomic instructions can be distributed, avoiding the problem of instructions failing to be distributed due to queue matching failure. At the same time, this mechanism allows the system to flexibly create queues according to actual needs, enhancing the adaptability and scalability of instruction distribution, ensuring that atomic instructions are always accurately enqueued according to routing policies and target device identifiers, improving the reliability and efficiency of cluster operation and maintenance instruction distribution, and maintaining the stability and orderliness of cluster operation and maintenance processes.

[0136] In some embodiments, the batch instruction information also includes the execution result status; after the target configuration item is sent to the target device, the following steps are also included:

[0137] The execution result of the target device is detected; the execution result is obtained by the target device generating executable instructions for atomic instructions based on the target configuration items and executing the executable instructions.

[0138] In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.

[0139] Specifically, after the target configuration item is sent to the configuration item list of the target device, the execution status of the target device is monitored. The processor process of the target device will, for each configuration item in the configuration item list, execute the following logic in a loop: compare the configuration item version with the actual version of the device's configuration item; if the versions are inconsistent, execute the instruction program, modify the version number in the actual state of the device's configuration item to the configuration item version, and record the execution result. Once the system detects these execution results, it will update the execution result status in the batch instruction information (Trait) to which the atomic instruction belongs.

[0140] Through the above steps, precise monitoring of the target device's execution status and dynamic updating of batch command information are achieved. After the target configuration items are issued, the system continuously monitors the device's execution results. The target device compares the configuration item versions cyclically to ensure that commands are executed and the status is updated only for configuration items with inconsistent versions, guaranteeing that the device configuration is consistent with expectations. Based on the detected execution results, the system updates the execution result status in the batch command information in real time, enabling maintenance personnel to promptly grasp the execution effectiveness of commands and providing accurate basis for subsequent decisions (such as troubleshooting, retrying operations, etc.), ensuring the traceability, accuracy, and efficiency of the cluster maintenance process, and achieving complete closed-loop management of maintenance commands from issuance to feedback. Moreover, the complex execution scripts are distributed to each target device for execution, and the system only needs to observe whether the versions of the two configuration files are consistent, reducing complexity. This can be understood as asynchronous execution of cluster maintenance commands, reducing the load pressure on the master control node.

[0141] In some embodiments, the atomic instruction further includes a parent instruction identifier; the parent instruction identifier refers to the identifier of the batch instruction information to which the atomic instruction belongs; in response to the detected execution result of the target device, updating the execution result status in the batch instruction information to which the atomic instruction belongs includes the following steps:

[0142] If the version identifier in the target configuration item is found to be consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.

[0143] Specifically, when detecting the execution result of the target device, the system compares the configuration item version of the actual state of the instruction on the target device with the configuration item version in the configuration list. If they match, it means that the target device has successfully executed the atomic instruction and updated the configuration to the specified version. At this time, the system will accurately locate the corresponding batch instruction information through the parent instruction identifier in the atomic instruction (i.e., the identifier of the batch instruction information Trait), and update the execution result status in it to execution success or execution failure according to the actual execution result.

[0144] This mechanism ensures the accuracy of execution results through version comparison and uses parent identifiers to achieve efficient tracking and updating of batch command status, enabling operations and maintenance personnel to grasp the execution results of commands in real time and ensuring the consistency and traceability of cluster configuration.

[0145] In some embodiments, updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device further includes the following steps:

[0146] If the version identifier in the target configuration item is found to be inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time exceeds the preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time when the target configuration item is sent to the target device and the current time.

[0147] Specifically, when detecting the execution result of the target device, the system compares the configuration item version in the actual state of the instruction on the target device with the configuration item version in the configuration list. If the two are inconsistent, it indicates that the device has not successfully updated the configuration as required. If the waiting time from the issuance of the target configuration item to the current time point has exceeded the preset time period threshold, it means that the device has failed to complete the configuration update within a reasonable time, which may result in execution problems. Based on this, the system locates the corresponding batch instruction information through the parent instruction identifier of the atomic instruction (the identifier of the batch instruction information Trait) and updates the execution result status of it to "execution failed".

[0148] Figure 9 This is a flowchart of instruction processing according to an embodiment of this application, such as... Figure 9 As shown, the process includes the following steps:

[0149] Step S901, Start the process; the process start point marks the start of the instruction execution and result processing process.

[0150] Step S902: Determine if the instruction has a skip flag; check if the current instruction has a skip flag. If it does, skip subsequent processing and end the process directly; otherwise, continue to the next step. This step is used to identify instructions that do not need to be executed, avoiding invalid operations.

[0151] Step S903, instruction parameter parsing; perform parameter parsing on instructions without skip markers to understand the specific requirements and configuration information of the instructions.

[0152] Step S904: Refresh the command to the configuration item list of the target device; update the parsed command to the configuration item list of the target device to ensure that the target device obtains the latest command information.

[0153] Step S905: Determine whether the version of the instruction status on the target device is consistent with the current instruction version; compare the version of the instruction status on the target device with the version of the current instruction to determine if they are the same. If they are consistent, it means that the instruction has been successfully issued or does not need to be executed again; if they are inconsistent, the waiting time needs to be further determined.

[0154] Step S906: Determine if the loop time exceeds the maximum waiting time. When the instruction status version on the node is inconsistent with the current instruction version, check if the loop time from instruction issuance to the current state exceeds the preset maximum waiting time. If it exceeds, it indicates that the instruction execution has failed; if it does not exceed, continue waiting for the instruction execution to complete.

[0155] Step S907: Record the instruction result in the batch instruction information; record the result of successful or unsuccessful execution in the batch instruction information.

[0156] Step S908: Notify the parent instruction that the execution was successful; notify the parent instruction (i.e., the batch instruction information to which the atomic instruction belongs) of the instruction execution result information, indicating that the instruction has been processed.

[0157] Step S909: End the process.

[0158] This step, through version comparison and time threshold judgment, accurately identifies execution anomalies and provides timely feedback on the execution result status, enabling operations and maintenance personnel to quickly discover and handle problems, and ensuring the reliability and effectiveness of cluster operations and maintenance.

[0159] This embodiment also provides an operation and maintenance instruction execution device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as described thereon. As used below, the terms "module," "unit," "subunit," etc., can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0160] Figure 10 This is a structural block diagram of a cluster operation and maintenance instruction execution device according to an embodiment of this application, such as... Figure 10As shown, the device includes: a receiving instruction module 101, used to receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device groups, and routing policies; the target device group includes at least one target device in the cluster devices; an instruction decomposition module 102, used to decompose the batch instruction information into atomic instructions based on the basic parameters and the target device group, the atomic instructions carrying target device identifiers; an instruction queue management module 103, used to create an initial instruction queue; wherein each cluster device corresponds to a first index value of the initial instruction queue; an instruction routing and distribution module 104, used to calculate a second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, retrieve a target instruction queue matching the second index value, and distribute the atomic instructions to the target instruction queue; a configuration generation module 105, used to generate target configuration items based on the atomic instructions in the target instruction queue, and distribute the target configuration items to the target devices; the target devices execute the atomic instructions based on the target configuration items.

[0161] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination. Specific examples in this embodiment can be found in the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment.

[0162] The present application will now be described in conjunction with specific embodiments. Figure 11 This is a schematic diagram of the overall system architecture of an embodiment of this application. Figure 12 This is a structural block diagram of the system architecture, including:

[0163] The user operation and maintenance instruction module 121 records user-issued operation and maintenance instructions and cyclically updates their execution status. This module mainly contains two types of resources: system instruction description resources (instruction metadata templates) TraitDef and user batch instruction information Trait. TraitDef: Defines the system-supported operation and maintenance instruction categories, specifying the names, descriptions, and whether they are enabled, as well as the parameters. The definition of operation and maintenance parameters mainly specifies the parsing rules for the parameters of the operation and maintenance instruction. Trait: Records user operation and maintenance instructions and their execution results, including the associated TraitDef, parameters, instruction merging strategy, retry strategy, routing strategy, and the list of devices to be executed. The core capability of this module includes managing the lifecycle of Trait. The Trait lifecycle includes: Initial, Checked, Distributed, Invoking, Success, and Failed. This module includes a resource monitoring queue based on Kubernetes Informer (a resource monitoring mode). It continuously monitors changes to Trait resources using Kubernetes' list & watch mechanism (a query monitoring mechanism). For each resource change, a resource event is generated and added to the resource monitoring queue. Consumers continuously consume this queue, and they take different actions for different lifecycle stages of batch instruction information Trait.

[0164] The instruction batch processing module 122 is a device for disseminating, transforming, and compressing user operation and maintenance instructions. The core resource of this module is the Command (atomic instruction), which is derived from Traits. The relationship between Traits and Commands is one-to-many. This module includes two types of queue structures, an instruction router, and an execution consumption unit. The batch instruction information Trait receiving queue receives Trait instructions from the user operation and maintenance instruction module and is used for Trait instruction distribution. The instruction router caches the mapping relationship between queue index values ​​and instruction queues. It is responsible for continuously consuming elements from the Trait receiving queue, disseminating and transforming them into atomic instructions with different target device addresses, calculating the instruction queue index value to which different atomic instructions should be added according to the routing policy, searching the cache for the instruction queue with that index value, and adding the atomic instruction to that queue. This module is also responsible for managing the creation and destruction of instruction queues. The instruction queue stores atomic instructions transformed from the batch instruction information Trait. When an atomic instruction is added to this queue, each atomic instruction can execute different instruction compression strategies according to the instruction description of its respective Trait. Elements in the queue are consumed by the worker execution consumption unit. The creation and destruction of the queue are managed by the instruction router. The worker execution consumption unit primarily consumes atomic instructions from the instruction queue in a loop. Each atomic instruction contains a parent trait, instruction parameters, instruction type, whether to skip execution, and the target device. The worker updates the configuration item list on the specified target device node based on the target device and instruction content defined in the atomic instruction. The instruction type is equal to the name of the traitdef recorded in its parent trait.

[0165] The instruction execution module 123 is deployed on the nodes that need to execute commands. This module mainly relies on two configuration files on the nodes: a configuration item list and a node configuration real-state list. Each configuration item corresponds one-to-one with the instruction type of the atomic command. Each element in the configuration item list contains the configuration item name, configuration item value, and version number. The node configuration real-state list records the real-state of the configuration items on the node, mainly including: configuration item name, configuration item value, version number, and execution result. The node performs the following operations cyclically based on the two files: comparing the version numbers of identical configuration items in the two files; for configuration items with inconsistent version numbers, executing the instruction function program, and updating the execution result and the configuration item's version number in the node configuration real-state list.

[0166] This embodiment also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0167] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0168] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0169] S1 receives batch instruction information generated according to a preset instruction metadata template; extracts parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group and routing policy; the target device group includes at least one target device in the cluster devices.

[0170] S2, based on the basic parameters and the target device group, the batch instruction information is decomposed to obtain atomic instructions, which carry the target device identifier.

[0171] S3, create the initial instruction queue; where each cluster device corresponds to the first index value of the initial instruction queue.

[0172] S4. Calculate the second index value based on the routing policy and the target device identifier; in the initial instruction queue, retrieve the target instruction queue that matches the second index value based on the first index value, and distribute the atomic instruction to the target instruction queue.

[0173] S5 generates a target configuration item based on the atomic instructions in the target instruction queue and sends the target configuration item to the target device; the target device executes the atomic instructions based on the target configuration item.

[0174] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0175] Furthermore, in conjunction with the operation and maintenance instruction execution methods in the above embodiments, this application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, it implements any one of the operation and maintenance instruction execution methods in the above embodiments. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0176] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0177] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0178] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for executing cluster operation and maintenance instructions, characterized in that, The method includes: Receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group, and routing policy; the target device group includes at least one target device in the cluster device; Based on the basic parameters and the target device group, the batch instruction information is decomposed to obtain atomic instructions, and the atomic instructions carry the target device identifier; An initial instruction queue is created; wherein each of the cluster devices corresponds to a first index value of the initial instruction queue; A second index value is calculated based on the routing policy and the target device identifier; in the initial instruction queue, a target instruction queue matching the second index value is retrieved based on the first index value, and the atomic instruction is distributed to the target instruction queue; A target configuration item is generated based on the atomic instructions in the target instruction queue, and the target configuration item is sent to the target device; the target device executes the atomic instructions based on the target configuration item. The batch instruction information further includes an instruction merging strategy; the instruction merging strategy includes overwrite, accumulation, and disallow merging; the atomic instructions further include instruction categories; the generation of target configuration items based on the atomic instructions in the target instruction queue includes: The atomic instructions stored in the target instruction queue are sequentially traversed. Detect whether there exists a target atomic instruction in the target instruction queue that was enqueued before the current atomic instruction, and whether it has the same instruction type and target device identifier as the current atomic instruction being traversed. If so, then when the instruction merging strategy indicates instruction compression, the skip flag of the target atomic instruction is set to enabled until the atomic queue in the target instruction queue has been traversed. The skip flag of each atomic instruction in the target instruction queue is detected, and the target configuration item is generated based on the atomic instructions whose skip flag is disabled.

2. The cluster operation and maintenance instruction execution method according to claim 1, characterized in that, The step of retrieving a target instruction queue that matches the second index value based on the first index value in the initial instruction queue, and distributing the atomic instruction to the target instruction queue, includes: If it fails to retrieve an instruction queue that matches the second index value, a new instruction queue is generated based on the second index value, and the atomic instruction is distributed to the new instruction queue.

3. The cluster operation and maintenance instruction execution method according to claim 1, characterized in that, The batch instruction information also includes the execution result status; after the target configuration item is sent to the target device, the method further includes: The execution result of the target device is detected; the execution result is obtained by the target device generating executable instructions for the atomic instructions based on the target configuration items and executing the executable instructions. In response to the detected execution result of the target device, the execution result status in the batch instruction information to which the atomic instruction belongs is updated.

4. The cluster operation and maintenance instruction execution method according to claim 3, characterized in that, The atomic instruction also includes a parent instruction identifier; the parent instruction identifier refers to the identifier of the batch instruction information to which the atomic instruction belongs; The step of updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device includes: If the version identifier in the target configuration item is found to be consistent with the version identifier of the configuration item currently running on the target device, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution success or execution failure.

5. The cluster operation and maintenance instruction execution method according to claim 4, characterized in that, The step of updating the execution result status in the batch instruction information to which the atomic instruction belongs in response to the detected execution result of the target device further includes: If the version identifier in the target configuration item is found to be inconsistent with the version identifier of the configuration item currently running on the target device, and the waiting time exceeds a preset time period threshold, the batch instruction information to which the atomic instruction belongs is retrieved based on the parent instruction identifier, and the execution result status in the batch instruction information to which the atomic instruction belongs is updated to execution failure; the waiting time period is the time period between the time when the target configuration item is sent to the target device and the current time.

6. A cluster operation and maintenance instruction execution device, characterized in that, The device includes: The instruction receiving module is used to receive batch instruction information generated according to a preset instruction metadata template; extract parameters from the batch instruction information according to the instruction metadata template to obtain basic parameters, target device group, and routing policy; the target device group includes at least one target device in the cluster devices; the batch instruction information also includes an instruction merging policy; the instruction merging policy includes overwrite, accumulation, and prohibition of merging; The instruction decomposition module is used to decompose the batch instruction information based on the basic parameters and the target device group to obtain atomic instructions, wherein the atomic instructions carry the target device identifier; the atomic instructions also include instruction categories. The instruction queue management module is used to create an initial instruction queue; wherein each of the cluster devices corresponds to a first index value of the initial instruction queue; The instruction routing and distribution module is used to calculate a second index value based on the routing policy and the target device identifier; in the initial instruction queue, based on the first index value, it retrieves a target instruction queue that matches the second index value, and distributes the atomic instruction to the target instruction queue; A configuration generation module is configured to generate a target configuration item based on the atomic instructions in the target instruction queue, and send the target configuration item to the target device; the target device executes the atomic instructions based on the target configuration item. The configuration generation module is further configured to sequentially traverse the atomic instructions stored in the target instruction queue; detect whether there is a target atomic instruction in the target instruction queue that is enqueued before the current atomic instruction and has the same instruction category and target device identifier as the current atomic instruction being traversed; if so, in the case where the instruction merging strategy indicates instruction compression, set the skip flag of the target atomic instruction to the enabled state until the atomic queue in the target instruction queue is traversed; detect the skip flag of each atomic instruction in the target instruction queue, and generate the target configuration item based on the atomic instructions whose skip flag is disabled.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to execute the cluster operation and maintenance instruction execution method according to any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the cluster operation and maintenance instruction execution method according to any one of claims 1 to 5 when running.

Citation Information

Patent Citations

  • Substation auxiliary equipment control system and method and electronic equipment

    CN116068936A

  • Universal building automation and dynamic environment monitoring system batch control algorithm

    CN116430744A